Skip to content

Commit

Permalink
chore(pom): Java-Version 1.8.0_421 (Oracle Corporation)
Browse files Browse the repository at this point in the history
/Library/Java/JavaVirtualMachines/jdk-1.8.jdk/Contents/Home/jre
  • Loading branch information
RalfBarkow committed Jul 28, 2024
1 parent 5175eb1 commit bf98556
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 213 deletions.
25 changes: 5 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.danielluedecke</groupId>
<artifactId>Zettelkasten</artifactId>
<version>3.2024.06</version>
<version>3.2024.07</version>
<name>Zettelkasten</name>
<properties>
<exec.mainClass>de.danielluedecke.zettelkasten.ZettelkastenApp</exec.mainClass>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<zkn.launch4jVersion>${project.version}.0</zkn.launch4jVersion>
<zkn.supportsDmg>false</zkn.supportsDmg>
<zkn.useGenIsoImage>false</zkn.useGenIsoImage>
Expand Down Expand Up @@ -101,8 +103,8 @@
<configuration>
<toolchains>
<jdk>
<version>11</version>
<vendor>temurin</vendor>
<version>1.8</version>
<vendor>oracle</vendor>
</jdk>
</toolchains>
</configuration>
Expand Down Expand Up @@ -386,11 +388,6 @@
<version>1.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand All @@ -413,18 +410,6 @@
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>11</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>11</version>
<type>jar</type>
</dependency>
</dependencies>
<repositories>
<repository>
Expand Down

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions src/main/java/de/danielluedecke/zettelkasten/util/HtmlUbbUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1991,28 +1991,28 @@ private static String convertTablesToTex(String dummy, Settings settingsObj) {
return dummy;
}

