From c76f4a788776488e9bf38c1a1894f17eb97ac941 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 25 Jan 2017 15:33:36 -0500 Subject: [PATCH 01/22] 2198-Run ingest module wizard added but not connected to profiles --- Core/nbproject/project.xml | 16 +++ .../autopsy/ingest/IngestJobSettings.java | 4 +- .../ingest/IngestJobSettingsPanel.java | 1 + .../autopsy/ingest/IngestProfileMap.java | 7 +- .../ingest/RunIngestModulesAction.java | 12 +- .../ingest/RunIngestModulesDialog.java | 2 +- .../runIngestModuleWizard/Bundle.properties | 2 + .../IngestProfileSelectionPanel.form | 93 +++++++++++++ .../IngestProfileSelectionPanel.java | 129 ++++++++++++++++++ .../RunIngestModuleAction.java | 62 +++++++++ .../RunIngestModuleWizardWizardIterator.java | 101 ++++++++++++++ .../RunIngestModuleWizardWizardPanel1.java | 94 +++++++++++++ .../RunIngestModuleWizardWizardPanel2.java | 70 ++++++++++ .../ShortCircuitableWizardPanel.java | 20 +++ 14 files changed, 604 insertions(+), 9 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index 28a8815bca..fb43fea301 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -31,6 +31,14 @@ 1.46.1 + + org.netbeans.api.templates + + + + 1.6.1 + + org.netbeans.core @@ -155,6 +163,14 @@ 9.7.1 + + org.openide.loaders + + + + 7.63.2 + + org.openide.modules diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 03fa136a80..b5c3410522 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -120,7 +120,7 @@ public class IngestJobSettings { /** * Constructs an ingest job settings object for a given execution context. * Examples of execution contexts include the add data source wizard and the - * run ingest modules dialog. Different execution conterxts may have + * run ingest modules dialog. Different execution contexts may have * different ingest job settings. * * @param executionContext The ingest execution context identifier. @@ -137,7 +137,7 @@ public class IngestJobSettings { /** * Constructs an ingest job settings object for a given context. Examples of * execution contexts include the add data source wizard and the run ingest - * modules dialog. Different execution conterxts may have different ingest + * modules dialog. Different execution contexts may have different ingest * job settings. * * @param context The context identifier string. diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index ea9f5b52cf..d82b94d4ef 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -84,6 +84,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); fileIngestFilterComboBox.setSelectedItem(settings.getFileIngestFilter().getName()); + this.setName("Configure Ingest Modules"); } /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java index f1bbed0a3e..e533ce3fe4 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Collections; import java.util.HashSet; import java.util.TreeMap; import org.apache.commons.io.FileUtils; @@ -30,7 +29,7 @@ import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; -class IngestProfileMap { +public class IngestProfileMap { private static final String PROFILE_FOLDER = "IngestProfiles"; private static final String PROFILE_NAME_KEY = "Profile_Name"; @@ -44,7 +43,7 @@ class IngestProfileMap { * * @return profileList */ - TreeMap getIngestProfileMap() { + public TreeMap getIngestProfileMap() { if (profileMap == null) { loadProfileList(); } @@ -94,7 +93,7 @@ class IngestProfileMap { * FileIngestFilter. The name can be used to find the ModuleSettings for * this profile. */ - static class IngestProfile { + public static class IngestProfile { private final String name; private final String description; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java index 285b916c81..d071dda0b7 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java @@ -19,8 +19,12 @@ package org.sleuthkit.autopsy.ingest; import java.awt.event.ActionEvent; +import java.text.MessageFormat; import java.util.Collections; import javax.swing.AbstractAction; +import org.openide.DialogDisplayer; +import org.openide.WizardDescriptor; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleWizardWizardIterator; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Image; @@ -47,7 +51,11 @@ final class RunIngestModulesAction extends AbstractAction { */ @Override public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(dataSource)); - ingestDialog.display(); + WizardDescriptor wiz = new WizardDescriptor(new RunIngestModuleWizardWizardIterator()); + // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() + wiz.setTitleFormat(new MessageFormat("{0}")); + wiz.setTitle("Run Ingest Modules"); + if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { + } } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java index f2cab6ecd1..67f5f41c98 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java @@ -99,7 +99,7 @@ public final class RunIngestModulesDialog extends JDialog { /** * Center the dialog. */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();; + Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); /** * Get the default or saved ingest job settings for this context and use diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties new file mode 100644 index 0000000000..66a07f4bad --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties @@ -0,0 +1,2 @@ +IngestProfileSelectionPanel.jButton1.text=Ingest Settings +IngestProfileSelectionPanel.jLabel1.text=Select Profile: diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form new file mode 100644 index 0000000000..07f136df0f --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form @@ -0,0 +1,93 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java new file mode 100644 index 0000000000..dcc931a250 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -0,0 +1,129 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; + +public final class IngestProfileSelectionPanel extends JPanel implements ItemListener { + + RunIngestModuleWizardWizardPanel1 wizardPanel; + + /** + * Creates new form runIngestModuleWizardVisualPanel1 + */ + public IngestProfileSelectionPanel(RunIngestModuleWizardWizardPanel1 panel) { + initComponents(); + //WJS-TODO figure out how to get width of writable area, if text length greater than width. Trim text to width minus 3 chars in length and then add ... to the end + wizardPanel = panel; + int[] tempIDs = getElements(); + customSettings = new JRadioButton("Custom Settings - configure individual module settings"); + customSettings.setRolloverEnabled(true); + customSettings.setToolTipText("configure individual module settings"); + buttonGroup1.add(customSettings); + jPanel1.add(customSettings); + for (int i = 0; i < tempIDs.length; i++) { + JRadioButton myRadio = new JRadioButton("Fiction Profile #" + i + " - This is a fictional profile for place holder text"); + myRadio.addItemListener(this); + buttonGroup1.add(myRadio); + jPanel1.add(myRadio); + } + + } + + @Override + public String getName() { + return "Ingest Profile Selection"; + } + + int getNumOfElements() { + return 10; + } + + int[] getElements() { + int size = getNumOfElements(); + int[] elements = new int[size]; + for (int i = 5; i < 5 + size; i++) { + elements[i - 5] = i; + } + return elements; + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonGroup1 = new javax.swing.ButtonGroup(); + jButton1 = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + + org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.jButton1.text")); // NOI18N + + jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + + jPanel1.setAutoscrolls(true); + jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.PAGE_AXIS)); + jScrollPane1.setViewportView(jPanel1); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.jLabel1.text")); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 523, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jButton1) + .addGap(18, 18, 18)) + ); + }// //GEN-END:initComponents + + + boolean hasNextPanel = true; + private JRadioButton customSettings; + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPanel1; + private javax.swing.JScrollPane jScrollPane1; + // End of variables declaration//GEN-END:variables + + @Override + public void itemStateChanged(ItemEvent e) { + boolean hadNextPanel = hasNextPanel; + hasNextPanel= !hasNextPanel; + System.out.println("SWITCHED VALUES, VALUE NOW:"+ hasNextPanel); + wizardPanel.fireChangeEvent(); + this.firePropertyChange("LAST_ENABLED", hadNextPanel, hasNextPanel); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java new file mode 100644 index 0000000000..9231485d9f --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java @@ -0,0 +1,62 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.MessageFormat; +import org.openide.DialogDisplayer; +import org.openide.WizardDescriptor; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionRegistration; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle.Messages; +import org.openide.util.actions.CallableSystemAction; +import org.openide.util.actions.Presenter; +import org.openide.util.lookup.ServiceProvider; + + + + + + @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleAction") +@ActionRegistration( + displayName = "#CTL_RunIngestModulesAction", lazy = false) +@ActionReference(path = "Toolbars/Tools", position = 200) + @ServiceProvider(service = RunIngestModuleAction.class) +@Messages("CTL_RunIngestModulesAction=Run Ingest Modules Wizard") +public final class RunIngestModuleAction extends CallableSystemAction implements Presenter.Toolbar { + public static ActionListener run() { + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + WizardDescriptor wiz = new WizardDescriptor(new RunIngestModuleWizardWizardIterator()); + // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() + // {1} will be replaced by WizardDescriptor.Iterator.name() + wiz.setTitleFormat(new MessageFormat("{0} ({1})")); + wiz.setTitle("...dialog title..."); + if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { + } + } + }; + } + + @Override + public void performAction() { + + } + + @Override + public String getName() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public HelpCtx getHelpCtx() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java new file mode 100644 index 0000000000..d68f283d65 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java @@ -0,0 +1,101 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.TreeMap; +import javax.swing.JComponent; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.sleuthkit.autopsy.ingest.IngestProfileMap; + +public final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iterator { + + private int index; + + private List panels; + + + private List getPanels() { + if (panels == null) { + panels = new ArrayList(); + TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); + if (!profileMap.isEmpty()) { + panels.add(new RunIngestModuleWizardWizardPanel1()); + } + + panels.add(new RunIngestModuleWizardWizardPanel2()); + String[] steps = new String[panels.size()]; + for (int i = 0; i < panels.size(); i++) { + Component c = panels.get(i).getComponent(); + // Default step name to component name of panel. + steps[i] = c.getName(); + if (c instanceof JComponent) { // assume Swing components + JComponent jc = (JComponent) c; + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i); + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); + jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true); + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true); + jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true); + } + } + } + return panels; + } + + @Override + public ShortCircuitableWizardPanel current() { + return getPanels().get(index); + } + + @Override + public String name() { + return ""; + } + + @Override + public boolean hasNext() { + return (index < getPanels().size() - 1) && current().shouldCheckForNext(); + } + + @Override + public boolean hasPrevious() { + return index > 0; + } + + @Override + public void nextPanel() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + index++; + } + + @Override + public void previousPanel() { + if (!hasPrevious()) { + throw new NoSuchElementException(); + } + index--; + } + + // If nothing unusual changes in the middle of the wizard, simply: + @Override + public void addChangeListener(ChangeListener l) { + } + + @Override + public void removeChangeListener(ChangeListener l) { + } + // If something changes dynamically (besides moving between panels), e.g. + // the number of panels changes in response to user input, then use + // ChangeSupport to implement add/removeChangeListener and call fireChange + // when needed + +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java new file mode 100644 index 0000000000..9fe809eac5 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java @@ -0,0 +1,94 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import java.util.HashSet; +import java.util.Set; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; + +public class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPanel { + + private final Set listeners = new HashSet(1); + /** + * The visual component that displays this panel. If you need to access the + * component from this class, just use getComponent(). + */ + private IngestProfileSelectionPanel component; + + // Get the visual component for the panel. In this template, the component + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + @Override + public IngestProfileSelectionPanel getComponent() { + if (component == null) { + component = new IngestProfileSelectionPanel(this); + } + return component; + } + + @Override + boolean shouldCheckForNext() { + return component.hasNextPanel; + } + + @Override + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx("help.key.here"); + } + + @Override + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...) and + // this condition changes (last form field filled in...) then + // use ChangeSupport to implement add/removeChangeListener below. + // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful. + } + + protected final void fireChangeEvent() { + Set ls; + synchronized (listeners) { + ls = new HashSet<>(listeners); + } + ChangeEvent ev = new ChangeEvent(this); + for (ChangeListener l : ls) { + l.stateChanged(ev); + } + } + + @Override + public void addChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.add(l); + } + } + + @Override + public void removeChangeListener(ChangeListener l) { + synchronized (listeners) { + listeners.remove(l); + } + } + + @Override + public void readSettings(WizardDescriptor wiz) { + // use wiz.getProperty to retrieve previous panel state + } + + @Override + public void storeSettings(WizardDescriptor wiz) { + // use wiz.putProperty to remember current panel state + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java new file mode 100644 index 0000000000..82fe45ca13 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java @@ -0,0 +1,70 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import javax.swing.event.ChangeListener; +import org.openide.WizardDescriptor; +import org.openide.util.HelpCtx; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; +import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; + +public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPanel { + + /**f + The visual ingestJobSettingsPanel that displays this panel. If you need to access the + ingestJobSettingsPanel from this class, just use getComponent(). + */ + private IngestJobSettingsPanel ingestJobSettingsPanel; + + // Get the visual ingestJobSettingsPanel for the panel. In this template, the ingestJobSettingsPanel + // is kept separate. This can be more efficient: if the wizard is created + // but never displayed, or not all panels are displayed, it is better to + // create only those which really need to be visible. + @Override + public IngestJobSettingsPanel getComponent() { + if (ingestJobSettingsPanel == null) { + ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings("org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleAction")); + } + return ingestJobSettingsPanel; + } + + @Override + public HelpCtx getHelp() { + // Show no Help button for this panel: + return HelpCtx.DEFAULT_HELP; + // If you have context help: + // return new HelpCtx("help.key.here"); + } + + @Override + public boolean isValid() { + // If it is always OK to press Next or Finish, then: + return true; + // If it depends on some condition (form filled out...) and + // this condition changes (last form field filled in...) then + // use ChangeSupport to implement add/removeChangeListener below. + // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful. + } + + @Override + public void addChangeListener(ChangeListener l) { + } + + @Override + public void removeChangeListener(ChangeListener l) { + } + + @Override + public void readSettings(WizardDescriptor wiz) { + // use wiz.getProperty to retrieve previous panel state + } + + @Override + public void storeSettings(WizardDescriptor wiz) { + // use wiz.putProperty to remember current panel state + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java new file mode 100644 index 0000000000..9a5ca8656c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; + +import org.openide.WizardDescriptor; + +/** + * + * + */ + +public abstract class ShortCircuitableWizardPanel implements WizardDescriptor.Panel { + + boolean shouldCheckForNext(){ + return true; + } +} From 7c88dca3e95f5752ff1ffd4796afa1c7bfdb2fca Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 1 Feb 2017 15:40:14 -0500 Subject: [PATCH 02/22] Merge from stashed changes --- .../sleuthkit/autopsy/modules/interestingitems/Bundle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index e5ae1eb726..f78d977613 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -81,3 +81,4 @@ FilesSetDefsPanel.ingoreUnallocCheckbox.text=Ignore Unallocated Space FilesSetDefsPanel.ingoreUnallocCheckbox.toolTipText=Ignores unallocated space, such as deleted files. May run faster but produce less complete results. FilesSetDefsPanel.ingestWarningLabel.text=Ingest is ongoing, some settings will be unavailable until it finishes. FilesSetDefsPanel.allRadioButton.text=All + From d974369b629a894c33a15d20f655b55524c3078e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 1 Feb 2017 15:42:21 -0500 Subject: [PATCH 03/22] merged in remaining stashed changed --- .../autopsy/ingest/IngestTasksScheduler.java | 1 + .../ingest/RunIngestModulesAction.java | 24 ++++++- .../IngestProfileSelectionPanel.java | 61 ++++++++++++------ .../RunIngestModuleAction.java | 62 ------------------- .../RunIngestModuleWizardWizardIterator.java | 24 ++++--- .../RunIngestModuleWizardWizardPanel1.java | 4 +- .../RunIngestModuleWizardWizardPanel2.java | 4 +- .../netbeans/core/startup/Bundle.properties | 2 +- .../core/windows/view/ui/Bundle.properties | 2 +- 9 files changed, 89 insertions(+), 95 deletions(-) delete mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index f22ef93d94..f7c32930c0 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -32,6 +32,7 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.openide.util.Exceptions; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java index d071dda0b7..fca7bce492 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java @@ -21,12 +21,13 @@ package org.sleuthkit.autopsy.ingest; import java.awt.event.ActionEvent; import java.text.MessageFormat; import java.util.Collections; +import java.util.List; import javax.swing.AbstractAction; +import javax.swing.JOptionPane; import org.openide.DialogDisplayer; import org.openide.WizardDescriptor; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleWizardWizardIterator; import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.Image; /** * This class is used to add the action to the run ingest modules menu item. @@ -36,7 +37,7 @@ import org.sleuthkit.datamodel.Image; final class RunIngestModulesAction extends AbstractAction { Content dataSource; - + /** * the constructor */ @@ -55,7 +56,26 @@ final class RunIngestModulesAction extends AbstractAction { // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() wiz.setTitleFormat(new MessageFormat("{0}")); wiz.setTitle("Run Ingest Modules"); + System.out.println("GONNA GET EXECUTION CONTEXT "); if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { + //WJS-TODO figure out how to get the context / profile name out of the wizard after finish is selected. + String executionContext = (String)wiz.getProperty("executionContext"); //NON-NLS + System.out.println("EXECUTION CONTEXT " + executionContext); +// IngestJobSettings ingestJobSettings = new IngestJobSettings(executionContext); +// ingestJobSettings.save(); +// showWarnings(ingestJobSettings); +// IngestManager.getInstance().queueIngestJob(Collections.singletonList(dataSource), ingestJobSettings); + } + } + + private static void showWarnings(IngestJobSettings ingestJobSettings) { + List warnings = ingestJobSettings.getWarnings(); + if (warnings.isEmpty() == false) { + StringBuilder warningMessage = new StringBuilder(); + for (String warning : warnings) { + warningMessage.append(warning).append("\n"); + } + JOptionPane.showMessageDialog(null, warningMessage.toString()); } } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index dcc931a250..e7d4582e0f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -5,15 +5,24 @@ */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; +import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; +import org.sleuthkit.autopsy.ingest.IngestProfileMap; +import org.sleuthkit.autopsy.ingest.IngestProfileMap.IngestProfile; public final class IngestProfileSelectionPanel extends JPanel implements ItemListener { + private static final String CUSTOM_SETTINGS_TEXT = "Custom Settings - configure individual module settings"; RunIngestModuleWizardWizardPanel1 wizardPanel; + String selectedProfile; + List elements = Collections.emptyList(); /** * Creates new form runIngestModuleWizardVisualPanel1 @@ -22,14 +31,22 @@ public final class IngestProfileSelectionPanel extends JPanel implements ItemLis initComponents(); //WJS-TODO figure out how to get width of writable area, if text length greater than width. Trim text to width minus 3 chars in length and then add ... to the end wizardPanel = panel; - int[] tempIDs = getElements(); - customSettings = new JRadioButton("Custom Settings - configure individual module settings"); + elements = getElements(); + customSettings = new JRadioButton(CUSTOM_SETTINGS_TEXT, true); + customSettings.setName(RunIngestModuleWizardWizardIterator.getDefaultContext()); + customSettings.setRolloverEnabled(true); - customSettings.setToolTipText("configure individual module settings"); + customSettings.setToolTipText(CUSTOM_SETTINGS_TEXT); buttonGroup1.add(customSettings); jPanel1.add(customSettings); - for (int i = 0; i < tempIDs.length; i++) { - JRadioButton myRadio = new JRadioButton("Fiction Profile #" + i + " - This is a fictional profile for place holder text"); + + selectedProfile = customSettings.getName(); + String tempDescription = "REPLACE THIS WITH DESCRIPTION"; + + for (IngestProfile profile : elements) { + JRadioButton myRadio = new JRadioButton(profile.toString() + tempDescription); + myRadio.setName(profile.toString()); + myRadio.setToolTipText(tempDescription); myRadio.addItemListener(this); buttonGroup1.add(myRadio); jPanel1.add(myRadio); @@ -42,15 +59,9 @@ public final class IngestProfileSelectionPanel extends JPanel implements ItemLis return "Ingest Profile Selection"; } - int getNumOfElements() { - return 10; - } - - int[] getElements() { - int size = getNumOfElements(); - int[] elements = new int[size]; - for (int i = 5; i < 5 + size; i++) { - elements[i - 5] = i; + List getElements() { + if (elements.isEmpty()) { + fetchListContents(); } return elements; } @@ -107,7 +118,6 @@ public final class IngestProfileSelectionPanel extends JPanel implements ItemLis ); }// //GEN-END:initComponents - boolean hasNextPanel = true; private JRadioButton customSettings; // Variables declaration - do not modify//GEN-BEGIN:variables @@ -120,10 +130,25 @@ public final class IngestProfileSelectionPanel extends JPanel implements ItemLis @Override public void itemStateChanged(ItemEvent e) { + for (Component rButton : jPanel1.getComponents()) { + JRadioButton jrb = (JRadioButton) rButton; + if (jrb.isSelected()) { + selectedProfile = jrb.getName(); + break; + } + } + boolean hadNextPanel = hasNextPanel; - hasNextPanel= !hasNextPanel; - System.out.println("SWITCHED VALUES, VALUE NOW:"+ hasNextPanel); + hasNextPanel = !hasNextPanel; + System.out.println( + "SWITCHED VALUES, VALUE NOW:" + hasNextPanel); wizardPanel.fireChangeEvent(); - this.firePropertyChange("LAST_ENABLED", hadNextPanel, hasNextPanel); + this.firePropertyChange( + "LAST_ENABLED", hadNextPanel, hasNextPanel); + } + + private void fetchListContents() { + elements = new ArrayList(); + elements.addAll(new IngestProfileMap().getIngestProfileMap().values()); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java deleted file mode 100644 index 9231485d9f..0000000000 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.text.MessageFormat; -import org.openide.DialogDisplayer; -import org.openide.WizardDescriptor; -import org.openide.awt.ActionID; -import org.openide.awt.ActionReference; -import org.openide.awt.ActionRegistration; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle.Messages; -import org.openide.util.actions.CallableSystemAction; -import org.openide.util.actions.Presenter; -import org.openide.util.lookup.ServiceProvider; - - - - - - @ActionID(category = "Tools", id = "org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleAction") -@ActionRegistration( - displayName = "#CTL_RunIngestModulesAction", lazy = false) -@ActionReference(path = "Toolbars/Tools", position = 200) - @ServiceProvider(service = RunIngestModuleAction.class) -@Messages("CTL_RunIngestModulesAction=Run Ingest Modules Wizard") -public final class RunIngestModuleAction extends CallableSystemAction implements Presenter.Toolbar { - public static ActionListener run() { - return new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - WizardDescriptor wiz = new WizardDescriptor(new RunIngestModuleWizardWizardIterator()); - // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() - // {1} will be replaced by WizardDescriptor.Iterator.name() - wiz.setTitleFormat(new MessageFormat("{0} ({1})")); - wiz.setTitle("...dialog title..."); - if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { - } - } - }; - } - - @Override - public void performAction() { - - } - - @Override - public String getName() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public HelpCtx getHelpCtx() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } -} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java index d68f283d65..333d0ddc66 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java @@ -17,19 +17,27 @@ import org.sleuthkit.autopsy.ingest.IngestProfileMap; public final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iterator { + private final static String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleAction"; + private int index; private List panels; - + /** + * @return the DEFAULT_CONTEXT + */ + static String getDefaultContext() { + return DEFAULT_CONTEXT; + } + private List getPanels() { if (panels == null) { - panels = new ArrayList(); - TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); - if (!profileMap.isEmpty()) { - panels.add(new RunIngestModuleWizardWizardPanel1()); - } - + panels = new ArrayList<>(); + TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); + if (!profileMap.isEmpty()) { + panels.add(new RunIngestModuleWizardWizardPanel1()); + } + panels.add(new RunIngestModuleWizardWizardPanel2()); String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { @@ -56,7 +64,7 @@ public final class RunIngestModuleWizardWizardIterator implements WizardDescript @Override public String name() { - return ""; + return index + 1 + ". from " + getPanels().size(); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java index 9fe809eac5..0eb9534fa5 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java @@ -65,6 +65,7 @@ public class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPan for (ChangeListener l : ls) { l.stateChanged(ev); } + } @Override @@ -88,7 +89,8 @@ public class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPan @Override public void storeSettings(WizardDescriptor wiz) { - // use wiz.putProperty to remember current panel state + System.out.println("STORING EXECUTION CONTEXT" + component.selectedProfile); + wiz.putProperty("executionContext", component.selectedProfile); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java index 82fe45ca13..65618d63db 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java @@ -26,11 +26,11 @@ public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPan @Override public IngestJobSettingsPanel getComponent() { if (ingestJobSettingsPanel == null) { - ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings("org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleAction")); + ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModuleWizardWizardIterator.getDefaultContext())); } return ingestJobSettingsPanel; } - + @Override public HelpCtx getHelp() { // Show no Help button for this panel: diff --git a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties index 8eb490c76e..2588954fb9 100644 --- a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties +++ b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties @@ -1,5 +1,5 @@ #Updated by build script -#Mon, 02 Jan 2017 18:41:13 -0500 +#Mon, 30 Jan 2017 13:39:12 -0500 LBL_splash_window_title=Starting Autopsy SPLASH_HEIGHT=314 SPLASH_WIDTH=538 diff --git a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties index 756018bd64..0fe774eeab 100644 --- a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties +++ b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties @@ -1,4 +1,4 @@ #Updated by build script -#Mon, 02 Jan 2017 18:41:13 -0500 +#Mon, 30 Jan 2017 13:39:12 -0500 CTL_MainWindow_Title=Autopsy 4.3.0 CTL_MainWindow_Title_No_Project=Autopsy 4.3.0 From 04dabbe23b1b4fb1ce2b666188881a550845c486 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 1 Feb 2017 17:18:24 -0500 Subject: [PATCH 04/22] 2198 - Loads and uses profile currently --- .../autopsy/ingest/RunIngestModulesAction.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java index fca7bce492..f781a5169b 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java @@ -56,15 +56,12 @@ final class RunIngestModulesAction extends AbstractAction { // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() wiz.setTitleFormat(new MessageFormat("{0}")); wiz.setTitle("Run Ingest Modules"); - System.out.println("GONNA GET EXECUTION CONTEXT "); if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { - //WJS-TODO figure out how to get the context / profile name out of the wizard after finish is selected. String executionContext = (String)wiz.getProperty("executionContext"); //NON-NLS - System.out.println("EXECUTION CONTEXT " + executionContext); -// IngestJobSettings ingestJobSettings = new IngestJobSettings(executionContext); -// ingestJobSettings.save(); -// showWarnings(ingestJobSettings); -// IngestManager.getInstance().queueIngestJob(Collections.singletonList(dataSource), ingestJobSettings); + IngestJobSettings ingestJobSettings = new IngestJobSettings(executionContext); + ingestJobSettings.save(); + showWarnings(ingestJobSettings); + IngestManager.getInstance().queueIngestJob(Collections.singletonList(dataSource), ingestJobSettings); } } From 130050646e18182a920cd643e297a825ec250b9e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 2 Feb 2017 11:38:27 -0500 Subject: [PATCH 05/22] 2198-RunIngestModulesAction now used in place of RunIngestModulesDialog --- .../autopsy/datamodel/ImageNode.java | 16 ++------ .../datamodel/VirtualDirectoryNode.java | 13 +----- .../DirectoryTreeFilterNode.java | 23 ++--------- .../ingest/RunIngestModulesAction.java | 40 ++++++++++++++----- .../autopsy/ingest/RunIngestSubMenu.java | 5 +-- .../RunIngestModuleWizardWizardIterator.java | 4 +- .../RunIngestModuleWizardWizardPanel2.java | 18 +++++---- 7 files changed, 52 insertions(+), 67 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java index 8b2f3b9ae7..3e710c9c1e 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.datamodel; -import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.sql.ResultSet; @@ -27,7 +26,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; -import javax.swing.AbstractAction; import javax.swing.Action; import org.openide.nodes.Children; import org.openide.nodes.Sheet; @@ -40,7 +38,7 @@ import org.sleuthkit.autopsy.directorytree.FileSearchAction; import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ModuleContentEvent; -import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog; +import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery; @@ -101,22 +99,14 @@ public class ImageNode extends AbstractContentNode { "ImageNode.getActions.openFileSearchByAttr.text=Open File Search by Attributes",}) public Action[] getActions(boolean context) { - List actionsList = new ArrayList(); + List actionsList = new ArrayList<>(); for (Action a : super.getActions(true)) { actionsList.add(a); } actionsList.addAll(ExplorerNodeActionVisitor.getActions(content)); actionsList.add(new FileSearchAction( Bundle.ImageNode_getActions_openFileSearchByAttr_text())); - actionsList.add(new AbstractAction( - Bundle.ImageNode_action_runIngestMods_text()) { - @Override - public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(content)); - ingestDialog.display(); - } - }); - + actionsList.add(new RunIngestModulesAction(Collections.singletonList(content))); actionsList.add(new NewWindowViewAction( NbBundle.getMessage(this.getClass(), "ImageNode.getActions.viewInNewWin.text"), this)); return actionsList.toArray(new Action[0]); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java index 246c6d6e1d..1660e75eff 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.datamodel; -import java.awt.event.ActionEvent; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; @@ -27,7 +26,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.logging.Level; -import javax.swing.AbstractAction; import javax.swing.Action; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; @@ -38,7 +36,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.directorytree.ExtractAction; import org.sleuthkit.autopsy.directorytree.FileSearchAction; import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; -import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog; +import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; @@ -100,14 +98,7 @@ public class VirtualDirectoryNode extends AbstractAbstractFileNodesingletonList(content)); - ingestDialog.display(); - } - }); + actions.add(new RunIngestModulesAction(Collections.singletonList(content))); actions.addAll(ContextMenuExtensionPoint.getActions()); return actions.toArray(new Action[0]); } diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 0ae016bd00..6b5b774d07 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -18,12 +18,9 @@ */ package org.sleuthkit.autopsy.directorytree; -import java.awt.event.ActionEvent; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.logging.Level; -import javax.swing.AbstractAction; import javax.swing.Action; import org.openide.nodes.FilterNode; import org.openide.nodes.Node; @@ -33,7 +30,7 @@ import org.openide.util.lookup.ProxyLookup; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.AbstractContentNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; -import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog; +import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Directory; @@ -108,14 +105,7 @@ class DirectoryTreeFilterNode extends FilterNode { Directory dir = this.getLookup().lookup(Directory.class); if (dir != null) { actions.add(ExtractAction.getInstance()); - actions.add(new AbstractAction( - NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { - @Override - public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(dir); - ingestDialog.display(); - } - }); + actions.add(new RunIngestModulesAction(dir)); } final Image img = this.getLookup().lookup(Image.class); @@ -138,14 +128,7 @@ class DirectoryTreeFilterNode extends FilterNode { if (img != null || isRootVD) { actions.add(new FileSearchAction( NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text"))); - actions.add(new AbstractAction( - NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { - @Override - public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(content)); - ingestDialog.display(); - } - }); + actions.add(new RunIngestModulesAction(dir)); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java index f781a5169b..a39750bf2d 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java @@ -20,31 +20,49 @@ package org.sleuthkit.autopsy.ingest; import java.awt.event.ActionEvent; import java.text.MessageFormat; -import java.util.Collections; +import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; +import javax.swing.Action; import javax.swing.JOptionPane; import org.openide.DialogDisplayer; import org.openide.WizardDescriptor; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleWizardWizardIterator; import org.sleuthkit.datamodel.Content; +import org.sleuthkit.datamodel.Directory; /** * This class is used to add the action to the run ingest modules menu item. * When the data source is pressed, it should open the wizard for ingest * modules. */ -final class RunIngestModulesAction extends AbstractAction { +public final class RunIngestModulesAction extends AbstractAction { - Content dataSource; + @Messages("RunIngestModulesAction.name=Run Ingest Modules") + + private final List dataSources = new ArrayList<>(); + private final IngestJobSettings.IngestType ingestType; /** * the constructor + * @param dataSources */ - public RunIngestModulesAction(Content dataSource) { - this.dataSource = dataSource; + public RunIngestModulesAction(List dataSources) { + this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name()); + this.dataSources.addAll(dataSources); + this.ingestType = IngestJobSettings.IngestType.ALL_MODULES; + } + + /** + * the constructor + * @param dir + */ + public RunIngestModulesAction(Directory dir) { + this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name()); + this.dataSources.add(dir); + this.ingestType = IngestJobSettings.IngestType.FILES_ONLY; } - /** * Runs the ingest modules wizard on the data source. * @@ -55,13 +73,13 @@ final class RunIngestModulesAction extends AbstractAction { WizardDescriptor wiz = new WizardDescriptor(new RunIngestModuleWizardWizardIterator()); // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() wiz.setTitleFormat(new MessageFormat("{0}")); - wiz.setTitle("Run Ingest Modules"); + wiz.setTitle(Bundle.RunIngestModulesAction_name()); + if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { - String executionContext = (String)wiz.getProperty("executionContext"); //NON-NLS - IngestJobSettings ingestJobSettings = new IngestJobSettings(executionContext); - ingestJobSettings.save(); + String executionContext = (String)wiz.getProperty("executionContext"); //NON-NLS + IngestJobSettings ingestJobSettings = new IngestJobSettings(executionContext, this.ingestType); showWarnings(ingestJobSettings); - IngestManager.getInstance().queueIngestJob(Collections.singletonList(dataSource), ingestJobSettings); + IngestManager.getInstance().queueIngestJob(this.dataSources, ingestJobSettings); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java index 8c2892c558..8c9b61a646 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java @@ -19,6 +19,7 @@ package org.sleuthkit.autopsy.ingest; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.swing.JComponent; import javax.swing.JMenuItem; @@ -26,8 +27,6 @@ import org.openide.awt.DynamicMenuContent; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.Image; -import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; /** @@ -61,7 +60,7 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { String action = dataSources.get(i).getName(); JMenuItem menuItem = new JMenuItem(action); menuItem.setActionCommand(action.toUpperCase()); - menuItem.addActionListener(new RunIngestModulesAction(dataSources.get(i))); + menuItem.addActionListener(new RunIngestModulesAction(Collections.singletonList(dataSources.get(i)))); comps[i] = menuItem; } // If no dataSources are open, create a disabled empty menu diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java index 333d0ddc66..ab87eccb51 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java @@ -17,7 +17,7 @@ import org.sleuthkit.autopsy.ingest.IngestProfileMap; public final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iterator { - private final static String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleAction"; + private final static String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; private int index; @@ -26,7 +26,7 @@ public final class RunIngestModuleWizardWizardIterator implements WizardDescript /** * @return the DEFAULT_CONTEXT */ - static String getDefaultContext() { + public static String getDefaultContext() { return DEFAULT_CONTEXT; } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java index 65618d63db..f9da9f52c5 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java @@ -11,11 +11,13 @@ import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; -public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPanel { +public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPanel { - /**f - The visual ingestJobSettingsPanel that displays this panel. If you need to access the - ingestJobSettingsPanel from this class, just use getComponent(). + /** + * f + * The visual ingestJobSettingsPanel that displays this panel. If you need + * to access the ingestJobSettingsPanel from this class, just use + * getComponent(). */ private IngestJobSettingsPanel ingestJobSettingsPanel; @@ -30,7 +32,7 @@ public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPan } return ingestJobSettingsPanel; } - + @Override public HelpCtx getHelp() { // Show no Help button for this panel: @@ -48,7 +50,7 @@ public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPan // use ChangeSupport to implement add/removeChangeListener below. // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful. } - + @Override public void addChangeListener(ChangeListener l) { } @@ -64,7 +66,9 @@ public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPan @Override public void storeSettings(WizardDescriptor wiz) { - // use wiz.putProperty to remember current panel state + IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); + ingestJobSettings.save(); + wiz.putProperty("executionContext", RunIngestModuleWizardWizardIterator.getDefaultContext()); //NON-NLS } } From b3d3d63ae73204bcbe8a08181257acc24045419c Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 2 Feb 2017 12:22:13 -0500 Subject: [PATCH 06/22] 2198 Removed now obsolete RunIngestModulesDialog class --- .../autopsy/ingest/Bundle.properties | 1 - .../autopsy/ingest/Bundle_ja.properties | 2 +- .../ingest/IngestProgressSnapshotDialog.java | 2 +- .../ingest/RunIngestModulesDialog.java | 241 ------------------ .../AddFileTypeSignatureDialog.java | 4 +- 5 files changed, 4 insertions(+), 246 deletions(-) delete mode 100644 Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties index 333d179c74..889f53d152 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties @@ -23,7 +23,6 @@ IngestJob.progress.fileIngest.displayName=Analyzing files from {0} IngestJob.progress.fileIngest.cancelMessage=Waiting for {0} on {1} IngestJob.progress.cancelling={0} (Cancelling...) IngestJob.cancellationDialog.title=Cancel Ingest -IngestDialog.title.text=Run Ingest Modules IngestDialog.startButton.title=Start IngestDialog.closeButton.title=Close IngestManager.moduleErr=Module Error diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties index 7f83c8c5c0..fa49df5cde 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties @@ -2,7 +2,7 @@ CTL_IngestMessageTopComponent=\u30e1\u30c3\u30bb\u30fc\u30b8 HINT_IngestMessageTopComponent=\u30e1\u30c3\u30bb\u30fc\u30b8\u30a6\u30a3\u30f3\u30c9\u30a6 IngestDialog.closeButton.title=\u9589\u3058\u308b IngestDialog.startButton.title=\u958b\u59cb -IngestDialog.title.text=\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8 +RunIngestModulesAction.name=\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8 IngestJob.progress.cancelling={0}\uff08\u30ad\u30e3\u30f3\u30bb\u30eb\u4e2d\u2026\uff09 IngestJob.progress.dataSourceIngest.displayName={1}\u306e{0} IngestJob.progress.fileIngest.displayName={0}\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u89e3\u6790\u4e2d diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java index deb9d14ede..3323240a88 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java @@ -38,7 +38,7 @@ import org.openide.windows.WindowManager; */ public final class IngestProgressSnapshotDialog extends JDialog { - private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestProgressSnapshotDialog.title.text"); + private static final String TITLE = NbBundle.getMessage(IngestProgressSnapshotDialog.class, "IngestProgressSnapshotDialog.title.text"); private static final Dimension DIMENSIONS = new Dimension(500, 300); /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java deleted file mode 100644 index 67f5f41c98..0000000000 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesDialog.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2016 Basis Technology Corp. - * Contact: carrier sleuthkit org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.ingest; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.ArrayList; -import java.util.List; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import org.openide.util.NbBundle; -import org.openide.windows.WindowManager; -import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType; -import org.sleuthkit.datamodel.Content; -import org.sleuthkit.datamodel.Directory; - -/** - * - * A dialog box that allows a user to configure and execute analysis of one or - * more data sources with ingest modules or analysis of the contents of a - * directory with file-level ingest modules. - */ -public final class RunIngestModulesDialog extends JDialog { - - private static final long serialVersionUID = 1L; - private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestDialog.title.text"); - private final IngestType ingestType; - private final List dataSources = new ArrayList<>(); - private IngestJobSettingsPanel ingestJobSettingsPanel; - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of one or more data sources with ingest modules. - * - * @param frame The dialog parent window. - * @param title The title for the dialog. - * @param modal True if the dialog should be modal, false otherwise. - * @param dataSources The data sources to be analyzed. - */ - public RunIngestModulesDialog(JFrame frame, String title, boolean modal, List dataSources) { - super(frame, title, modal); - this.dataSources.addAll(dataSources); - this.ingestType = IngestType.ALL_MODULES; - } - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of one or more data sources with ingest modules. - * - * @param dataSources The data sources to be processed. - */ - public RunIngestModulesDialog(List dataSources) { - this((JFrame) WindowManager.getDefault().getMainWindow(), TITLE, true, dataSources); - } - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of the contents of a directory with file-level ingest modules. - * - * @param dir - */ - public RunIngestModulesDialog(Directory dir) { - this.dataSources.add(dir); - this.ingestType = IngestType.FILES_ONLY; - } - - /** - * Displays this dialog. - */ - public void display() { - setLayout(new BorderLayout()); - - /** - * Center the dialog. - */ - Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize(); - - /** - * Get the default or saved ingest job settings for this context and use - * them to create and add an ingest job settings panel. - */ - IngestJobSettings ingestJobSettings = new IngestJobSettings(RunIngestModulesDialog.class.getCanonicalName(), this.ingestType); - RunIngestModulesDialog.showWarnings(ingestJobSettings); - this.ingestJobSettingsPanel = new IngestJobSettingsPanel(ingestJobSettings, dataSources); - setPreferredSize(this.ingestJobSettingsPanel.getPreferredSize()); - add(this.ingestJobSettingsPanel, BorderLayout.CENTER); - - // Add a start ingest button. - JButton startButton = new JButton(NbBundle.getMessage(this.getClass(), "IngestDialog.startButton.title")); - startButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - doButtonAction(true); - } - }); - - // Add a close button. - JButton closeButton = new JButton(NbBundle.getMessage(this.getClass(), "IngestDialog.closeButton.title")); - closeButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - doButtonAction(false); - } - }); - - // Put the buttons in their own panel, under the settings panel. - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout(FlowLayout.TRAILING)); - buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); - buttonPanel.add(startButton); - buttonPanel.add(new javax.swing.Box.Filler(new Dimension(5, 10), new Dimension(5, 10), new Dimension(5, 10))); - buttonPanel.add(closeButton); - - add(buttonPanel, BorderLayout.SOUTH); - - /** - * Add a handler for when the dialog window is closed directly, - * bypassing the buttons. - */ - this.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - doButtonAction(false); - } - }); - - /** - * Show the dialog. - */ - int width = this.getPreferredSize().width; - int height = this.getPreferredSize().height; - setLocation((screenDimension.width - width) / 2, (screenDimension.height - height) / 2); - pack(); - setVisible(true); - } - - /** - * Closes this dialog. - */ - @Deprecated - public void close() { - setVisible(false); - dispose(); - } - - /** - * Saves the ingest job settings, optionally starts an ingest job for each - * data source, then closes the dialog - * - * @param startIngestJob True if ingest job(s) should be started, false - * otherwise. - */ - private void doButtonAction(boolean startIngestJob) { - IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); - ingestJobSettings.save(); - showWarnings(ingestJobSettings); - if (startIngestJob) { - IngestManager.getInstance().queueIngestJob(RunIngestModulesDialog.this.dataSources, ingestJobSettings); - } - setVisible(false); - dispose(); - } - - private static void showWarnings(IngestJobSettings ingestJobSettings) { - List warnings = ingestJobSettings.getWarnings(); - if (warnings.isEmpty() == false) { - StringBuilder warningMessage = new StringBuilder(); - for (String warning : warnings) { - warningMessage.append(warning).append("\n"); - } - JOptionPane.showMessageDialog(null, warningMessage.toString()); - } - } - - /** - * Constructs a dialog box that allows a user to configure and execute - * analysis of one or more data sources with ingest modules. - * - * @param frame The dialog parent window. - * @param title The title for the dialog. - * @param modal True if the dialog should be modal, false otherwise. - * - * @deprecated - */ - @Deprecated - public RunIngestModulesDialog(JFrame frame, String title, boolean modal) { - super(frame, title, modal); - this.ingestType = IngestType.ALL_MODULES; - } - - /** - * Constructs a dialog box that allows a user to configure and run an ingest - * job on one or more data sources. - * - * @deprecated - */ - @Deprecated - public RunIngestModulesDialog() { - this(new JFrame(TITLE), TITLE, true); - } - - /** - * Sets the data sources to be processed. - * - * @param dataSources The data sources. - * - * @deprecated - */ - @Deprecated - public void setDataSources(List dataSources) { - this.dataSources.clear(); - this.dataSources.addAll(dataSources); - } - -} diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java index 3365d33eb3..ce92176308 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java @@ -32,7 +32,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; -import org.sleuthkit.autopsy.ingest.RunIngestModulesDialog; +import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; import org.sleuthkit.autopsy.modules.filetypeid.FileType.Signature; /** @@ -43,7 +43,7 @@ final class AddFileTypeSignatureDialog extends JDialog { private static final long serialVersionUID = 1L; private final AddFileTypeSignaturePanel addFileTypeSigPanel; - private static final String TITLE = NbBundle.getMessage(RunIngestModulesDialog.class, "IngestDialog.title.text"); + private static final String TITLE = NbBundle.getMessage(RunIngestModulesAction.class, "RunIngestModulesAction.name"); private Signature signature; private BUTTON_PRESSED result; From 6fbe9202ff509bdd5c68ca85e81470d8f263e5ed Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 2 Feb 2017 13:07:46 -0500 Subject: [PATCH 07/22] 2198 - moved RunIngestModulesAction to a non exposed package so it can be public --- Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java | 2 +- .../sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java | 2 +- .../autopsy/directorytree/DirectoryTreeFilterNode.java | 2 +- Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties | 1 - .../src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java | 1 + .../ingest/runIngestModuleWizard/Bundle_ja.properties | 1 + .../RunIngestModuleWizardWizardIterator.java | 4 ++-- .../RunIngestModulesAction.java | 7 ++++--- .../runIngestModuleWizard/ShortCircuitableWizardPanel.java | 5 ++--- .../modules/filetypeid/AddFileTypeSignatureDialog.java | 4 ++-- 10 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle_ja.properties rename Core/src/org/sleuthkit/autopsy/ingest/{ => runIngestModuleWizard}/RunIngestModulesAction.java (94%) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java index 3e710c9c1e..5a4f99dae0 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java @@ -38,7 +38,7 @@ import org.sleuthkit.autopsy.directorytree.FileSearchAction; import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.ModuleContentEvent; -import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.SleuthkitCase.CaseDbQuery; diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java index 1660e75eff..2dcb6fce3d 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java @@ -36,7 +36,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.directorytree.ExtractAction; import org.sleuthkit.autopsy.directorytree.FileSearchAction; import org.sleuthkit.autopsy.directorytree.NewWindowViewAction; -import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 6b5b774d07..257e81f378 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -30,7 +30,7 @@ import org.openide.util.lookup.ProxyLookup; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.AbstractContentNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; -import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Directory; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties index fa49df5cde..f7af8964cc 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties @@ -2,7 +2,6 @@ CTL_IngestMessageTopComponent=\u30e1\u30c3\u30bb\u30fc\u30b8 HINT_IngestMessageTopComponent=\u30e1\u30c3\u30bb\u30fc\u30b8\u30a6\u30a3\u30f3\u30c9\u30a6 IngestDialog.closeButton.title=\u9589\u3058\u308b IngestDialog.startButton.title=\u958b\u59cb -RunIngestModulesAction.name=\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8 IngestJob.progress.cancelling={0}\uff08\u30ad\u30e3\u30f3\u30bb\u30eb\u4e2d\u2026\uff09 IngestJob.progress.dataSourceIngest.displayName={1}\u306e{0} IngestJob.progress.fileIngest.displayName={0}\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u89e3\u6790\u4e2d diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java index 8c9b61a646..a8fabc1f31 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.ingest; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import java.util.ArrayList; import java.util.Collections; import java.util.List; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle_ja.properties new file mode 100644 index 0000000000..39d7a2632b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle_ja.properties @@ -0,0 +1 @@ +RunIngestModulesAction.name=\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8 \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java index ab87eccb51..d2b4ba97b1 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java @@ -15,7 +15,7 @@ import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.sleuthkit.autopsy.ingest.IngestProfileMap; -public final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iterator { +final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iterator { private final static String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; @@ -26,7 +26,7 @@ public final class RunIngestModuleWizardWizardIterator implements WizardDescript /** * @return the DEFAULT_CONTEXT */ - public static String getDefaultContext() { + static String getDefaultContext() { return DEFAULT_CONTEXT; } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java similarity index 94% rename from Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index a39750bf2d..d2939797e9 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2015 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.ingest; +package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; import java.awt.event.ActionEvent; import java.text.MessageFormat; @@ -28,7 +28,8 @@ import javax.swing.JOptionPane; import org.openide.DialogDisplayer; import org.openide.WizardDescriptor; import org.openide.util.NbBundle.Messages; -import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModuleWizardWizardIterator; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; +import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Directory; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java index 9a5ca8656c..8fb5dcddb4 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java @@ -8,11 +8,10 @@ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; import org.openide.WizardDescriptor; /** - * + * Abstract class for exten * */ - -public abstract class ShortCircuitableWizardPanel implements WizardDescriptor.Panel { +abstract class ShortCircuitableWizardPanel implements WizardDescriptor.Panel { boolean shouldCheckForNext(){ return true; diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java index ce92176308..d5cade3571 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,7 +32,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; -import org.sleuthkit.autopsy.ingest.RunIngestModulesAction; +import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction; import org.sleuthkit.autopsy.modules.filetypeid.FileType.Signature; /** From 998a0399bc1d42ba5235b6686db69593aa1ef1b0 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 2 Feb 2017 18:24:03 -0500 Subject: [PATCH 08/22] 2198 Last profile used now saved, profile descriptions now visible --- .../autopsy/ingest/IngestOptionsPanel.java | 4 +- .../autopsy/ingest/IngestProfileMap.java | 2 +- ... => EarlyFinishWizardDescriptorPanel.java} | 0 .../IngestProfileSelectionPanel.form | 11 ++ .../IngestProfileSelectionPanel.java | 137 +++++++++++++----- .../RunIngestModuleWizardWizardPanel1.java | 21 ++- .../RunIngestModuleWizardWizardPanel2.java | 2 +- 7 files changed, 131 insertions(+), 46 deletions(-) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{ShortCircuitableWizardPanel.java => EarlyFinishWizardDescriptorPanel.java} (100%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java index 7d6964022d..d2a3001259 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestOptionsPanel.java @@ -29,7 +29,7 @@ import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TY /** * Global options panel for keyword searching. */ -class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { +public class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { @NbBundle.Messages({"IngestOptionsPanel.settingsTab.text=Settings", "IngestOptionsPanel.settingsTab.toolTipText=Settings regarding resources available to ingest.", @@ -50,7 +50,7 @@ class IngestOptionsPanel extends IngestModuleGlobalSettingsPanel implements Opti */ IngestJobEventPropertyChangeListener ingestJobEventsListener; - IngestOptionsPanel() { + public IngestOptionsPanel() { initComponents(); customizeComponents(); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java index e533ce3fe4..5189619c3e 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfileMap.java @@ -138,7 +138,7 @@ public class IngestProfileMap { * * @return the description */ - String getDescription() { + public String getDescription() { return description; } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java similarity index 100% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/ShortCircuitableWizardPanel.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form index 07f136df0f..7f5b676190 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form @@ -8,6 +8,14 @@ + + + + + + + + @@ -60,6 +68,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index e7d4582e0f..059539e100 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -1,11 +1,25 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; import java.awt.Component; +import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; @@ -14,58 +28,84 @@ import java.util.List; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; +import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; +import org.sleuthkit.autopsy.ingest.IngestOptionsPanel; import org.sleuthkit.autopsy.ingest.IngestProfileMap; import org.sleuthkit.autopsy.ingest.IngestProfileMap.IngestProfile; -public final class IngestProfileSelectionPanel extends JPanel implements ItemListener { +final class IngestProfileSelectionPanel extends JPanel implements ItemListener { - private static final String CUSTOM_SETTINGS_TEXT = "Custom Settings - configure individual module settings"; - RunIngestModuleWizardWizardPanel1 wizardPanel; - String selectedProfile; - List elements = Collections.emptyList(); + private static final String CUSTOM_SETTINGS_DISPLAY_NAME = "Custom Settings"; + private static final String CUSTOM_SETTINGS_DESCRIPTION = "configure individual module settings in next step of wizard"; //WJS-TODO these should be @Message + private final RunIngestModuleWizardWizardPanel1 wizardPanel; + private String selectedProfile; + private List elements = Collections.emptyList(); /** * Creates new form runIngestModuleWizardVisualPanel1 */ - public IngestProfileSelectionPanel(RunIngestModuleWizardWizardPanel1 panel) { + IngestProfileSelectionPanel(RunIngestModuleWizardWizardPanel1 panel, String lastSelectedProfile) { initComponents(); //WJS-TODO figure out how to get width of writable area, if text length greater than width. Trim text to width minus 3 chars in length and then add ... to the end wizardPanel = panel; + selectedProfile = lastSelectedProfile; + populateListOfCheckboxes(); + + } + + String getLastSelectedProfile() { + return selectedProfile; + } + + private void populateListOfCheckboxes() { elements = getElements(); - customSettings = new JRadioButton(CUSTOM_SETTINGS_TEXT, true); - customSettings.setName(RunIngestModuleWizardWizardIterator.getDefaultContext()); - - customSettings.setRolloverEnabled(true); - customSettings.setToolTipText(CUSTOM_SETTINGS_TEXT); - buttonGroup1.add(customSettings); - jPanel1.add(customSettings); - - selectedProfile = customSettings.getName(); - String tempDescription = "REPLACE THIS WITH DESCRIPTION"; - + addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModuleWizardWizardIterator.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); for (IngestProfile profile : elements) { - JRadioButton myRadio = new JRadioButton(profile.toString() + tempDescription); - myRadio.setName(profile.toString()); - myRadio.setToolTipText(tempDescription); - myRadio.addItemListener(this); - buttonGroup1.add(myRadio); - jPanel1.add(myRadio); + addRadioButton(profile.toString(), profile.toString(), profile.getDescription()); } + } + + private void addRadioButton(String profileDisplayName, String profileContextName, String profileDesc) { + String displayText = profileDisplayName + " - " + profileDesc; + int width = jScrollPane1.getWidth(); + if (width > 3) { + if (displayText.length() > width) { + String ellipses = "..."; + displayText = displayText.substring(0, width - ellipses.length()) + ellipses; + } + } else { + System.out.println("NOT KNOWN BEFORE DRAWN USE DIFFERENT WAY TO GET WIDTH"); //WJS-TODO remove this when working + } + JRadioButton myRadio = new JRadioButton(displayText); //NON-NLS + myRadio.setName(profileContextName); + myRadio.setToolTipText(profileDesc); + myRadio.addItemListener(this); + if (profileContextName.equals(selectedProfile)) { + myRadio.setSelected(true); + } + + buttonGroup1.add(myRadio); + jPanel1.add(myRadio); } @Override public String getName() { - return "Ingest Profile Selection"; + return "Ingest Profile Selection"; //WJS-TODO @Messages this } - List getElements() { + private List getElements() { if (elements.isEmpty()) { fetchListContents(); } return elements; } + private void clearListOfCheckBoxes() { + buttonGroup1 = new javax.swing.ButtonGroup(); + jPanel1.removeAll(); + } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -80,7 +120,15 @@ public final class IngestProfileSelectionPanel extends JPanel implements ItemLis jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); + setMaximumSize(new java.awt.Dimension(5750, 3000)); + setPreferredSize(new java.awt.Dimension(625, 450)); + org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.jButton1.text")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); @@ -118,8 +166,25 @@ public final class IngestProfileSelectionPanel extends JPanel implements ItemLis ); }// //GEN-END:initComponents + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); + IngestOptionsPanel ingestOptions = new IngestOptionsPanel(); + ingestOptions.load(); + dialog.addApplyButtonListener( + (ActionEvent e) -> { + ingestOptions.store(); + clearListOfCheckBoxes(); + fetchListContents(); + jPanel1.revalidate(); + jPanel1.repaint(); + populateListOfCheckboxes(); + dialog.close(); + } + ); + dialog.display(ingestOptions); + }//GEN-LAST:event_jButton1ActionPerformed + boolean hasNextPanel = true; - private JRadioButton customSettings; // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton jButton1; @@ -137,18 +202,18 @@ public final class IngestProfileSelectionPanel extends JPanel implements ItemLis break; } } - boolean hadNextPanel = hasNextPanel; - hasNextPanel = !hasNextPanel; - System.out.println( - "SWITCHED VALUES, VALUE NOW:" + hasNextPanel); + if (selectedProfile.equals(RunIngestModuleWizardWizardIterator.getDefaultContext())) { + hasNextPanel = true; + } else { + hasNextPanel = false; + } wizardPanel.fireChangeEvent(); - this.firePropertyChange( - "LAST_ENABLED", hadNextPanel, hasNextPanel); + this.firePropertyChange("LAST_ENABLED", hadNextPanel, hasNextPanel); //NON-NLS } private void fetchListContents() { - elements = new ArrayList(); + elements = new ArrayList<>(); elements.addAll(new IngestProfileMap().getIngestProfileMap().values()); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java index 0eb9534fa5..28ebf04951 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java @@ -11,15 +11,19 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; +import org.sleuthkit.autopsy.coreutils.ModuleSettings; -public class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPanel { +class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPanel { private final Set listeners = new HashSet(1); + private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS + private final static String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS /** * The visual component that displays this panel. If you need to access the * component from this class, just use getComponent(). */ private IngestProfileSelectionPanel component; + private String lastProfileUsed; // Get the visual component for the panel. In this template, the component // is kept separate. This can be more efficient: if the wizard is created @@ -28,7 +32,13 @@ public class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPan @Override public IngestProfileSelectionPanel getComponent() { if (component == null) { - component = new IngestProfileSelectionPanel(this); + if (ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME) == null + || ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME).isEmpty()) { + lastProfileUsed = RunIngestModuleWizardWizardIterator.getDefaultContext(); + } else { + lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); + } + component = new IngestProfileSelectionPanel(this, lastProfileUsed); } return component; } @@ -65,7 +75,6 @@ public class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPan for (ChangeListener l : ls) { l.stateChanged(ev); } - } @Override @@ -84,13 +93,13 @@ public class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPan @Override public void readSettings(WizardDescriptor wiz) { - // use wiz.getProperty to retrieve previous panel state } @Override public void storeSettings(WizardDescriptor wiz) { - System.out.println("STORING EXECUTION CONTEXT" + component.selectedProfile); - wiz.putProperty("executionContext", component.selectedProfile); //NON-NLS + lastProfileUsed = component.getLastSelectedProfile(); + wiz.putProperty("executionContext", lastProfileUsed); //NON-NLS + ModuleSettings.setConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME, lastProfileUsed); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java index f9da9f52c5..563723d2f6 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java @@ -11,7 +11,7 @@ import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; -public class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPanel { +class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPanel { /** * f From a1f8fd61307469bd5be454ac1678b890195243f4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 2 Feb 2017 18:24:48 -0500 Subject: [PATCH 09/22] 2198 renames, comments, and general clean up of RunIngestModulesWizard --- .../runIngestModuleWizard/Bundle.properties | 4 +- .../EarlyFinishWizardDescriptorPanel.java | 39 ++++- .../IngestProfileSelectionPanel.form | 30 ++-- .../IngestProfileSelectionPanel.java | 157 +++++++++++------- .../RunIngestModuleWizardWizardIterator.java | 27 ++- .../RunIngestModuleWizardWizardPanel1.java | 27 ++- .../RunIngestModuleWizardWizardPanel2.java | 21 ++- 7 files changed, 204 insertions(+), 101 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties index 66a07f4bad..6171140190 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/Bundle.properties @@ -1,2 +1,2 @@ -IngestProfileSelectionPanel.jButton1.text=Ingest Settings -IngestProfileSelectionPanel.jLabel1.text=Select Profile: +IngestProfileSelectionPanel.ingestSettingsButton.text=Ingest Settings +IngestProfileSelectionPanel.profileListLabel.text=Select Profile: diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java index 8fb5dcddb4..d1d277f2a7 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java @@ -1,19 +1,42 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; import org.openide.WizardDescriptor; /** - * Abstract class for exten - * + * An abstract class which provides providing a method which can be checked by + * the iterator containing panels of this type. So that Wizards containing these + * panels can enable finish before the last panel. */ -abstract class ShortCircuitableWizardPanel implements WizardDescriptor.Panel { +abstract class EarlyFinishWizardDescriptorPanel implements WizardDescriptor.Panel { - boolean shouldCheckForNext(){ - return true; + /** + * Whether or not this should be treated as the last panel. + * + * @return true or false + */ + boolean isLastPanel(){ + /* + * This class should be overriden by any panel that might want to + * enable the finish button early for its wizard. + */ + return false; } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form index 7f5b676190..76c5f52c5d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form @@ -2,7 +2,7 @@
- + @@ -34,11 +34,11 @@ - + - - + + @@ -51,35 +51,35 @@ - + - + - + - + - + - + - + - + - + @@ -93,10 +93,10 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 059539e100..9b1dfb299a 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -33,16 +33,23 @@ import org.sleuthkit.autopsy.ingest.IngestOptionsPanel; import org.sleuthkit.autopsy.ingest.IngestProfileMap; import org.sleuthkit.autopsy.ingest.IngestProfileMap.IngestProfile; +/** + * Visual panel for the choosing of ingest profiles by the user when running + * ingest. + */ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { private static final String CUSTOM_SETTINGS_DISPLAY_NAME = "Custom Settings"; private static final String CUSTOM_SETTINGS_DESCRIPTION = "configure individual module settings in next step of wizard"; //WJS-TODO these should be @Message private final RunIngestModuleWizardWizardPanel1 wizardPanel; private String selectedProfile; - private List elements = Collections.emptyList(); + private List profiles = Collections.emptyList(); /** - * Creates new form runIngestModuleWizardVisualPanel1 + * Creates new IngestProfileSelectionPanel + * + * @param panel - the WizardPanel which contains this panel + * @param lastSelectedProfile - the profile that will be selected initially */ IngestProfileSelectionPanel(RunIngestModuleWizardWizardPanel1 panel, String lastSelectedProfile) { initComponents(); @@ -50,24 +57,42 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { wizardPanel = panel; selectedProfile = lastSelectedProfile; populateListOfCheckboxes(); - + this.setName("Ingest Profile Selection"); //WJS-TODO @Messages this } + /** + * Returns the profile that is currently selected in this panel + * + * @return selectedProfile + */ String getLastSelectedProfile() { return selectedProfile; } + /** + * Adds a radio button for custom settings as well as one for each profile + * that has been created to the panel containing them. + */ private void populateListOfCheckboxes() { - elements = getElements(); + profiles = getProfiles(); addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModuleWizardWizardIterator.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); - for (IngestProfile profile : elements) { + for (IngestProfile profile : profiles) { addRadioButton(profile.toString(), profile.toString(), profile.getDescription()); } } + /** + * Creates and configures a single radio button before adding it to both the + * button group and the panel. + * + * @param profileDisplayName - the name of the profile the user should see + * @param profileContextName - the name the profile will be recognized as + * programmatically + * @param profileDesc - the description of the profile + */ private void addRadioButton(String profileDisplayName, String profileContextName, String profileDesc) { String displayText = profileDisplayName + " - " + profileDesc; - int width = jScrollPane1.getWidth(); + int width = profileListScrollPane.getWidth(); if (width > 3) { if (displayText.length() > width) { String ellipses = "..."; @@ -84,26 +109,28 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { myRadio.setSelected(true); } - buttonGroup1.add(myRadio); - jPanel1.add(myRadio); + profileListButtonGroup.add(myRadio); + profileListPanel.add(myRadio); } - @Override - public String getName() { - return "Ingest Profile Selection"; //WJS-TODO @Messages this - } - - private List getElements() { - if (elements.isEmpty()) { - fetchListContents(); + /** + * Getter for the list of profiles + * @return profiles + */ + private List getProfiles() { + if (profiles.isEmpty()) { + fetchProfileList(); } - return elements; + return profiles; } + /** + * Remove everything from the list of checkboxes. + */ private void clearListOfCheckBoxes() { - buttonGroup1 = new javax.swing.ButtonGroup(); - jPanel1.removeAll(); + profileListButtonGroup = new javax.swing.ButtonGroup(); + profileListPanel.removeAll(); } /** @@ -114,29 +141,29 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { // //GEN-BEGIN:initComponents private void initComponents() { - buttonGroup1 = new javax.swing.ButtonGroup(); - jButton1 = new javax.swing.JButton(); - jScrollPane1 = new javax.swing.JScrollPane(); - jPanel1 = new javax.swing.JPanel(); - jLabel1 = new javax.swing.JLabel(); + profileListButtonGroup = new javax.swing.ButtonGroup(); + ingestSettingsButton = new javax.swing.JButton(); + profileListScrollPane = new javax.swing.JScrollPane(); + profileListPanel = new javax.swing.JPanel(); + profileListLabel = new javax.swing.JLabel(); setMaximumSize(new java.awt.Dimension(5750, 3000)); setPreferredSize(new java.awt.Dimension(625, 450)); - org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.jButton1.text")); // NOI18N - jButton1.addActionListener(new java.awt.event.ActionListener() { + org.openide.awt.Mnemonics.setLocalizedText(ingestSettingsButton, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.ingestSettingsButton.text")); // NOI18N + ingestSettingsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jButton1ActionPerformed(evt); + ingestSettingsButtonActionPerformed(evt); } }); - jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + profileListScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jPanel1.setAutoscrolls(true); - jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.PAGE_AXIS)); - jScrollPane1.setViewportView(jPanel1); + profileListPanel.setAutoscrolls(true); + profileListPanel.setLayout(new javax.swing.BoxLayout(profileListPanel, javax.swing.BoxLayout.PAGE_AXIS)); + profileListScrollPane.setViewportView(profileListPanel); - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.jLabel1.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(profileListLabel, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.profileListLabel.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -145,11 +172,11 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1) + .addComponent(profileListScrollPane) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(ingestSettingsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(profileListLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 523, Short.MAX_VALUE))) .addContainerGap()) ); @@ -157,16 +184,22 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(profileListLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE) + .addComponent(profileListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jButton1) + .addComponent(ingestSettingsButton) .addGap(18, 18, 18)) ); }// //GEN-END:initComponents - private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + /** + * Opens up a dialog with an IngestOptionsPanel so the user can modify any + * settings from that options panel. + * + * @param evt the button press + */ + private void ingestSettingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestSettingsButtonActionPerformed final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); IngestOptionsPanel ingestOptions = new IngestOptionsPanel(); ingestOptions.load(); @@ -174,46 +207,56 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { (ActionEvent e) -> { ingestOptions.store(); clearListOfCheckBoxes(); - fetchListContents(); - jPanel1.revalidate(); - jPanel1.repaint(); + fetchProfileList(); + profileListPanel.revalidate(); + profileListPanel.repaint(); populateListOfCheckboxes(); dialog.close(); } ); dialog.display(ingestOptions); - }//GEN-LAST:event_jButton1ActionPerformed + }//GEN-LAST:event_ingestSettingsButtonActionPerformed - boolean hasNextPanel = true; + boolean isLastPanel = false; // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.ButtonGroup buttonGroup1; - private javax.swing.JButton jButton1; - private javax.swing.JLabel jLabel1; - private javax.swing.JPanel jPanel1; - private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JButton ingestSettingsButton; + private javax.swing.ButtonGroup profileListButtonGroup; + private javax.swing.JLabel profileListLabel; + private javax.swing.JPanel profileListPanel; + private javax.swing.JScrollPane profileListScrollPane; // End of variables declaration//GEN-END:variables + /** + * Listens for changes and checks the currently selected radio button + * if custom settings button is enabled it enables the next button, + * otherwise it enables the Finish button. + * + * @param e + */ @Override public void itemStateChanged(ItemEvent e) { - for (Component rButton : jPanel1.getComponents()) { + for (Component rButton : profileListPanel.getComponents()) { JRadioButton jrb = (JRadioButton) rButton; if (jrb.isSelected()) { selectedProfile = jrb.getName(); break; } } - boolean hadNextPanel = hasNextPanel; + boolean wasLastPanel = isLastPanel; if (selectedProfile.equals(RunIngestModuleWizardWizardIterator.getDefaultContext())) { - hasNextPanel = true; + isLastPanel = false; } else { - hasNextPanel = false; + isLastPanel = true; } wizardPanel.fireChangeEvent(); - this.firePropertyChange("LAST_ENABLED", hadNextPanel, hasNextPanel); //NON-NLS + this.firePropertyChange("LAST_ENABLED", wasLastPanel, isLastPanel); //NON-NLS } - private void fetchListContents() { - elements = new ArrayList<>(); - elements.addAll(new IngestProfileMap().getIngestProfileMap().values()); + /** + * Get all the currently existing ingest profiles. + */ + private void fetchProfileList() { + profiles = new ArrayList<>(); + profiles.addAll(new IngestProfileMap().getIngestProfileMap().values()); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java index d2b4ba97b1..6d4b508343 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; @@ -21,7 +34,7 @@ final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iter private int index; - private List panels; + private List panels; /** * @return the DEFAULT_CONTEXT @@ -30,7 +43,7 @@ final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iter return DEFAULT_CONTEXT; } - private List getPanels() { + private List getPanels() { if (panels == null) { panels = new ArrayList<>(); TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); @@ -58,7 +71,7 @@ final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iter } @Override - public ShortCircuitableWizardPanel current() { + public EarlyFinishWizardDescriptorPanel current() { return getPanels().get(index); } @@ -69,7 +82,7 @@ final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iter @Override public boolean hasNext() { - return (index < getPanels().size() - 1) && current().shouldCheckForNext(); + return (index < getPanels().size() - 1) && !current().isLastPanel(); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java index 28ebf04951..ec91e9c2fe 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; @@ -13,7 +26,7 @@ import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.coreutils.ModuleSettings; -class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPanel { +class RunIngestModuleWizardWizardPanel1 extends EarlyFinishWizardDescriptorPanel { private final Set listeners = new HashSet(1); private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS @@ -44,16 +57,14 @@ class RunIngestModuleWizardWizardPanel1 extends ShortCircuitableWizardPanel { } @Override - boolean shouldCheckForNext() { - return component.hasNextPanel; + boolean isLastPanel() { + return component.isLastPanel; } @Override public HelpCtx getHelp() { // Show no Help button for this panel: return HelpCtx.DEFAULT_HELP; - // If you have context help: - // return new HelpCtx("help.key.here"); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java index 563723d2f6..eb970dacff 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; @@ -11,7 +24,7 @@ import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; -class RunIngestModuleWizardWizardPanel2 extends ShortCircuitableWizardPanel { +class RunIngestModuleWizardWizardPanel2 extends EarlyFinishWizardDescriptorPanel { /** * f From b559ca70b87e149285c4b54514226108660236d3 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 2 Feb 2017 18:30:28 -0500 Subject: [PATCH 10/22] 2198 simplified names of runIngestModuleWizard classes --- .../IngestProfileSelectionPanel.java | 8 ++++---- ...rdIterator.java => RunIngestModuleWizardIterator.java} | 6 +++--- ...WizardPanel1.java => RunIngestModuleWizardPanel1.java} | 4 ++-- ...WizardPanel2.java => RunIngestModuleWizardPanel2.java} | 6 +++--- .../runIngestModuleWizard/RunIngestModulesAction.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModuleWizardWizardIterator.java => RunIngestModuleWizardIterator.java} (94%) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModuleWizardWizardPanel1.java => RunIngestModuleWizardPanel1.java} (95%) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModuleWizardWizardPanel2.java => RunIngestModuleWizardPanel2.java} (93%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 9b1dfb299a..898771b29c 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -41,7 +41,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { private static final String CUSTOM_SETTINGS_DISPLAY_NAME = "Custom Settings"; private static final String CUSTOM_SETTINGS_DESCRIPTION = "configure individual module settings in next step of wizard"; //WJS-TODO these should be @Message - private final RunIngestModuleWizardWizardPanel1 wizardPanel; + private final RunIngestModuleWizardPanel1 wizardPanel; private String selectedProfile; private List profiles = Collections.emptyList(); @@ -51,7 +51,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { * @param panel - the WizardPanel which contains this panel * @param lastSelectedProfile - the profile that will be selected initially */ - IngestProfileSelectionPanel(RunIngestModuleWizardWizardPanel1 panel, String lastSelectedProfile) { + IngestProfileSelectionPanel(RunIngestModuleWizardPanel1 panel, String lastSelectedProfile) { initComponents(); //WJS-TODO figure out how to get width of writable area, if text length greater than width. Trim text to width minus 3 chars in length and then add ... to the end wizardPanel = panel; @@ -75,7 +75,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { */ private void populateListOfCheckboxes() { profiles = getProfiles(); - addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModuleWizardWizardIterator.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); + addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModuleWizardIterator.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); for (IngestProfile profile : profiles) { addRadioButton(profile.toString(), profile.toString(), profile.getDescription()); } @@ -243,7 +243,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { } } boolean wasLastPanel = isLastPanel; - if (selectedProfile.equals(RunIngestModuleWizardWizardIterator.getDefaultContext())) { + if (selectedProfile.equals(RunIngestModuleWizardIterator.getDefaultContext())) { isLastPanel = false; } else { isLastPanel = true; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java similarity index 94% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java index 6d4b508343..71fabd2aa8 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java @@ -28,7 +28,7 @@ import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.sleuthkit.autopsy.ingest.IngestProfileMap; -final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iterator { +final class RunIngestModuleWizardIterator implements WizardDescriptor.Iterator { private final static String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; @@ -48,10 +48,10 @@ final class RunIngestModuleWizardWizardIterator implements WizardDescriptor.Iter panels = new ArrayList<>(); TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); if (!profileMap.isEmpty()) { - panels.add(new RunIngestModuleWizardWizardPanel1()); + panels.add(new RunIngestModuleWizardPanel1()); } - panels.add(new RunIngestModuleWizardWizardPanel2()); + panels.add(new RunIngestModuleWizardPanel2()); String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel1.java similarity index 95% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel1.java index ec91e9c2fe..012e73f421 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel1.java @@ -26,7 +26,7 @@ import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.coreutils.ModuleSettings; -class RunIngestModuleWizardWizardPanel1 extends EarlyFinishWizardDescriptorPanel { +class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { private final Set listeners = new HashSet(1); private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS @@ -47,7 +47,7 @@ class RunIngestModuleWizardWizardPanel1 extends EarlyFinishWizardDescriptorPanel if (component == null) { if (ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME) == null || ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME).isEmpty()) { - lastProfileUsed = RunIngestModuleWizardWizardIterator.getDefaultContext(); + lastProfileUsed = RunIngestModuleWizardIterator.getDefaultContext(); } else { lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java similarity index 93% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java index eb970dacff..6cacb9f890 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java @@ -24,7 +24,7 @@ import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; -class RunIngestModuleWizardWizardPanel2 extends EarlyFinishWizardDescriptorPanel { +class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { /** * f @@ -41,7 +41,7 @@ class RunIngestModuleWizardWizardPanel2 extends EarlyFinishWizardDescriptorPanel @Override public IngestJobSettingsPanel getComponent() { if (ingestJobSettingsPanel == null) { - ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModuleWizardWizardIterator.getDefaultContext())); + ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModuleWizardIterator.getDefaultContext())); } return ingestJobSettingsPanel; } @@ -81,7 +81,7 @@ class RunIngestModuleWizardWizardPanel2 extends EarlyFinishWizardDescriptorPanel public void storeSettings(WizardDescriptor wiz) { IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); ingestJobSettings.save(); - wiz.putProperty("executionContext", RunIngestModuleWizardWizardIterator.getDefaultContext()); //NON-NLS + wiz.putProperty("executionContext", RunIngestModuleWizardIterator.getDefaultContext()); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index d2939797e9..730b1990cf 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -71,7 +71,7 @@ public final class RunIngestModulesAction extends AbstractAction { */ @Override public void actionPerformed(ActionEvent e) { - WizardDescriptor wiz = new WizardDescriptor(new RunIngestModuleWizardWizardIterator()); + WizardDescriptor wiz = new WizardDescriptor(new RunIngestModuleWizardIterator()); // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() wiz.setTitleFormat(new MessageFormat("{0}")); wiz.setTitle(Bundle.RunIngestModulesAction_name()); From c33a84179c847bbbed32f43647242d971c3841ab Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 3 Feb 2017 10:55:17 -0500 Subject: [PATCH 11/22] 2198 additional comments and clean up for the RunIngestModulesWizard --- .../EarlyFinishWizardDescriptorPanel.java | 4 +-- .../IngestProfileSelectionPanel.java | 4 +-- .../RunIngestModuleWizardIterator.java | 18 +++++----- .../RunIngestModuleWizardPanel1.java | 23 +++++++++---- .../RunIngestModuleWizardPanel2.java | 12 ++----- .../RunIngestModulesAction.java | 33 +++++++++++++++---- 6 files changed, 60 insertions(+), 34 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java index d1d277f2a7..ec643d4d81 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java @@ -21,7 +21,7 @@ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; import org.openide.WizardDescriptor; /** - * An abstract class which provides providing a method which can be checked by + * An abstract class providing a method which can be checked by * the iterator containing panels of this type. So that Wizards containing these * panels can enable finish before the last panel. */ @@ -32,7 +32,7 @@ abstract class EarlyFinishWizardDescriptorPanel implements WizardDescriptor.Pane * * @return true or false */ - boolean isLastPanel(){ + boolean skipRemainingPanels(){ /* * This class should be overriden by any panel that might want to * enable the finish button early for its wizard. diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 898771b29c..0113651ca0 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -75,7 +75,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { */ private void populateListOfCheckboxes() { profiles = getProfiles(); - addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModuleWizardIterator.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); + addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModulesAction.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); for (IngestProfile profile : profiles) { addRadioButton(profile.toString(), profile.toString(), profile.getDescription()); } @@ -243,7 +243,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { } } boolean wasLastPanel = isLastPanel; - if (selectedProfile.equals(RunIngestModuleWizardIterator.getDefaultContext())) { + if (selectedProfile.equals(RunIngestModulesAction.getDefaultContext())) { isLastPanel = false; } else { isLastPanel = true; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java index 71fabd2aa8..ca36bdb322 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java @@ -28,21 +28,22 @@ import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.sleuthkit.autopsy.ingest.IngestProfileMap; +/** + * Iterator class for creating a wizard for run ingest modules. + * + */ final class RunIngestModuleWizardIterator implements WizardDescriptor.Iterator { - private final static String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; - private int index; private List panels; /** - * @return the DEFAULT_CONTEXT + * Gets the list of panels used by this wizard for iterating over. + * Constructing it when it is null. + * + * @return panels - the list of of WizardDescriptor panels */ - static String getDefaultContext() { - return DEFAULT_CONTEXT; - } - private List getPanels() { if (panels == null) { panels = new ArrayList<>(); @@ -80,9 +81,10 @@ final class RunIngestModuleWizardIterator implements WizardDescriptor.Iterator listeners = new HashSet(1); @@ -47,7 +52,7 @@ class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { if (component == null) { if (ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME) == null || ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME).isEmpty()) { - lastProfileUsed = RunIngestModuleWizardIterator.getDefaultContext(); + lastProfileUsed = RunIngestModulesAction.getDefaultContext(); } else { lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); } @@ -56,8 +61,15 @@ class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { return component; } + /** + * Returns whether or not this should be considered the last panel of the + * wizard. Returns true when a profile is selected, and false when + * custom settings is selected. + * + * @return true or false + */ @Override - boolean isLastPanel() { + boolean skipRemainingPanels() { return component.isLastPanel; } @@ -71,12 +83,11 @@ class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { public boolean isValid() { // If it is always OK to press Next or Finish, then: return true; - // If it depends on some condition (form filled out...) and - // this condition changes (last form field filled in...) then - // use ChangeSupport to implement add/removeChangeListener below. - // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful. } + /** + * Fires a change event to notify listeners that changes have taken place. + */ protected final void fireChangeEvent() { Set ls; synchronized (listeners) { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java index 6cacb9f890..91f34d4bea 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java @@ -27,7 +27,6 @@ import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { /** - * f * The visual ingestJobSettingsPanel that displays this panel. If you need * to access the ingestJobSettingsPanel from this class, just use * getComponent(). @@ -41,7 +40,7 @@ class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { @Override public IngestJobSettingsPanel getComponent() { if (ingestJobSettingsPanel == null) { - ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModuleWizardIterator.getDefaultContext())); + ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModulesAction.getDefaultContext())); } return ingestJobSettingsPanel; } @@ -50,18 +49,12 @@ class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { public HelpCtx getHelp() { // Show no Help button for this panel: return HelpCtx.DEFAULT_HELP; - // If you have context help: - // return new HelpCtx("help.key.here"); } @Override public boolean isValid() { // If it is always OK to press Next or Finish, then: return true; - // If it depends on some condition (form filled out...) and - // this condition changes (last form field filled in...) then - // use ChangeSupport to implement add/removeChangeListener below. - // WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful. } @Override @@ -74,14 +67,13 @@ class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { @Override public void readSettings(WizardDescriptor wiz) { - // use wiz.getProperty to retrieve previous panel state } @Override public void storeSettings(WizardDescriptor wiz) { IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); ingestJobSettings.save(); - wiz.putProperty("executionContext", RunIngestModuleWizardIterator.getDefaultContext()); //NON-NLS + wiz.putProperty("executionContext", RunIngestModulesAction.getDefaultContext()); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index 730b1990cf..d0ac6180d7 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -39,15 +39,29 @@ import org.sleuthkit.datamodel.Directory; * modules. */ public final class RunIngestModulesAction extends AbstractAction { - + @Messages("RunIngestModulesAction.name=Run Ingest Modules") + private static final String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; + + /** + * Returns the name of the default context which will be used when profiles are not available. + * + * @return the DEFAULT_CONTEXT + */ + static String getDefaultContext() { + return DEFAULT_CONTEXT; + } + + private final List dataSources = new ArrayList<>(); private final IngestJobSettings.IngestType ingestType; /** - * the constructor - * @param dataSources + * Creates an action which will make a run ingest modules wizard when it + * is performed. + * + * @param dataSources - the data sources you want to run ingest on */ public RunIngestModulesAction(List dataSources) { this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name()); @@ -56,8 +70,10 @@ public final class RunIngestModulesAction extends AbstractAction { } /** - * the constructor - * @param dir + * Creates an action which will make a run ingest modules wizard when it + * is performed. + * + * @param dir - the directory you want to run ingest on */ public RunIngestModulesAction(Directory dir) { this.putValue(Action.NAME, Bundle.RunIngestModulesAction_name()); @@ -65,7 +81,7 @@ public final class RunIngestModulesAction extends AbstractAction { this.ingestType = IngestJobSettings.IngestType.FILES_ONLY; } /** - * Runs the ingest modules wizard on the data source. + * Opens a run ingest modules wizard with the list of data sources. * * @param e the action event */ @@ -84,6 +100,11 @@ public final class RunIngestModulesAction extends AbstractAction { } } + /** + * Display any warnings that the ingestJobSettings have. + * + * @param ingestJobSettings + */ private static void showWarnings(IngestJobSettings ingestJobSettings) { List warnings = ingestJobSettings.getWarnings(); if (warnings.isEmpty() == false) { From f81a8fd1737e0b69ae09086da85304e53d063cc4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 3 Feb 2017 11:30:19 -0500 Subject: [PATCH 12/22] 2198 Names made more consistant, other minor clean up --- .../IngestProfileSelectionPanel.java | 24 ++++++++----------- .../RunIngestModulesAction.java | 2 +- ...va => RunIngestModulesWizardIterator.java} | 6 ++--- ...java => RunIngestModulesWizardPanel1.java} | 2 +- ...java => RunIngestModulesWizardPanel2.java} | 2 +- 5 files changed, 16 insertions(+), 20 deletions(-) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModuleWizardIterator.java => RunIngestModulesWizardIterator.java} (94%) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModuleWizardPanel1.java => RunIngestModulesWizardPanel1.java} (98%) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModuleWizardPanel2.java => RunIngestModulesWizardPanel2.java} (97%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 0113651ca0..a9b7d8f3f7 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -28,6 +28,7 @@ import java.util.List; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.ingest.IngestOptionsPanel; import org.sleuthkit.autopsy.ingest.IngestProfileMap; @@ -39,9 +40,13 @@ import org.sleuthkit.autopsy.ingest.IngestProfileMap.IngestProfile; */ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { - private static final String CUSTOM_SETTINGS_DISPLAY_NAME = "Custom Settings"; - private static final String CUSTOM_SETTINGS_DESCRIPTION = "configure individual module settings in next step of wizard"; //WJS-TODO these should be @Message - private final RunIngestModuleWizardPanel1 wizardPanel; + @Messages({"IngestProfileSelectionPanel.customSettings.name=Custom Settings", + "IngestProfileSelectionPanel.name=Ingest Profile Selection", + "IngestProfileSelectionPanel.customSettings.description=configure individual module settings in next step of wizard"}) + + private static final String CUSTOM_SETTINGS_DISPLAY_NAME = Bundle.IngestProfileSelectionPanel_customSettings_name(); + private static final String CUSTOM_SETTINGS_DESCRIPTION = Bundle.IngestProfileSelectionPanel_customSettings_description(); + private final RunIngestModulesWizardPanel1 wizardPanel; private String selectedProfile; private List profiles = Collections.emptyList(); @@ -51,13 +56,13 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { * @param panel - the WizardPanel which contains this panel * @param lastSelectedProfile - the profile that will be selected initially */ - IngestProfileSelectionPanel(RunIngestModuleWizardPanel1 panel, String lastSelectedProfile) { + IngestProfileSelectionPanel(RunIngestModulesWizardPanel1 panel, String lastSelectedProfile) { initComponents(); //WJS-TODO figure out how to get width of writable area, if text length greater than width. Trim text to width minus 3 chars in length and then add ... to the end wizardPanel = panel; selectedProfile = lastSelectedProfile; populateListOfCheckboxes(); - this.setName("Ingest Profile Selection"); //WJS-TODO @Messages this + this.setName(Bundle.IngestProfileSelectionPanel_name()); } /** @@ -92,15 +97,6 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { */ private void addRadioButton(String profileDisplayName, String profileContextName, String profileDesc) { String displayText = profileDisplayName + " - " + profileDesc; - int width = profileListScrollPane.getWidth(); - if (width > 3) { - if (displayText.length() > width) { - String ellipses = "..."; - displayText = displayText.substring(0, width - ellipses.length()) + ellipses; - } - } else { - System.out.println("NOT KNOWN BEFORE DRAWN USE DIFFERENT WAY TO GET WIDTH"); //WJS-TODO remove this when working - } JRadioButton myRadio = new JRadioButton(displayText); //NON-NLS myRadio.setName(profileContextName); myRadio.setToolTipText(profileDesc); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index d0ac6180d7..d325e649e7 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -87,7 +87,7 @@ public final class RunIngestModulesAction extends AbstractAction { */ @Override public void actionPerformed(ActionEvent e) { - WizardDescriptor wiz = new WizardDescriptor(new RunIngestModuleWizardIterator()); + WizardDescriptor wiz = new WizardDescriptor(new RunIngestModulesWizardIterator()); // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() wiz.setTitleFormat(new MessageFormat("{0}")); wiz.setTitle(Bundle.RunIngestModulesAction_name()); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java similarity index 94% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java index ca36bdb322..fc54b3f133 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -32,7 +32,7 @@ import org.sleuthkit.autopsy.ingest.IngestProfileMap; * Iterator class for creating a wizard for run ingest modules. * */ -final class RunIngestModuleWizardIterator implements WizardDescriptor.Iterator { +final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator { private int index; @@ -49,10 +49,10 @@ final class RunIngestModuleWizardIterator implements WizardDescriptor.Iterator(); TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); if (!profileMap.isEmpty()) { - panels.add(new RunIngestModuleWizardPanel1()); + panels.add(new RunIngestModulesWizardPanel1()); } - panels.add(new RunIngestModuleWizardPanel2()); + panels.add(new RunIngestModulesWizardPanel2()); String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java similarity index 98% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel1.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java index 841e75dd41..0b0ed9386d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java @@ -31,7 +31,7 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings; * selection panel and is only created when profiles exist. * */ -class RunIngestModuleWizardPanel1 extends EarlyFinishWizardDescriptorPanel { +class RunIngestModulesWizardPanel1 extends EarlyFinishWizardDescriptorPanel { private final Set listeners = new HashSet(1); private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel2.java similarity index 97% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel2.java index 91f34d4bea..5d80ef1848 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModuleWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel2.java @@ -24,7 +24,7 @@ import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; -class RunIngestModuleWizardPanel2 extends EarlyFinishWizardDescriptorPanel { +class RunIngestModulesWizardPanel2 extends EarlyFinishWizardDescriptorPanel { /** * The visual ingestJobSettingsPanel that displays this panel. If you need From 33efc3bce548108335afb1c88781646e1273c158 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 3 Feb 2017 12:47:19 -0500 Subject: [PATCH 13/22] 2198 fixed a few netbeans warnings --- .../sleuthkit/autopsy/ingest/ProfileSettingsPanel.java | 4 +++- .../IngestProfileSelectionPanel.java | 9 ++------- .../RunIngestModulesWizardPanel1.java | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index 6a8d5b2cc5..c2faa9b0d0 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -44,15 +44,17 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op "ProfileSettingsPanel.editProfileButton.text=Edit Profile", "ProfileSettingsPanel.deleteProfileButton.text=Delete Profile", "ProfileSettingsPanel.messages.filterLoadFailed=Failed to load file ingest filter", + "# {0} - profile name", "ProfileSettingsPanel.doFileSetsDialog.duplicateProfile.text=Profile with name {0} already exists." }) - private final DefaultListModel profilesListModel = new DefaultListModel<>(); + private final DefaultListModel profilesListModel; /** * Creates new form ProfileOptionsPanel */ ProfileSettingsPanel() { + this.profilesListModel = new DefaultListModel<>(); initComponents(); this.profileList.setModel(profilesListModel); this.profileList.addListSelectionListener(new ProfileSettingsPanel.ProfileListSelectionListener()); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index a9b7d8f3f7..088f173a25 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -58,7 +58,6 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { */ IngestProfileSelectionPanel(RunIngestModulesWizardPanel1 panel, String lastSelectedProfile) { initComponents(); - //WJS-TODO figure out how to get width of writable area, if text length greater than width. Trim text to width minus 3 chars in length and then add ... to the end wizardPanel = panel; selectedProfile = lastSelectedProfile; populateListOfCheckboxes(); @@ -97,7 +96,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { */ private void addRadioButton(String profileDisplayName, String profileContextName, String profileDesc) { String displayText = profileDisplayName + " - " + profileDesc; - JRadioButton myRadio = new JRadioButton(displayText); //NON-NLS + JRadioButton myRadio = new JRadioButton(displayText); myRadio.setName(profileContextName); myRadio.setToolTipText(profileDesc); myRadio.addItemListener(this); @@ -239,11 +238,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { } } boolean wasLastPanel = isLastPanel; - if (selectedProfile.equals(RunIngestModulesAction.getDefaultContext())) { - isLastPanel = false; - } else { - isLastPanel = true; - } + isLastPanel = !selectedProfile.equals(RunIngestModulesAction.getDefaultContext()); wizardPanel.fireChangeEvent(); this.firePropertyChange("LAST_ENABLED", wasLastPanel, isLastPanel); //NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java index 0b0ed9386d..5fc779e8ef 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java @@ -33,7 +33,7 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings; */ class RunIngestModulesWizardPanel1 extends EarlyFinishWizardDescriptorPanel { - private final Set listeners = new HashSet(1); + private final Set listeners = new HashSet<>(1); private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS private final static String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS /** From 17fc209cf7a17ef345fffd088a488328970df435 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 3 Feb 2017 14:45:29 -0500 Subject: [PATCH 14/22] 2198 - fixes to UI of profile panel --- .../autopsy/ingest/ProfileSettingsPanel.form | 147 ++++++++++-------- .../autopsy/ingest/ProfileSettingsPanel.java | 117 +++++++------- 2 files changed, 142 insertions(+), 122 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form index 6c37eb6522..d9d1e54aeb 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.form @@ -7,6 +7,9 @@ + + + @@ -24,26 +27,25 @@ + - - - - - - - - - - - - - - + + + + + + + + + + + - + + @@ -59,70 +61,62 @@ - + - - - + + + - - - - - - - - + - - - - - - - - + + + - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + @@ -156,16 +150,17 @@ - - - - - + + + + + + @@ -182,9 +177,15 @@ + + + + + + @@ -201,9 +202,18 @@ + + + + + + + + + @@ -325,5 +335,10 @@ + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index c2faa9b0d0..524f2d6815 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -73,7 +73,6 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op profileListPane = new javax.swing.JScrollPane(); profileList = new javax.swing.JList<>(); profileListLabel = new javax.swing.JLabel(); - jSeparator1 = new javax.swing.JSeparator(); newProfileButton = new javax.swing.JButton(); editProfileButton = new javax.swing.JButton(); deleteProfileButton = new javax.swing.JButton(); @@ -89,17 +88,19 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op selectedModulesArea = new javax.swing.JTextArea(); selectedModulesLabel = new javax.swing.JLabel(); ingestWarningLabel = new javax.swing.JLabel(); + jSeparator2 = new javax.swing.JSeparator(); setBorder(javax.swing.BorderFactory.createEtchedBorder()); + setPreferredSize(new java.awt.Dimension(800, 488)); profileList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); profileListPane.setViewportView(profileList); org.openide.awt.Mnemonics.setLocalizedText(profileListLabel, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.profileListLabel.text")); // NOI18N - jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL); - + newProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(newProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.newProfileButton.text")); // NOI18N + newProfileButton.setMargin(new java.awt.Insets(2, 8, 2, 8)); newProfileButton.setMaximumSize(new java.awt.Dimension(97, 23)); newProfileButton.setMinimumSize(new java.awt.Dimension(97, 23)); newProfileButton.setPreferredSize(new java.awt.Dimension(97, 23)); @@ -109,7 +110,9 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op } }); + editProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(editProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.editProfileButton.text")); // NOI18N + editProfileButton.setMargin(new java.awt.Insets(2, 8, 2, 8)); editProfileButton.setMaximumSize(new java.awt.Dimension(97, 23)); editProfileButton.setMinimumSize(new java.awt.Dimension(97, 23)); editProfileButton.setPreferredSize(new java.awt.Dimension(97, 23)); @@ -119,7 +122,10 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op } }); + deleteProfileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(deleteProfileButton, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.deleteProfileButton.text")); // NOI18N + deleteProfileButton.setMargin(new java.awt.Insets(2, 8, 2, 8)); + deleteProfileButton.setPreferredSize(new java.awt.Dimension(97, 23)); deleteProfileButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteProfileButtonActionPerformed(evt); @@ -162,26 +168,28 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(ProfileSettingsPanel.class, "ProfileSettingsPanel.ingestWarningLabel.text")); // NOI18N + jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(profileListLabel)) - .addGroup(layout.createSequentialGroup() - .addGap(20, 20, 20) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(profileListPane) - .addGroup(layout.createSequentialGroup() - .addComponent(newProfileButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(profileListLabel) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(profileListPane, javax.swing.GroupLayout.PREFERRED_SIZE, 339, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(editProfileButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 98, Short.MAX_VALUE))))) - .addGap(18, 18, 18) + .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(6, 6, 6))) + .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(6, 6, 6) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(filterNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -194,56 +202,53 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op .addComponent(profileDescLabel)) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() - .addGap(10, 10, 10) + .addGap(8, 8, 8) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(ingestWarningLabel) .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(filterDescPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE) - .addComponent(profileDescPane, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(selectedModulesPane, javax.swing.GroupLayout.Alignment.TRAILING)))) - .addGap(14, 14, 14)) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(330, Short.MAX_VALUE) - .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(564, Short.MAX_VALUE))) + .addComponent(filterDescPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE) + .addComponent(profileDescPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE) + .addComponent(selectedModulesPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE)))) + .addGap(12, 12, 12)) ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteProfileButton, editProfileButton, newProfileButton}); + layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(profileListLabel) - .addComponent(profileDescLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(profileDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(profileListLabel) + .addComponent(profileDescLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(filterNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(filterNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filterDescLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filterDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addGap(18, 18, 18) - .addComponent(selectedModulesLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(selectedModulesPane)) - .addComponent(profileListPane, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)) - .addGap(4, 4, 4) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(deleteProfileButton) - .addComponent(ingestWarningLabel)) - .addContainerGap()) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(profileDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(filterNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(filterNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(filterDescLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(filterDescPane, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addComponent(selectedModulesLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(selectedModulesPane)) + .addComponent(profileListPane, javax.swing.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)) + .addGap(4, 4, 4) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(newProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(editProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(deleteProfileButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ingestWarningLabel)) + .addContainerGap()) + .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING))) ); }// //GEN-END:initComponents @@ -408,7 +413,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op private javax.swing.JLabel filterNameLabel; private javax.swing.JLabel filterNameText; private javax.swing.JLabel ingestWarningLabel; - private javax.swing.JSeparator jSeparator1; + private javax.swing.JSeparator jSeparator2; private javax.swing.JButton newProfileButton; private javax.swing.JTextArea profileDescArea; private javax.swing.JLabel profileDescLabel; From bf43d674ba6cd25a8df70d6541a1f1f7371895e4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 3 Feb 2017 17:41:59 -0500 Subject: [PATCH 15/22] 2198 replaced custom abstract class with WizardDescriptor.FinishablePanel --- .../EarlyFinishWizardDescriptorPanel.java | 42 ------------------- ...va => IngestModulesConfigWizardPanel.java} | 7 +++- .../IngestProfileSelectionPanel.java | 4 +- ...=> IngestProfileSelectionWizardPanel.java} | 21 ++++------ .../RunIngestModulesWizardIterator.java | 12 +++--- 5 files changed, 21 insertions(+), 65 deletions(-) delete mode 100644 Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModulesWizardPanel2.java => IngestModulesConfigWizardPanel.java} (93%) rename Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/{RunIngestModulesWizardPanel1.java => IngestProfileSelectionWizardPanel.java} (91%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java deleted file mode 100644 index ec643d4d81..0000000000 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/EarlyFinishWizardDescriptorPanel.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2017 Basis Technology Corp. - * Contact: carrier sleuthkit org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; - -import org.openide.WizardDescriptor; - -/** - * An abstract class providing a method which can be checked by - * the iterator containing panels of this type. So that Wizards containing these - * panels can enable finish before the last panel. - */ -abstract class EarlyFinishWizardDescriptorPanel implements WizardDescriptor.Panel { - - /** - * Whether or not this should be treated as the last panel. - * - * @return true or false - */ - boolean skipRemainingPanels(){ - /* - * This class should be overriden by any panel that might want to - * enable the finish button early for its wizard. - */ - return false; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel2.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java similarity index 93% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel2.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java index 5d80ef1848..5244eeaaf3 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel2.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java @@ -24,7 +24,7 @@ import org.openide.util.HelpCtx; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; -class RunIngestModulesWizardPanel2 extends EarlyFinishWizardDescriptorPanel { +class IngestModulesConfigWizardPanel implements WizardDescriptor.FinishablePanel { /** * The visual ingestJobSettingsPanel that displays this panel. If you need @@ -76,4 +76,9 @@ class RunIngestModulesWizardPanel2 extends EarlyFinishWizardDescriptorPanel { wiz.putProperty("executionContext", RunIngestModulesAction.getDefaultContext()); //NON-NLS } + @Override + public boolean isFinishPanel() { + return true; + } + } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 088f173a25..7486d74c99 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -46,7 +46,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { private static final String CUSTOM_SETTINGS_DISPLAY_NAME = Bundle.IngestProfileSelectionPanel_customSettings_name(); private static final String CUSTOM_SETTINGS_DESCRIPTION = Bundle.IngestProfileSelectionPanel_customSettings_description(); - private final RunIngestModulesWizardPanel1 wizardPanel; + private final IngestProfileSelectionWizardPanel wizardPanel; private String selectedProfile; private List profiles = Collections.emptyList(); @@ -56,7 +56,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { * @param panel - the WizardPanel which contains this panel * @param lastSelectedProfile - the profile that will be selected initially */ - IngestProfileSelectionPanel(RunIngestModulesWizardPanel1 panel, String lastSelectedProfile) { + IngestProfileSelectionPanel(IngestProfileSelectionWizardPanel panel, String lastSelectedProfile) { initComponents(); wizardPanel = panel; selectedProfile = lastSelectedProfile; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java similarity index 91% rename from Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java rename to Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java index 5fc779e8ef..bfa8b035cf 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardPanel1.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java @@ -31,7 +31,7 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings; * selection panel and is only created when profiles exist. * */ -class RunIngestModulesWizardPanel1 extends EarlyFinishWizardDescriptorPanel { +class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePanel { private final Set listeners = new HashSet<>(1); private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS @@ -60,19 +60,7 @@ class RunIngestModulesWizardPanel1 extends EarlyFinishWizardDescriptorPanel { } return component; } - - /** - * Returns whether or not this should be considered the last panel of the - * wizard. Returns true when a profile is selected, and false when - * custom settings is selected. - * - * @return true or false - */ - @Override - boolean skipRemainingPanels() { - return component.isLastPanel; - } - + @Override public HelpCtx getHelp() { // Show no Help button for this panel: @@ -124,4 +112,9 @@ class RunIngestModulesWizardPanel1 extends EarlyFinishWizardDescriptorPanel { ModuleSettings.setConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME, lastProfileUsed); } + @Override + public boolean isFinishPanel() { + return component.isLastPanel; + } + } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java index fc54b3f133..7354255456 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -36,7 +36,7 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< private int index; - private List panels; + private List> panels; /** * Gets the list of panels used by this wizard for iterating over. @@ -44,15 +44,15 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< * * @return panels - the list of of WizardDescriptor panels */ - private List getPanels() { + private List> getPanels() { if (panels == null) { panels = new ArrayList<>(); TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); if (!profileMap.isEmpty()) { - panels.add(new RunIngestModulesWizardPanel1()); + panels.add(new IngestProfileSelectionWizardPanel()); } - panels.add(new RunIngestModulesWizardPanel2()); + panels.add(new IngestModulesConfigWizardPanel()); String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); @@ -72,7 +72,7 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< } @Override - public EarlyFinishWizardDescriptorPanel current() { + public WizardDescriptor.FinishablePanel current() { return getPanels().get(index); } @@ -84,7 +84,7 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< @Override public boolean hasNext() { - return (index < getPanels().size() - 1) && !current().skipRemainingPanels(); + return (index < getPanels().size() - 1) && !current().isFinishPanel(); } @Override From 8bde21f108f0ecda71f095f3de8094f1f21884c9 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 7 Feb 2017 18:44:09 -0500 Subject: [PATCH 16/22] 2198 fixed issue with Ingest Settings Panel when ok was chosen with nothing to save --- .../autopsy/ingest/IngestSettingsPanel.form | 16 +++++++-- .../autopsy/ingest/IngestSettingsPanel.java | 34 ++++++++++-------- .../autopsy/ingest/ProfileSettingsPanel.java | 35 +++++++++---------- 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form index c6edecaca9..8434d1f38d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.form @@ -1,6 +1,11 @@
+ + + + + @@ -16,7 +21,7 @@ - + @@ -36,6 +41,11 @@ + + + + + @@ -67,7 +77,7 @@ - + @@ -99,7 +109,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java index 918b93108b..2605ec0b0f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestSettingsPanel.java @@ -30,7 +30,7 @@ import org.sleuthkit.autopsy.core.UserPreferences; /** * Options panel that allow users to set application preferences. */ -final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { +final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { IngestSettingsPanel() { initComponents(); @@ -108,23 +108,23 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { UserPreferences.setProcessTimeOutHrs((int) timeOutHrs); } } - + boolean valid() { return true; } /** * Enable or Disable buttons based on whether Ingest is running. - * - * @param isEnabled + * + * @param isEnabled */ - void enableButtons(boolean isEnabled){ + void enableButtons(boolean isEnabled) { numberOfFileIngestThreadsComboBox.setEnabled(isEnabled); jFormattedTextFieldProcTimeOutHrs.setEnabled(isEnabled); jCheckBoxEnableProcTimeout.setEnabled(isEnabled); - ingestWarningLabel.setVisible(!isEnabled); + ingestWarningLabel.setVisible(!isEnabled); } - + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -144,8 +144,12 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { jLabelProcessTimeOutUnits = new javax.swing.JLabel(); ingestWarningLabel = new javax.swing.JLabel(); + setPreferredSize(new java.awt.Dimension(693, 413)); + jScrollPane1.setBorder(null); + jPanel1.setPreferredSize(new java.awt.Dimension(664, 400)); + org.openide.awt.Mnemonics.setLocalizedText(jLabelNumThreads, org.openide.util.NbBundle.getMessage(IngestSettingsPanel.class, "IngestSettingsPanel.jLabelNumThreads.text")); // NOI18N numberOfFileIngestThreadsComboBox.addActionListener(new java.awt.event.ActionListener() { @@ -205,7 +209,7 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelProcessTimeOutUnits))) .addGap(213, 213, 213))) - .addGap(215, 215, 215)) + .addContainerGap(52, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(ingestWarningLabel) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) @@ -229,7 +233,7 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { .addComponent(jLabelProcessTimeOutUnits))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(ingestWarningLabel) - .addContainerGap(277, Short.MAX_VALUE)) + .addContainerGap(257, Short.MAX_VALUE)) ); jScrollPane1.setViewportView(jPanel1); @@ -238,7 +242,7 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -246,18 +250,18 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { ); }// //GEN-END:initComponents - private void numberOfFileIngestThreadsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numberOfFileIngestThreadsComboBoxActionPerformed + private void jFormattedTextFieldProcTimeOutHrsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_numberOfFileIngestThreadsComboBoxActionPerformed + }//GEN-LAST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed private void jCheckBoxEnableProcTimeoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxEnableProcTimeoutActionPerformed jFormattedTextFieldProcTimeOutHrs.setEditable(jCheckBoxEnableProcTimeout.isSelected()); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_jCheckBoxEnableProcTimeoutActionPerformed - private void jFormattedTextFieldProcTimeOutHrsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed + private void numberOfFileIngestThreadsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numberOfFileIngestThreadsComboBoxActionPerformed firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); - }//GEN-LAST:event_jFormattedTextFieldProcTimeOutHrsActionPerformed + }//GEN-LAST:event_numberOfFileIngestThreadsComboBoxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel ingestWarningLabel; @@ -274,6 +278,6 @@ final class IngestSettingsPanel extends IngestModuleGlobalSettingsPanel { @Override public void saveSettings() { - this.store(); + this.store(); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java index ec6e4e6777..65128ca43c 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/ProfileSettingsPanel.java @@ -52,6 +52,7 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op private TreeMap profiles; private ProfilePanel panel; private boolean filtersShouldBeRefreshed; + /** * Creates new form ProfileOptionsPanel */ @@ -273,19 +274,19 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op }//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. - * + * 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 shouldFiltersBeRefreshed() { boolean shouldRefresh = filtersShouldBeRefreshed; filtersShouldBeRefreshed = false; return shouldRefresh; } - + /** * Enable / disable buttons, so they can be disabled while ingest is * running. @@ -358,16 +359,16 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op option = JOptionPane.showConfirmDialog(null, panel, Bundle.ProfileSettingsPanel_title(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition()); - // While adding new profile(selectedPRofile == null), if a profile with same name already exists, do not add to the profiles hashMap. - // In case of editing an existing profile(selectedProfile != null), following check is not performed. - if (this.profiles.containsKey(panel.getProfileName()) && selectedProfile == null) { - MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), - "ProfileSettingsPanel.doFileSetsDialog.duplicateProfile.text", - panel.getProfileName())); - return; - } if (option == JOptionPane.OK_OPTION) { - this.saveSettings(); + // While adding new profile(selectedPRofile == null), if a profile with same name already exists, do not add to the profiles hashMap. + // In case of editing an existing profile(selectedProfile != null), following check is not performed. + if (this.profiles.containsKey(panel.getProfileName()) && selectedProfile == null) { + MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), + "ProfileSettingsPanel.doFileSetsDialog.duplicateProfile.text", + panel.getProfileName())); + return; + } + panel.saveSettings(); load(); } @@ -375,12 +376,10 @@ class ProfileSettingsPanel extends IngestModuleGlobalSettingsPanel implements Op @Override public void saveSettings() { - this.store(); } @Override public void store() { - panel.saveSettings(); } /** From bfa75149da0c19d85b87bdd1af73447206d81af4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 8 Feb 2017 10:58:13 -0500 Subject: [PATCH 17/22] 2198 default run ingest modules context renamed for backwards compatability --- .../ingest/runIngestModuleWizard/RunIngestModulesAction.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index d325e649e7..9834a26134 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -41,8 +41,9 @@ import org.sleuthkit.datamodel.Directory; public final class RunIngestModulesAction extends AbstractAction { @Messages("RunIngestModulesAction.name=Run Ingest Modules") - - private static final String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.runIngestModuleAction"; + + //'dialog' context name required so existing settings do not need to be reconfigured + private static final String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog"; /** * Returns the name of the default context which will be used when profiles are not available. From 8b4b2b2fb5ca61df284a6cc4917518d2e9fab85b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 14 Feb 2017 15:56:21 -0500 Subject: [PATCH 18/22] 2198 resolve some additional conflicts from IngestProfiles rename --- .../autopsy/ingest/IngestProfiles.java | 2 +- .../IngestProfileSelectionPanel.java | 35 ++++++++++--------- .../RunIngestModulesWizardIterator.java | 7 ++-- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java index 8c4d9e0b58..f952ff54ac 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java @@ -117,7 +117,7 @@ public final class IngestProfiles { * * @return the description */ - String getDescription() { + public String getDescription() { return description; } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 7486d74c99..b98169bab5 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -31,8 +31,8 @@ import javax.swing.JScrollPane; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.ingest.IngestOptionsPanel; -import org.sleuthkit.autopsy.ingest.IngestProfileMap; -import org.sleuthkit.autopsy.ingest.IngestProfileMap.IngestProfile; +import org.sleuthkit.autopsy.ingest.IngestProfiles; +import org.sleuthkit.autopsy.ingest.IngestProfiles.IngestProfile; /** * Visual panel for the choosing of ingest profiles by the user when running @@ -40,12 +40,12 @@ import org.sleuthkit.autopsy.ingest.IngestProfileMap.IngestProfile; */ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { - @Messages({"IngestProfileSelectionPanel.customSettings.name=Custom Settings", + @Messages({"IngestProfileSelectionPanel.customSettings.name=Custom Settings", "IngestProfileSelectionPanel.name=Ingest Profile Selection", "IngestProfileSelectionPanel.customSettings.description=configure individual module settings in next step of wizard"}) - + private static final String CUSTOM_SETTINGS_DISPLAY_NAME = Bundle.IngestProfileSelectionPanel_customSettings_name(); - private static final String CUSTOM_SETTINGS_DESCRIPTION = Bundle.IngestProfileSelectionPanel_customSettings_description(); + private static final String CUSTOM_SETTINGS_DESCRIPTION = Bundle.IngestProfileSelectionPanel_customSettings_description(); private final IngestProfileSelectionWizardPanel wizardPanel; private String selectedProfile; private List profiles = Collections.emptyList(); @@ -61,9 +61,12 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { wizardPanel = panel; selectedProfile = lastSelectedProfile; populateListOfCheckboxes(); - this.setName(Bundle.IngestProfileSelectionPanel_name()); + customizePanel(); } + private void customizePanel(){ + this.setName(Bundle.IngestProfileSelectionPanel_name()); + } /** * Returns the profile that is currently selected in this panel * @@ -111,6 +114,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { /** * Getter for the list of profiles + * * @return profiles */ private List getProfiles() { @@ -189,9 +193,9 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { }// //GEN-END:initComponents /** - * Opens up a dialog with an IngestOptionsPanel so the user can modify any - * settings from that options panel. - * + * Opens up a dialog with an IngestOptionsPanel so the user can modify any + * settings from that options panel. + * * @param evt the button press */ private void ingestSettingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ingestSettingsButtonActionPerformed @@ -222,11 +226,11 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { // End of variables declaration//GEN-END:variables /** - * Listens for changes and checks the currently selected radio button - * if custom settings button is enabled it enables the next button, - * otherwise it enables the Finish button. - * - * @param e + * Listens for changes and checks the currently selected radio button if + * custom settings button is enabled it enables the next button, otherwise + * it enables the Finish button. + * + * @param e */ @Override public void itemStateChanged(ItemEvent e) { @@ -247,7 +251,6 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { * Get all the currently existing ingest profiles. */ private void fetchProfileList() { - profiles = new ArrayList<>(); - profiles.addAll(new IngestProfileMap().getIngestProfileMap().values()); + profiles = IngestProfiles.getIngestProfiles(); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java index 7354255456..f5e3daa60b 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -22,11 +22,10 @@ import java.awt.Component; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; -import java.util.TreeMap; import javax.swing.JComponent; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; -import org.sleuthkit.autopsy.ingest.IngestProfileMap; +import org.sleuthkit.autopsy.ingest.IngestProfiles; /** * Iterator class for creating a wizard for run ingest modules. @@ -47,8 +46,8 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< private List> getPanels() { if (panels == null) { panels = new ArrayList<>(); - TreeMap profileMap = new IngestProfileMap().getIngestProfileMap(); - if (!profileMap.isEmpty()) { + List profiles = IngestProfiles.getIngestProfiles(); + if (!profiles.isEmpty()) { panels.add(new IngestProfileSelectionWizardPanel()); } From c4c7cbb9f8c52b7aa09e9e4f83ecbfe599dd2254 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 14 Feb 2017 16:25:10 -0500 Subject: [PATCH 19/22] 2198 formatting fixes to all modified files --- .../autopsy/datamodel/ImageNode.java | 2 +- .../datamodel/VirtualDirectoryNode.java | 10 +++--- .../DirectoryTreeFilterNode.java | 4 +-- .../ingest/IngestJobSettingsPanel.java | 2 +- .../autopsy/ingest/IngestProfiles.java | 8 ++--- .../ingest/IngestProgressSnapshotDialog.java | 10 +++--- .../autopsy/ingest/RunIngestSubMenu.java | 22 ++++++------ .../IngestModulesConfigWizardPanel.java | 2 +- .../IngestProfileSelectionPanel.java | 5 +-- .../IngestProfileSelectionWizardPanel.java | 2 +- .../RunIngestModulesAction.java | 35 ++++++++++--------- .../RunIngestModulesWizardIterator.java | 5 ++- .../AddFileTypeSignatureDialog.java | 8 ++--- 13 files changed, 58 insertions(+), 57 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java index 5a4f99dae0..682a3fa225 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ImageNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2014 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java index 2dcb6fce3d..40f14bf63a 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/VirtualDirectoryNode.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * - * Copyright 2011-2014 Basis Technology Corp. + * + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 257e81f378..d5786333aa 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2014 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -72,7 +72,7 @@ class DirectoryTreeFilterNode extends FilterNode { if (file != null) { try { final int numChildren = file.getChildrenCount(); - + // left-to-right marks here are necessary to keep the count and parens together // for mixed right-to-left and left-to-right names name = name + " \u200E(\u200E" + numChildren + ")\u200E"; diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index d06e60a2fe..9d5e845721 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java index f952ff54ac..101d5bb0b1 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProfiles.java @@ -171,10 +171,10 @@ public final class IngestProfiles { * @param profile */ synchronized static void saveProfile(IngestProfile profile) { - String context = PROFILE_FOLDER + File.separator + profile.getName(); - ModuleSettings.setConfigSetting(context, PROFILE_NAME_KEY, profile.getName()); - ModuleSettings.setConfigSetting(context, PROFILE_DESC_KEY, profile.getDescription()); - ModuleSettings.setConfigSetting(context, PROFILE_FILTER_KEY, profile.getFileIngestFilter()); + String context = PROFILE_FOLDER + File.separator + profile.getName(); + ModuleSettings.setConfigSetting(context, PROFILE_NAME_KEY, profile.getName()); + ModuleSettings.setConfigSetting(context, PROFILE_DESC_KEY, profile.getDescription()); + ModuleSettings.setConfigSetting(context, PROFILE_FILTER_KEY, profile.getFileIngestFilter()); } } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java index 3323240a88..69416bf6c7 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestProgressSnapshotDialog.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * - * Copyright 2014 Basis Technology Corp. + * + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java index a8fabc1f31..0900e3041d 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/RunIngestSubMenu.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2015 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,29 +31,30 @@ import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; /** - * This class is used to populate the list of open dataSources to run ingest on them + * This class is used to populate the list of open dataSources to run ingest on + * them */ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { - + /** - * Creates main menu/popup menu items. It's called each time a popup menu - * is constructed and just once for the main menu. - * Main menu updates happen through the synchMenuPresenters() method. + * Creates main menu/popup menu items. It's called each time a popup menu is + * constructed and just once for the main menu. Main menu updates happen + * through the synchMenuPresenters() method. * * @return */ @Override public JComponent[] getMenuPresenters() { List dataSources = new ArrayList<>(); - - try { + + try { dataSources = Case.getCurrentCase().getDataSources(); } catch (IllegalStateException ex) { // No open Cases, create a disabled empty menu return getEmpty(); } catch (TskCoreException e) { System.out.println("Exception getting images: " + e.getMessage()); //NON-NLS - } + } JComponent[] comps = new JComponent[dataSources.size()]; // Add Images to the component list @@ -70,7 +71,7 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { } return comps; } - + // returns a disabled empty menu private JComponent[] getEmpty() { JComponent[] comps = new JComponent[1]; @@ -95,5 +96,4 @@ final class RunIngestSubMenu extends JMenuItem implements DynamicMenuContent { return getMenuPresenters(); } - } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java index 5244eeaaf3..0d2e20ba55 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestModulesConfigWizardPanel.java @@ -73,7 +73,7 @@ class IngestModulesConfigWizardPanel implements WizardDescriptor.FinishablePanel public void storeSettings(WizardDescriptor wiz) { IngestJobSettings ingestJobSettings = this.ingestJobSettingsPanel.getSettings(); ingestJobSettings.save(); - wiz.putProperty("executionContext", RunIngestModulesAction.getDefaultContext()); //NON-NLS + wiz.putProperty("executionContext", RunIngestModulesAction.getDefaultContext()); //NON-NLS } @Override diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index b98169bab5..cb0868d068 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -64,9 +64,10 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { customizePanel(); } - private void customizePanel(){ - this.setName(Bundle.IngestProfileSelectionPanel_name()); + private void customizePanel() { + this.setName(Bundle.IngestProfileSelectionPanel_name()); } + /** * Returns the profile that is currently selected in this panel * diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java index bfa8b035cf..980dc5af94 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java @@ -60,7 +60,7 @@ class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePa } return component; } - + @Override public HelpCtx getHelp() { // Show no Help button for this panel: diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java index 9834a26134..4636ff72f4 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesAction.java @@ -39,29 +39,29 @@ import org.sleuthkit.datamodel.Directory; * modules. */ public final class RunIngestModulesAction extends AbstractAction { - + @Messages("RunIngestModulesAction.name=Run Ingest Modules") - + //'dialog' context name required so existing settings do not need to be reconfigured private static final String DEFAULT_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog"; /** - * Returns the name of the default context which will be used when profiles are not available. - * + * Returns the name of the default context which will be used when profiles + * are not available. + * * @return the DEFAULT_CONTEXT */ static String getDefaultContext() { return DEFAULT_CONTEXT; } - private final List dataSources = new ArrayList<>(); private final IngestJobSettings.IngestType ingestType; - + /** - * Creates an action which will make a run ingest modules wizard when it - * is performed. - * + * Creates an action which will make a run ingest modules wizard when it is + * performed. + * * @param dataSources - the data sources you want to run ingest on */ public RunIngestModulesAction(List dataSources) { @@ -69,11 +69,11 @@ public final class RunIngestModulesAction extends AbstractAction { this.dataSources.addAll(dataSources); this.ingestType = IngestJobSettings.IngestType.ALL_MODULES; } - + /** - * Creates an action which will make a run ingest modules wizard when it - * is performed. - * + * Creates an action which will make a run ingest modules wizard when it is + * performed. + * * @param dir - the directory you want to run ingest on */ public RunIngestModulesAction(Directory dir) { @@ -81,6 +81,7 @@ public final class RunIngestModulesAction extends AbstractAction { this.dataSources.add(dir); this.ingestType = IngestJobSettings.IngestType.FILES_ONLY; } + /** * Opens a run ingest modules wizard with the list of data sources. * @@ -92,9 +93,9 @@ public final class RunIngestModulesAction extends AbstractAction { // {0} will be replaced by WizardDescriptor.Panel.getComponent().getName() wiz.setTitleFormat(new MessageFormat("{0}")); wiz.setTitle(Bundle.RunIngestModulesAction_name()); - + if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) { - String executionContext = (String)wiz.getProperty("executionContext"); //NON-NLS + String executionContext = (String) wiz.getProperty("executionContext"); //NON-NLS IngestJobSettings ingestJobSettings = new IngestJobSettings(executionContext, this.ingestType); showWarnings(ingestJobSettings); IngestManager.getInstance().queueIngestJob(this.dataSources, ingestJobSettings); @@ -103,8 +104,8 @@ public final class RunIngestModulesAction extends AbstractAction { /** * Display any warnings that the ingestJobSettings have. - * - * @param ingestJobSettings + * + * @param ingestJobSettings */ private static void showWarnings(IngestJobSettings ingestJobSettings) { List warnings = ingestJobSettings.getWarnings(); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java index f5e3daa60b..c02b2153f4 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/RunIngestModulesWizardIterator.java @@ -38,9 +38,9 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< private List> panels; /** - * Gets the list of panels used by this wizard for iterating over. + * Gets the list of panels used by this wizard for iterating over. * Constructing it when it is null. - * + * * @return panels - the list of of WizardDescriptor panels */ private List> getPanels() { @@ -80,7 +80,6 @@ final class RunIngestModulesWizardIterator implements WizardDescriptor.Iterator< return index + 1 + ". from " + getPanels().size(); } - @Override public boolean hasNext() { return (index < getPanels().size() - 1) && !current().isFinishPanel(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java index d5cade3571..3d63742c2e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java +++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/AddFileTypeSignatureDialog.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * + * * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. From 2e28f72d85f859c52d710c36c2f640c39e99045f Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 14 Feb 2017 17:07:37 -0500 Subject: [PATCH 20/22] 2198 removed netbeans warning regarding method which could be overridden --- .../org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 9d5e845721..b3e445daa8 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -60,6 +60,8 @@ import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; */ public final class IngestJobSettingsPanel extends javax.swing.JPanel { + @Messages("IngestJobSettingsPanel.name.text=Configure Ingest Modules") + private static final long serialVersionUID = 1L; private static ImageIcon warningIcon = new ImageIcon(IngestJobSettingsPanel.class.getResource("/org/sleuthkit/autopsy/images/warning_triangle.png")); private static ImageIcon infoIcon = new ImageIcon(IngestJobSettingsPanel.class.getResource("/org/sleuthkit/autopsy/images/information-frame.png")); @@ -84,7 +86,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); fileIngestFilterComboBox.setSelectedItem(settings.getFileIngestFilter().getName()); - this.setName("Configure Ingest Modules"); } /** @@ -184,6 +185,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { * and jobs for which to display the history. */ pastJobsButton.setEnabled(!dataSources.isEmpty() && !ingestJobs.isEmpty()); + this.setName(Bundle.IngestJobSettingsPanel_name_text()); } void setPastJobsButtonVisible(boolean isVisible) { From efef1b80771cef4d6aad4305f22e741858ef477a Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 14 Feb 2017 19:33:18 -0500 Subject: [PATCH 21/22] 2198 changed overridable methods to be used outside of constructor --- .../autopsy/casemodule/AddImageWizardIngestConfigPanel.java | 5 ++++- .../sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java | 3 --- .../IngestModulesConfigWizardPanel.java | 5 ++++- .../runIngestModuleWizard/IngestProfileSelectionPanel.java | 6 ------ .../IngestProfileSelectionWizardPanel.java | 4 ++++ 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java index 6291ff7521..d217e740ec 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/AddImageWizardIngestConfigPanel.java @@ -30,8 +30,10 @@ import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.event.ChangeListener; +import org.omg.CORBA.BAD_CONTEXT; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.Content; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor; @@ -47,7 +49,7 @@ import org.sleuthkit.autopsy.ingest.IngestManager; * 3rd panel( {@link AddImageWizardAddingProgressPanel}) separate class -jm */ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel { - + @Messages("AddImageWizardIngestConfigPanel.name.text=Configure Ingest Modules") private final IngestJobSettingsPanel ingestJobSettingsPanel; /** @@ -79,6 +81,7 @@ class AddImageWizardIngestConfigPanel implements WizardDescriptor.Panel { - + + @NbBundle.Messages("IngestModulesConfigWizardPanel.name.text=Configure Ingest Modules") /** * The visual ingestJobSettingsPanel that displays this panel. If you need * to access the ingestJobSettingsPanel from this class, just use @@ -42,6 +44,7 @@ class IngestModulesConfigWizardPanel implements WizardDescriptor.FinishablePanel if (ingestJobSettingsPanel == null) { ingestJobSettingsPanel = new IngestJobSettingsPanel(new IngestJobSettings(RunIngestModulesAction.getDefaultContext())); } + ingestJobSettingsPanel.setName(Bundle.IngestModulesConfigWizardPanel_name_text()); return ingestJobSettingsPanel; } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index cb0868d068..469ac94791 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -41,7 +41,6 @@ import org.sleuthkit.autopsy.ingest.IngestProfiles.IngestProfile; final class IngestProfileSelectionPanel extends JPanel implements ItemListener { @Messages({"IngestProfileSelectionPanel.customSettings.name=Custom Settings", - "IngestProfileSelectionPanel.name=Ingest Profile Selection", "IngestProfileSelectionPanel.customSettings.description=configure individual module settings in next step of wizard"}) private static final String CUSTOM_SETTINGS_DISPLAY_NAME = Bundle.IngestProfileSelectionPanel_customSettings_name(); @@ -61,11 +60,6 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { wizardPanel = panel; selectedProfile = lastSelectedProfile; populateListOfCheckboxes(); - customizePanel(); - } - - private void customizePanel() { - this.setName(Bundle.IngestProfileSelectionPanel_name()); } /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java index 980dc5af94..ed164a585b 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionWizardPanel.java @@ -24,6 +24,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.openide.util.HelpCtx; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.ModuleSettings; /** @@ -33,6 +34,8 @@ import org.sleuthkit.autopsy.coreutils.ModuleSettings; */ class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePanel { + @Messages("IngestProfileWizardPanel.panelName=Ingest Profile Selection") + private final Set listeners = new HashSet<>(1); private final static String PROP_LASTPROFILE_NAME = "RIMW_LASTPROFILE_NAME"; //NON-NLS private final static String LAST_PROFILE_PROPERTIES_FILE = "IngestProfileSelectionPanel"; //NON-NLS @@ -57,6 +60,7 @@ class IngestProfileSelectionWizardPanel implements WizardDescriptor.FinishablePa lastProfileUsed = ModuleSettings.getConfigSetting(LAST_PROFILE_PROPERTIES_FILE, PROP_LASTPROFILE_NAME); } component = new IngestProfileSelectionPanel(this, lastProfileUsed); + component.setName(Bundle.IngestProfileWizardPanel_panelName()); } return component; } From 8909d4e1a17f35bdb2152446deb77dfc199e8e92 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Feb 2017 14:51:42 -0500 Subject: [PATCH 22/22] 2198 multi line descriptions enabled for radio button scroll window --- .../IngestProfileSelectionPanel.form | 6 +- .../IngestProfileSelectionPanel.java | 60 +++++++++++++++---- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form index 76c5f52c5d..b5442660c1 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.form @@ -1,6 +1,6 @@ - + @@ -87,9 +87,7 @@ - - - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java index 469ac94791..7be4dcdc5f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/runIngestModuleWizard/IngestProfileSelectionPanel.java @@ -18,16 +18,21 @@ */ package org.sleuthkit.autopsy.ingest.runIngestModuleWizard; +import java.awt.Color; import java.awt.Component; + +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.util.ArrayList; import java.util.Collections; import java.util.List; +import static javax.swing.Box.createVerticalGlue; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; +import javax.swing.JTextArea; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.ingest.IngestOptionsPanel; @@ -59,6 +64,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { initComponents(); wizardPanel = panel; selectedProfile = lastSelectedProfile; + populateListOfCheckboxes(); } @@ -77,10 +83,30 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { */ private void populateListOfCheckboxes() { profiles = getProfiles(); - addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModulesAction.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION); + GridBagLayout gridBagLayout = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridx = 0; + constraints.gridy = 0; + constraints.weighty = .0; + constraints.anchor = GridBagConstraints.FIRST_LINE_START; + + addRadioButton(CUSTOM_SETTINGS_DISPLAY_NAME, RunIngestModulesAction.getDefaultContext(), CUSTOM_SETTINGS_DESCRIPTION, gridBagLayout, constraints); for (IngestProfile profile : profiles) { - addRadioButton(profile.toString(), profile.toString(), profile.getDescription()); + constraints.weightx = 0; + constraints.gridy++; + constraints.gridx = 0; + addRadioButton(profile.toString(), profile.toString(), profile.getDescription(), gridBagLayout, constraints); } + //Add vertical glue at the bottom of the scroll panel so spacing + //between elements is less dependent on the number of elements + constraints.gridy++; + constraints.gridx = 0; + constraints.weighty = 1; + Component vertGlue = createVerticalGlue(); + profileListPanel.add(vertGlue); + gridBagLayout.setConstraints(vertGlue, constraints); + profileListPanel.setLayout(gridBagLayout); } /** @@ -92,19 +118,29 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { * programmatically * @param profileDesc - the description of the profile */ - private void addRadioButton(String profileDisplayName, String profileContextName, String profileDesc) { + private void addRadioButton(String profileDisplayName, String profileContextName, String profileDesc, GridBagLayout layout, GridBagConstraints constraints) { String displayText = profileDisplayName + " - " + profileDesc; - JRadioButton myRadio = new JRadioButton(displayText); + JRadioButton myRadio = new JRadioButton(); + //Using a JTextArea as though it is a label in order to get multi-line support + JTextArea myLabel = new JTextArea(displayText); + Color gray = new Color(240, 240, 240); //matches background of panel + myLabel.setBackground(gray); + myLabel.setEditable(false); + myLabel.setWrapStyleWord(true); + myLabel.setLineWrap(true); myRadio.setName(profileContextName); myRadio.setToolTipText(profileDesc); myRadio.addItemListener(this); if (profileContextName.equals(selectedProfile)) { myRadio.setSelected(true); } - profileListButtonGroup.add(myRadio); profileListPanel.add(myRadio); - + layout.setConstraints(myRadio, constraints); + constraints.gridx++; + constraints.weightx = 1; + profileListPanel.add(myLabel); + layout.setConstraints(myLabel, constraints); } /** @@ -154,7 +190,7 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { profileListScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); profileListPanel.setAutoscrolls(true); - profileListPanel.setLayout(new javax.swing.BoxLayout(profileListPanel, javax.swing.BoxLayout.PAGE_AXIS)); + profileListPanel.setLayout(new java.awt.GridBagLayout()); profileListScrollPane.setViewportView(profileListPanel); org.openide.awt.Mnemonics.setLocalizedText(profileListLabel, org.openide.util.NbBundle.getMessage(IngestProfileSelectionPanel.class, "IngestProfileSelectionPanel.profileListLabel.text")); // NOI18N @@ -230,10 +266,12 @@ final class IngestProfileSelectionPanel extends JPanel implements ItemListener { @Override public void itemStateChanged(ItemEvent e) { for (Component rButton : profileListPanel.getComponents()) { + if (rButton instanceof JRadioButton){ JRadioButton jrb = (JRadioButton) rButton; - if (jrb.isSelected()) { - selectedProfile = jrb.getName(); - break; + if (jrb.isSelected()) { + selectedProfile = jrb.getName(); + break; + } } } boolean wasLastPanel = isLastPanel;