From d544a9b5157876b8333f782d47113fa9155fb840 Mon Sep 17 00:00:00 2001 From: berndmoos Date: Mon, 27 May 2024 11:28:15 +0200 Subject: [PATCH] #448 --- .../exmaraldaSearch/AbstractCOMACorpus.java | 26 ++++++++++--------- .../exakt/exmaraldaSearch/COMACorpus.java | 2 ++ .../exakt/exmaraldaSearch/swing/EXAKT.java | 2 +- .../swing/RegExFilterPanel.java | 2 +- .../exakt/search/swing/InputHelperPanel.form | 5 ++-- .../exakt/search/swing/InputHelperPanel.java | 11 +++++--- 6 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/org/exmaralda/exakt/exmaraldaSearch/AbstractCOMACorpus.java b/src/org/exmaralda/exakt/exmaraldaSearch/AbstractCOMACorpus.java index e1ab4e08..bc2575ed 100644 --- a/src/org/exmaralda/exakt/exmaraldaSearch/AbstractCOMACorpus.java +++ b/src/org/exmaralda/exakt/exmaraldaSearch/AbstractCOMACorpus.java @@ -4,9 +4,11 @@ */ package org.exmaralda.exakt.exmaraldaSearch; +import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.List; +import java.util.Map; import java.util.Set; import org.exmaralda.exakt.search.AbstractXMLFileListCorpus; import org.exmaralda.partitureditor.jexmaralda.StringUtilities; @@ -34,13 +36,13 @@ public abstract class AbstractCOMACorpus extends AbstractXMLFileListCorpus imple String XPATH_TO_SEARCHABLE_SEGMENT = "//segmentation[@name='SpeakerContribution_Event']/ts"; static String XPATH_TO_SEGMENT_NAMES = "//*[self::ts or self::ats or self::nts]/@n"; - Hashtable speakerMappings = new Hashtable(); - Hashtable communicationMappings = new Hashtable(); - Hashtable transcriptionMappings = new Hashtable(); + Map speakerMappings = new HashMap<>(); + Map communicationMappings = new HashMap<>(); + Map transcriptionMappings = new HashMap<>(); - Hashtable speakerAttributes = new Hashtable(); - Hashtable communicationAttributes = new Hashtable(); - Hashtable transcriptionAttributes = new Hashtable(); + Map speakerAttributes = new HashMap<>(); + Map communicationAttributes = new HashMap<>(); + Map transcriptionAttributes = new HashMap<>(); static String[][] FIXED_SPEAKER_ATTRIBUTES = { {"Sigle*","Sigle/text()"}, @@ -60,12 +62,12 @@ public abstract class AbstractCOMACorpus extends AbstractXMLFileListCorpus imple {"Filename*","Filename/text()"} }; - HashSet segmentationNames = new HashSet(); - HashSet annotationNames = new HashSet(); - HashSet descriptionNames = new HashSet(); - HashSet segmentNames = new HashSet(); + HashSet segmentationNames = new HashSet<>(); + HashSet annotationNames = new HashSet<>(); + HashSet descriptionNames = new HashSet<>(); + HashSet segmentNames = new HashSet<>(); - void fetchAttributes(String xpathToStartElement, Hashtable index, String[][] fixedAttributes) { + void fetchAttributes(String xpathToStartElement, Map index, String[][] fixedAttributes) { String searchString = xpathToStartElement + "/Description/Key/@Name"; try { XPath xp = XPath.newInstance(searchString); @@ -124,7 +126,7 @@ void fetchSpeakerLanguageAttributes() { String keyPath = locationPath + "/Description/Key/@Name"; //System.out.println("KeyPath: " + keyPath); XPath xp = XPath.newInstance("//Speaker/" + keyPath); - HashSet allDescriptionNames = new HashSet(); + HashSet allDescriptionNames = new HashSet<>(); for (Object o : xp.selectNodes(comaDocument)){ Attribute a = (Attribute) o; allDescriptionNames.add(a.getValue()); diff --git a/src/org/exmaralda/exakt/exmaraldaSearch/COMACorpus.java b/src/org/exmaralda/exakt/exmaraldaSearch/COMACorpus.java index f11bce3d..c902cb29 100644 --- a/src/org/exmaralda/exakt/exmaraldaSearch/COMACorpus.java +++ b/src/org/exmaralda/exakt/exmaraldaSearch/COMACorpus.java @@ -74,10 +74,12 @@ public void readCorpus(File file, boolean index) throws JDOMException, IOExcepti fetchAttributes("//Transcription", transcriptionAttributes, FIXED_TRANSCRIPTION_ATTRIBUTES); } + @Override public String getXPathToSearchableSegment() { return XPATH_TO_SEARCHABLE_SEGMENT; } + @Override public void setXPathToSearchableSegment(String xp){ XPATH_TO_SEARCHABLE_SEGMENT = xp; } diff --git a/src/org/exmaralda/exakt/exmaraldaSearch/swing/EXAKT.java b/src/org/exmaralda/exakt/exmaraldaSearch/swing/EXAKT.java index 0314f9ce..539cf088 100644 --- a/src/org/exmaralda/exakt/exmaraldaSearch/swing/EXAKT.java +++ b/src/org/exmaralda/exakt/exmaraldaSearch/swing/EXAKT.java @@ -1744,7 +1744,7 @@ public ImageIcon getWelcomeScreen() { public void resetSettings(){ try { java.util.prefs.Preferences.userRoot().node(getPreferencesNode()).clear(); - JOptionPane.showMessageDialog(rootPane, "Preferences reset.\nRestart the editor."); + JOptionPane.showMessageDialog(rootPane, "Preferences reset.
Restart the editor."); } catch (BackingStoreException ex) { Logger.getLogger(EXAKT.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessageDialog(rootPane, "Problem resetting preferences:\n" + ex.getLocalizedMessage()); diff --git a/src/org/exmaralda/exakt/exmaraldaSearch/swing/RegExFilterPanel.java b/src/org/exmaralda/exakt/exmaraldaSearch/swing/RegExFilterPanel.java index 3e9b71a8..27534547 100644 --- a/src/org/exmaralda/exakt/exmaraldaSearch/swing/RegExFilterPanel.java +++ b/src/org/exmaralda/exakt/exmaraldaSearch/swing/RegExFilterPanel.java @@ -152,7 +152,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { private void columnSelectionComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_columnSelectionComboBoxActionPerformed int index = columnSelectionComboBox.getSelectedIndex(); - HashSet types = new HashSet(); + HashSet types = new HashSet<>(); if (index==1) types = tableModel.getData().getTypes(); else if (index==3) types = tableModel.getTypes(1); else if (index==4) types = tableModel.getTypes(2); diff --git a/src/org/exmaralda/exakt/search/swing/InputHelperPanel.form b/src/org/exmaralda/exakt/search/swing/InputHelperPanel.form index 06bc8f84..3d55b0b0 100644 --- a/src/org/exmaralda/exakt/search/swing/InputHelperPanel.form +++ b/src/org/exmaralda/exakt/search/swing/InputHelperPanel.form @@ -763,7 +763,7 @@ - + @@ -772,7 +772,8 @@ - + + diff --git a/src/org/exmaralda/exakt/search/swing/InputHelperPanel.java b/src/org/exmaralda/exakt/search/swing/InputHelperPanel.java index bdad9d2c..9dd4cffd 100644 --- a/src/org/exmaralda/exakt/search/swing/InputHelperPanel.java +++ b/src/org/exmaralda/exakt/search/swing/InputHelperPanel.java @@ -25,7 +25,8 @@ public class InputHelperPanel extends javax.swing.JPanel implements UnicodeKeybo "[A-Za-zÀÈÉÌÍÎÓÒÚÙàèéìíîóòúù]", // 5 : ITALIAN "[A-Za-zÑñ]", // 6 : SPANISH "[A-Za-zÀÂÇÉÈÊËÎÏÔŒÙÛàâçéèêëïîôœûù]", // 7 : FRENCH - "[\\p{L}]" // 8 : ANY KIND OF ALPHABET + "[A-Za-zČŠŽčšž]", // 8 : SLOVENE + "[\\p{L}]" // 9 : ANY KIND OF ALPHABET }; @@ -38,7 +39,8 @@ public class InputHelperPanel extends javax.swing.JPanel implements UnicodeKeybo "[A-ZÀÈÉÌÍÎÓÒÚÙ]", // 5 : ITALIAN "[A-ZÑ]", // 6 : SPANISH "[A-ZÀÂÇÉÈÊËÎÏÔŒÙÛ]", // 7 : FRENCH - "[\\p{Lu}]" // 8 : ANY KIND OF ALPHABET + "[A-ZČŠŽ]", // 8 : SLOVENE + "[\\p{Lu}]" // 9 : ANY KIND OF ALPHABET }; private static final String[] LOWER_CASE_CHARACTER = { @@ -50,7 +52,8 @@ public class InputHelperPanel extends javax.swing.JPanel implements UnicodeKeybo "[a-zàèéìíîóòúù]", // 5 : ITALIAN "[a-záéíñóúü]", // 6 : SPANISH "[a-zàâçéèêëïîôœûù]", // 7 : FRENCH - "[\\p{Ll}]" // 8 : ANY KIND OF ALPHABET + "[a-zčšž]", // 8 : SLOVENE + "[\\p{Ll}]" // 9 : ANY KIND OF ALPHABET }; Comparator caseIgnoringComparator = new java.util.Comparator() { @@ -600,7 +603,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel5.setText("Alphabet: "); alphabetPanel.add(jLabel5); - alphabetComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "German", "Turkish", "Scandinavian", "Portuguese", "Italian", "Spanish", "French", "Any character" })); + alphabetComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "German", "Turkish", "Scandinavian", "Portuguese", "Italian", "Spanish", "French", "Slovene", "Any character" })); alphabetComboBox.setMaximumSize(new java.awt.Dimension(55, 22)); alphabetPanel.add(alphabetComboBox);