Merge branch '2198-RunIngestModulesWizard' of https://github.com/wschaeferB/autopsy into 2199-ProfilesInAddDataWizard

This commit is contained in:
William Schaefer 2017-02-15 16:39:52 -05:00
commit cd5a435ed6
2 changed files with 15 additions and 27 deletions

View File

@ -42,8 +42,11 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen
"IngestOptionsPanel.profilesTab.toolTipText=Settings for creating and editing profiles."}) "IngestOptionsPanel.profilesTab.toolTipText=Settings for creating and editing profiles."})
private FilesSetDefsPanel filterPanel; private FilesSetDefsPanel filterPanel;
private final static int INDEX_OF_FILTER_PANEL = 0;
private IngestSettingsPanel settingsPanel; private IngestSettingsPanel settingsPanel;
private final static int INDEX_OF_SETTINGS_PANEL = 2;
private ProfileSettingsPanel profilePanel; private ProfileSettingsPanel profilePanel;
private final static int INDEX_OF_PROFILE_PANEL = 1;
/** /**
* This panel implements a property change listener that listens to ingest * This panel implements a property change listener that listens to ingest
* job events so it can disable the buttons on the panel if ingest is * job events so it can disable the buttons on the panel if ingest is
@ -63,11 +66,11 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen
profilePanel = new ProfileSettingsPanel(); profilePanel = new ProfileSettingsPanel();
tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.text"), null, tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.text"), null,
filterPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.toolTipText"), 0); filterPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.fileFiltersTab.toolTipText"), INDEX_OF_FILTER_PANEL);
tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.text"), null, tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.text"), null,
profilePanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.toolTipText"), 1); profilePanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.profilesTab.toolTipText"), INDEX_OF_PROFILE_PANEL);
tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.text"), null, tabbedPane.insertTab(NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.text"), null,
settingsPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.toolTipText"), 2); settingsPanel, NbBundle.getMessage(IngestOptionsPanel.class, "IngestOptionsPanel.settingsTab.toolTipText"), INDEX_OF_SETTINGS_PANEL);
//Listener for when tabbed panes are switched, because we can have two file filter definitions panels open at the same time //Listener for when tabbed panes are switched, because we can have two file filter definitions panels open at the same time
//we may wind up in a situation where the user has created and saved one in the profiles panel //we may wind up in a situation where the user has created and saved one in the profiles panel
//so we need to refresh the filterPanel in those cases before proceeding. //so we need to refresh the filterPanel in those cases before proceeding.
@ -75,10 +78,15 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
if (e.getSource() instanceof JTabbedPane) { if (e.getSource() instanceof JTabbedPane) {
profilePanel.shouldFiltersBeRefreshed(); //because we can have two filterPanels open at the same time
{ //we need to save the settings when we change tabs otherwise
filterPanel.load(); //they could be overwritten with out of date
} if (tabbedPane.getSelectedIndex() == INDEX_OF_FILTER_PANEL) {
filterPanel.load();
}
else {
filterPanel.saveSettings();
}
} }
} }
}); });
@ -152,10 +160,6 @@ public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implemen
*/ */
@Override @Override
public void saveSettings() { public void saveSettings() {
//if a new filter was created in the profilePanel we don't want to save over it accidently
if (profilePanel.shouldFiltersBeRefreshed()) {
filterPanel.load();
}
filterPanel.store(); filterPanel.store();
settingsPanel.store(); settingsPanel.store();
} }

View File

@ -51,7 +51,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op
private final DefaultListModel<IngestProfile> profilesListModel; private final DefaultListModel<IngestProfile> profilesListModel;
private Map<String, IngestProfile> profiles; private Map<String, IngestProfile> profiles;
private ProfilePanel panel; private ProfilePanel panel;
private boolean filtersShouldBeRefreshed;
/** /**
* Creates new form ProfileOptionsPanel * Creates new form ProfileOptionsPanel
@ -59,7 +58,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op
ProfileSettingsPanel() { ProfileSettingsPanel() {
this.profilesListModel = new DefaultListModel<>(); this.profilesListModel = new DefaultListModel<>();
initComponents(); initComponents();
this.filtersShouldBeRefreshed = false;
this.profileList.setModel(profilesListModel); this.profileList.setModel(profilesListModel);
this.profileList.addListSelectionListener(new ProfileSettingsPanel.ProfileListSelectionListener()); this.profileList.addListSelectionListener(new ProfileSettingsPanel.ProfileListSelectionListener());
ingestWarningLabel.setVisible(false); ingestWarningLabel.setVisible(false);
@ -275,20 +273,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_deleteProfileButtonActionPerformed }//GEN-LAST:event_deleteProfileButtonActionPerformed
/**
* Returns whether there were possible changes to the filter list since the
* last time this was called.
*
* Resets value to false after being called.
*
* @return true or false
*/
boolean shouldFiltersBeRefreshed() {
boolean shouldRefresh = filtersShouldBeRefreshed;
filtersShouldBeRefreshed = false;
return shouldRefresh;
}
/** /**
* Enable / disable buttons, so they can be disabled while ingest is * Enable / disable buttons, so they can be disabled while ingest is
* running. * running.