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

@ -65,22 +65,23 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan
/**
* Returns an array which will contain the names of all options which should
* 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
* a Create New option
*/
public String[] getComboBoxContents() {
ArrayList<String> nameList = new ArrayList<>();
if (!(panel == null)) {
try {
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
}
}
ArrayList<String> nameList = new ArrayList<>();
for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) {
nameList.add(fSet.getName());
}
nameList.add(NEW_INGEST_FILTER);
String[] returnArray = {};
return nameList.toArray(returnArray);
if (!(panel == null)) {
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.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",
"FilesSetDefsPanel.Ingest.Title=Global Ingest Filter Settings"})
"FilesSetDefsPanel.Ingest.Title=File Ingest Filter Settings"})
private void customInit() {
if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) {
setName(Bundle.FilesSetDefsPanel_Ingest_Title());

View File

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

View File

@ -123,32 +123,34 @@ 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.
*/
public Map<String, FilesSet> getFileIngestFiltersWithDefaults() throws FilesSetsManagerException {
synchronized (FILE_INGEST_FILTER_LOCK) {
Map<String, FilesSet> returnMap = new HashMap<>();
returnMap.putAll(getFileIngestFilters());
Map<String, FilesSet> returnMap = new HashMap<>();
for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) {
returnMap.put(fSet.getName(), fSet);
}
returnMap.putAll(getFileIngestFilters());
return returnMap;
}
}
/**
* 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.
*/
Map<String, FilesSet> getFileIngestFilters() throws FilesSetsManagerException {
return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), "");
synchronized (FILE_INGEST_FILTER_LOCK) {
return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), "");
}
}
/**
* Sets the current interesting file sets definitions, replacing any
* previous definitions.