From feaf89cb1edb20ad1c44ed1d18c670abcc326b01 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 8 Mar 2017 17:57:02 -0500 Subject: [PATCH] 2348 added comments to new methods and classes that were missing them --- ...AddImageWizardDataSourceSettingsPanel.java | 2 +- ...ddImageWizardDataSourceSettingsVisual.java | 14 ++++----- .../AddImageWizardSelectDspPanel.java | 9 ++++-- .../AddImageWizardSelectDspVisual.java | 30 +++++++++++-------- 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsPanel.java index a27b0bd227..1643769be0 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsPanel.java @@ -184,7 +184,7 @@ class AddImageWizardDataSourceSettingsPanel extends ShortcutWizardDescriptorPane } } catch (Exception e) { } - component.dspSelectionChanged((String)settings.getProperty("SelectedDsp")); //NON-NLS magic string used SelectDataSourceProcessorPanel + component.setDspSelection((String)settings.getProperty("SelectedDsp")); //NON-NLS magic string used SelectDataSourceProcessorPanel } /** diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsVisual.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsVisual.java index 4f4f374c70..a5671ce0ee 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsVisual.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardDataSourceSettingsVisual.java @@ -61,6 +61,7 @@ final class AddImageWizardDataSourceSettingsVisual extends JPanel { this.wizPanel = wizPanel; typePanel.setLayout(new BorderLayout()); discoverDataSourceProcessors(); + currentDsp = ImageDSProcessor.getType(); //default value to the ImageDSProcessor } /** @@ -78,10 +79,13 @@ final class AddImageWizardDataSourceSettingsVisual extends JPanel { } /** - * WJS-TODO + * Set the current DataSourceProcessor and update the panel to reflect that + * selection. + * + * @param dsType - the name of the DataSourceProcessor you wish to have this + * panel display settings for. */ - void dspSelectionChanged(String dsType) { - // update the current panel to selection + void setDspSelection(String dsType) { currentDsp = dsType; currentPanel = datasourceProcessorsMap.get(dsType).getPanel(); updateCurrentPanel(currentPanel); @@ -122,10 +126,6 @@ final class AddImageWizardDataSourceSettingsVisual extends JPanel { protected DataSourceProcessor getCurrentDSProcessor() { // get the type of the currently selected panel and then look up // the correspodning DS Handler in the map - if (currentDsp.equals("")) { - System.out.println("LOADING EMPTY DSP WJSTODO WJS-TODO LOG ISSUE HERE"); - currentDsp = ImageDSProcessor.getType(); - } DataSourceProcessor dsProcessor = datasourceProcessorsMap.get(currentDsp); return dsProcessor; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspPanel.java index 9898dd1642..449c850a24 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspPanel.java @@ -22,11 +22,13 @@ import java.awt.Component; import java.awt.Cursor; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.logging.Level; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescriptorPanel; @@ -34,13 +36,14 @@ import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.ShortcutWizardDescript * Create a wizard panel which contains a panel allowing the selection of the * DataSourceProcessor */ -class AddImageWizardSelectDspPanel extends ShortcutWizardDescriptorPanel implements PropertyChangeListener { +final class AddImageWizardSelectDspPanel extends ShortcutWizardDescriptorPanel implements PropertyChangeListener { @NbBundle.Messages("SelectDataSourceProcessorPanel.name.text=Select Type of Data") private AddImageWizardSelectDspVisual component; private static final String LAST_DSP_PROPERTIES_FILE = "LastDSPUsed"; private static final String LAST_DSP_USED_KEY = "Last_DSP_Used"; - + private static final Logger logger = Logger.getLogger(AddImageWizardSelectDspVisual.class.getName()); + @Override public Component getComponent() { if (component == null) { @@ -50,7 +53,7 @@ class AddImageWizardSelectDspPanel extends ShortcutWizardDescriptorPanel impleme lastDspUsed = ModuleSettings.getConfigSetting(LAST_DSP_PROPERTIES_FILE, LAST_DSP_USED_KEY); } else { lastDspUsed = ImageDSProcessor.getType(); - System.out.println("NO SAVED DSP WJS-TODO LOG THIS"); + logger.log(Level.WARNING, "There was no properties file containing the last DataSourceProcessor used, Disk Image or VM will be selected by default"); //NON-NLS } WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); component = new AddImageWizardSelectDspVisual(lastDspUsed); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java index 481dbd0ff8..7a86e5dfb9 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardSelectDspVisual.java @@ -41,6 +41,9 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; import org.sleuthkit.autopsy.datasourceprocessors.RawDSProcessor; import org.sleuthkit.autopsy.coreutils.Logger; +/** + * Panel which displays the available DataSourceProcessors and allows selection of one + */ final class AddImageWizardSelectDspVisual extends JPanel { private static final Logger logger = Logger.getLogger(AddImageWizardSelectDspVisual.class.getName()); @@ -58,10 +61,11 @@ final class AddImageWizardSelectDspVisual extends JPanel { } /** - * WJS-TODO + * Find the DSP which is currently selected and save it as the selected + * DataSourceProcessor. * */ - private void dspSelectionChanged() { + private void updateSelectedDsp() { Enumeration buttonGroup = buttonGroup1.getElements(); while (buttonGroup.hasMoreElements()) { AbstractButton dspButton = buttonGroup.nextElement(); @@ -73,23 +77,23 @@ final class AddImageWizardSelectDspVisual extends JPanel { } /** - * WJS-TODO + * Get the DataSourceProcessor which is currently selected in this panel * - * @return + * @return selectedDsp the DataSourceProcessor which is selected in this panel */ String getSelectedDsp() { return selectedDsp; } /** - * WJS-TODO + * Create the a button for each DataSourceProcessor that should exist as an option. */ private void createDataSourceProcessorButtons() { //Listener for button selection ActionListener cbActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - dspSelectionChanged(); + updateSelectedDsp(); } }; List dspList = getListOfDsps(); @@ -139,9 +143,11 @@ final class AddImageWizardSelectDspVisual extends JPanel { } /** - * WJS-TODO - * - * @return + * Create a list of the DataSourceProcessors which should exist as options on this panel. + * The default Autopsy DataSourceProcessors will appear + * at the beggining of the list in the same order. + * + * @return dspList a list of DataSourceProcessors which can be chose in this panel */ private List getListOfDsps() { List dspList = new ArrayList<>(); @@ -172,11 +178,11 @@ final class AddImageWizardSelectDspVisual extends JPanel { } /** - * WJS-TODO + * Create a single button for a DataSourceProcessor * - * @param dspType + * @param dspType - the name of the DataSourceProcessor * - * @return + * @return dspButton a JToggleButton for the specified dspType */ private JToggleButton createDspButton(String dspType) { JToggleButton dspButton = new JToggleButton();