1903 Fixed bugs with comboBox ordering and filter creation through combobox

This commit is contained in:
William Schaefer 2017-01-05 16:14:20 -05:00
parent c568e08858
commit ed529ac6c7
4 changed files with 31 additions and 23 deletions

View File

@ -66,21 +66,22 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan
* Returns an array which will contain the names of all options which should * Returns an array which will contain the names of all options which should
* exist in the "Run Ingest Modules On:" JCombobox * exist in the "Run Ingest Modules On:" JCombobox
* *
* Keeping the default File Ingest Filters and the saved one seperate allows
* the default to always be first elements in
*
* @return -filterNames an array of all established filter names as well as * @return -filterNames an array of all established filter names as well as
* a Create New option * a Create New option
*/ */
public String[] getComboBoxContents() { public String[] getComboBoxContents() {
ArrayList<String> nameList = new ArrayList<>(); ArrayList<String> nameList = new ArrayList<>();
if (!(panel == null)) { for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) {
try { nameList.add(fSet.getName());
nameList.addAll(FilesSetsManager.getInstance().getFileIngestFiltersWithDefaults().keySet());
} catch (FilesSetsManager.FilesSetsManagerException ex) {
LOGGER.log(Level.SEVERE, "Failed to get File Ingest Filters for population of of combo box.", ex); //NON-NLS
}
} }
nameList.add(NEW_INGEST_FILTER); nameList.add(NEW_INGEST_FILTER);
String[] returnArray = {}; if (!(panel == null)) {
return nameList.toArray(returnArray); nameList.addAll(panel.getKeys());
}
return nameList.toArray(new String[nameList.size()]);
} }
/** /**

View File

@ -100,11 +100,15 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements
this.ruleDialogTitle = "FilesSetPanel.interesting.title"; this.ruleDialogTitle = "FilesSetPanel.interesting.title";
this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N
} }
} }
Set<String> getKeys() {
load();
return filesSets.keySet();
}
@NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings", @NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings",
"FilesSetDefsPanel.Ingest.Title=Global Ingest Filter Settings"}) "FilesSetDefsPanel.Ingest.Title=File Ingest Filter Settings"})
private void customInit() { private void customInit() {
if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
setName(Bundle.FilesSetDefsPanel_Ingest_Title()); setName(Bundle.FilesSetDefsPanel_Ingest_Title());

View File

@ -74,7 +74,8 @@ public class FilesSetPanel extends javax.swing.JPanel {
* @return A name string. * @return A name string.
*/ */
String getFilesSetName() { String getFilesSetName() {
return this.nameTextField.getText(); String returnValue = this.nameTextField.getText();
return returnValue;
} }
/** /**

View File

@ -123,30 +123,32 @@ public final class FilesSetsManager extends Observable {
} }
/** /**
* Gets a copy of the current ingest file set definitions with the default values. * Gets a copy of the current ingest file set definitions with the default
* values.
* *
* @return A map of FilesSet names to file ingest sets, possibly empty. * @return A map of FilesSet names to file ingest sets, possibly empty.
*/ */
public Map<String, FilesSet> getFileIngestFiltersWithDefaults() throws FilesSetsManagerException { public Map<String, FilesSet> getFileIngestFiltersWithDefaults() throws FilesSetsManagerException {
synchronized (FILE_INGEST_FILTER_LOCK) {
Map<String, FilesSet> returnMap = new HashMap<>(); Map<String, FilesSet> returnMap = new HashMap<>();
returnMap.putAll(getFileIngestFilters());
for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) {
returnMap.put(fSet.getName(), fSet); returnMap.put(fSet.getName(), fSet);
} }
returnMap.putAll(getFileIngestFilters());
return returnMap; return returnMap;
}
} }
/** /**
* Gets a copy of the current ingest file set definitions. * Gets a copy of the current ingest file set definitions.
* *
* The defaults are not included so that they will not show up in the editor. * The defaults are not included so that they will not show up in the
* editor.
* *
* @return A map of FilesSet names to file ingest sets, possibly empty. * @return A map of FilesSet names to file ingest sets, possibly empty.
*/ */
Map<String, FilesSet> getFileIngestFilters() throws FilesSetsManagerException { Map<String, FilesSet> getFileIngestFilters() throws FilesSetsManagerException {
return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), ""); synchronized (FILE_INGEST_FILTER_LOCK) {
return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), "");
}
} }
/** /**