/**
* This method converts all ubb-tags of an entry, that are used to indicate
* formatting, into html-tags. We use this to set up an html-page with the
* entries content that is displayed in a jEditorPane.
*
* @param settings
* @param dataObj
* @param bibtexObj
* @param c the content of the entry in "raw" format (i.e. as it is stored
* in the xml-file)
* @param useFootnoteRef
* @param createFormTag
* @param isDesktop
* @param removeNonStandardTags
* @return a converted string with html-tags instead of ubb-tags
*/
public static String convertUbbToTex(Settings settings, Daten dataObj, BibTeX bibtexObj, String c, boolean useFootnoteRef, boolean createFormTag, boolean isDesktop, boolean removeNonStandardTags) {
/**
* This method converts all ubb tags of an item (or entry) that are used to specify
* formatting into html tags. This way an HTML page with the content of the item
* is created and displayed in a jEditorPane.
*
* @param settings
* @param data
* @param bibTeX
* @param c the content of the entry in "raw" format (i.e.
* as it is stored in the xml-file)
* @param useFootnoteRef
* @param createFormTag
* @param isDesktop
* @param removeNonStandardTags
* @return a converted string with html-tags instead of ubb-tags
*/
public static String convertUbbToTex(Settings settings, Daten data, BibTeX bibTeX, String c, boolean useFootnoteRef, boolean createFormTag, boolean isDesktop, boolean removeNonStandardTags) {
// here we create a path to our image folder. this is needed for
// converting image tags, since the image ae copied to an own local folder,
// but the source-information only stores the file name, not the path information.
// see CNewEntry.java, method "insertImage" for more details
String imgpath = settings.getImagePath(dataObj.getUserImagePath(), true);
String imgpath = settings.getImagePath(data.getUserImagePath(), true);
// for latex, we need / instead of \ as separator char
imgpath = imgpath.replace("\\", "/");
// if we have a windows operating system, we have to add an additonal
Expand Down Expand Up @@ -2083,13 +2083,13 @@ public static String convertUbbToTex(Settings settings, Daten dataObj, BibTeX bi
// konvertierung von sonderzeichen
dummy = dummy.replace("...", "\\dots");
// here we convert all author-footnotes to latex-cite-tags
dummy = ExportTools.createLatexFootnotes(dataObj, dummy, useFootnoteRef);
dummy = ExportTools.createLatexFootnotes(data, dummy, useFootnoteRef);
// replace all remaining footnotes without bibkey: [fn 102] becomes (FN xx)
dummy = convertFootnotes(dataObj, bibtexObj, settings, dummy, true, false);
dummy = convertFootnotes(data, bibTeX, settings, dummy, true, false);
// convert tables in tex-format
dummy = convertTablesToTex(dummy, settings);
// convert form-tags
dummy = convertForms(settings, dataObj, dummy, Constants.EXP_TYPE_TEX, createFormTag, true);
dummy = convertForms(settings, data, dummy, Constants.EXP_TYPE_TEX, createFormTag, true);

// Convert [qm] ("inline quotes") to \enquote{} (fixes bug reproduced by "testBugMarkdownZitatWirdNichtKorrektNachLatexExportiert")
dummy = dummy.replaceAll("\\[qm\\](.*?)\\[/qm\\]", Matcher.quoteReplacement("\\enquote{") + "$1" + "}");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package de.danielluedecke.zettelkasten;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class ListSelectionBugTest {

private JList<String> jListQuickInputAuthor;
private JList<String> jListKeywords;
private JList<String> jListLinks;
private JList<String> jListQuickInputKeywords;
private boolean listUpdateActive;

@BeforeMethod
public void setUp() {
jListQuickInputAuthor = new JList<>(new String[]{"Author1", "Author2"});
jListKeywords = new JList<>(new String[]{"Keyword1", "Keyword2"});
jListLinks = new JList<>(new String[]{"Link1", "Link2"});
jListQuickInputKeywords = new JList<>(new String[]{"KeywordA", "KeywordB"});
listUpdateActive = false;
}

@Test(expectedExceptions = ClassCastException.class)
public void testValueChangedThrowsClassCastException() {
ListSelectionListener listener = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (listUpdateActive) {
return;
}
ListSelectionModel lsm = ((JList<?>) e.getSource()).getSelectionModel(); // This will throw ClassCastException
lsm.setValueIsAdjusting(true);
}
};

ListSelectionModel selectionModel = jListQuickInputAuthor.getSelectionModel();
selectionModel.addListSelectionListener(listener);

// Simulate selection change
selectionModel.setSelectionInterval(0, 0);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package de.danielluedecke.zettelkasten;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

public class ListSelectionFixTest {

private JList<String> jListQuickInputAuthor;
private JList<String> jListKeywords;
private JList<String> jListLinks;
private JList<String> jListQuickInputKeywords;
private boolean listUpdateActive;
private boolean authorSelected;
private boolean keywordSelected;
private boolean attachmentSelected;
private boolean quickKeywordSelected;

@BeforeMethod
public void setUp() {
jListQuickInputAuthor = new JList<>(new String[]{"Author1", "Author2"});
jListKeywords = new JList<>(new String[]{"Keyword1", "Keyword2"});
jListLinks = new JList<>(new String[]{"Link1", "Link2"});
jListQuickInputKeywords = new JList<>(new String[]{"KeywordA", "KeywordB"});
listUpdateActive = false;
authorSelected = false;
keywordSelected = false;
attachmentSelected = false;
quickKeywordSelected = false;
}

private void setAuthorSelected(boolean selected) {
authorSelected = selected;
}

private void setKeywordSelected(boolean selected) {
keywordSelected = selected;
}

private void setAttachmentSelected(boolean selected) {
attachmentSelected = selected;
}

private void setQuickKeywordSelected(boolean selected) {
quickKeywordSelected = selected;
}

@Test
public void testValueChangedNoClassCastException() {
ListSelectionListener listener = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (listUpdateActive) {
return;
}

Object source = e.getSource();
if (source instanceof ListSelectionModel) {
ListSelectionModel lsm = (ListSelectionModel) source;
lsm.setValueIsAdjusting(true);

if (jListQuickInputAuthor.getSelectionModel() == lsm) {
setAuthorSelected(jListQuickInputAuthor.getSelectedIndex() != -1);
} else if (jListKeywords.getSelectionModel() == lsm) {
setKeywordSelected(jListKeywords.getSelectedIndex() != -1);
} else if (jListLinks.getSelectionModel() == lsm) {
setAttachmentSelected(jListLinks.getSelectedIndex() != -1);
} else if (jListQuickInputKeywords.getSelectionModel() == lsm) {
setQuickKeywordSelected(jListQuickInputKeywords.getSelectedIndex() != -1);
}
}
}
};

ListSelectionModel selectionModel = jListQuickInputAuthor.getSelectionModel();
selectionModel.addListSelectionListener(listener);

// Simulate selection change
selectionModel.setSelectionInterval(0, 0);
assertTrue(authorSelected);
assertFalse(keywordSelected);
assertFalse(attachmentSelected);
assertFalse(quickKeywordSelected);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,7 @@ protected void startup() {
zettelkastenView = new ZettelkastenView(app, settings, tasksData);
zettelkastenView.setData(data);
}

@Test
public void testUpdateEntryPaneAndKeywordsPaneValidEntry() {
int validEntryNumber = 1;
String sampleEntry = "<html><body><div class='entryrating'>Sample Entry</div></body></html>";
data.addEntry(validEntryNumber, sampleEntry);

zettelkastenView.updateEntryPaneAndKeywordsPane(validEntryNumber);

assertTrue(zettelkastenView.jEditorPaneEntry.getText().contains("Sample Entry"));
assertFalse(zettelkastenView.keywordListModel.isEmpty());
assertEquals(zettelkastenView.jTextFieldEntryNumber.getText(), String.valueOf(validEntryNumber));
}


@Test
public void testUpdateEntryPaneAndKeywordsPaneInvalidEntry() {
int invalidEntryNumber = 0;
Expand All @@ -57,40 +44,4 @@ public void testUpdateEntryPaneAndKeywordsPaneInvalidEntry() {
assertEquals(zettelkastenView.statusOfEntryLabel.getText(),
zettelkastenView.getResourceMap().getString("entryOfText"));
}

@Test
public void testUpdateEntryPaneAndKeywordsPaneAddToHistory() {
settings.setAddAllToHistory(true);
int entryNumber = 1;
String sampleEntry = "<html><body><div class='entryrating'>Sample Entry</div></body></html>";
data.addEntry(entryNumber, sampleEntry);

zettelkastenView.updateEntryPaneAndKeywordsPane(entryNumber);

//assertTrue(data.addToHistory(entryNumber));
assertTrue(zettelkastenView.buttonHistoryBack.isEnabled());
assertFalse(zettelkastenView.buttonHistoryForward.isEnabled());
}

@Test
public void testHistoryNavigationButtonsState() {
settings.setAddAllToHistory(true);
int firstEntry = 1;
int secondEntry = 2;
String firstEntryContent = "<html><body><div class='entryrating'>First Entry</div></body></html>";
String secondEntryContent = "<html><body><div class='entryrating'>Second Entry</div></body></html>";
data.addEntry(firstEntry, firstEntryContent);
data.addEntry(secondEntry, secondEntryContent);

zettelkastenView.updateEntryPaneAndKeywordsPane(firstEntry);
zettelkastenView.updateEntryPaneAndKeywordsPane(secondEntry);

assertTrue(data.canHistoryBack());
assertFalse(data.canHistoryForward());

zettelkastenView.buttonHistoryBack.doClick();

assertTrue(data.canHistoryForward());
assertTrue(zettelkastenView.jEditorPaneEntry.getText().contains("First Entry"));
}
}

This file was deleted.

0 comments on commit bf98556

Please sign in to comment.