diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/Bundle.properties b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/Bundle.properties index 4a5e862bd1..3f809f12fb 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/Bundle.properties +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/Bundle.properties @@ -97,6 +97,8 @@ DisplayLogDialog.cannotFindLog=Unable to find the selected case log file DisplayLogDialog.unableToShowLogFile=Unable to show log file DisplayLogDialog.okay=Okay ReviewModeCasePanel.bnShowLog.text=&Show Log +OptionsCategory_Name_Case_Import=Case Import +OptionsCategory_Keywords_Case_Import=Case Import Settings CopyFilesPanel.lbFrom.text=From Source CopyFilesPanel.lbTo.text=Destination Case CopyFilesPanel.bnCopy.text=&Copy diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/CaseImportPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/CaseImportPanel.java index bd84ad2e18..25edb88dbe 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/CaseImportPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/CaseImportPanel.java @@ -46,6 +46,7 @@ import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreference */ public class CaseImportPanel extends javax.swing.JPanel implements ImportDoneCallback { + private final CaseImportPanelController controller; private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(CaseImportPanel.class.getName()); private Thread ongoingImport; // used to interrupt thread if we need to @@ -70,8 +71,32 @@ public class CaseImportPanel extends javax.swing.JPanel implements ImportDoneCal /** * Creates new panel CaseImportPanel */ - public CaseImportPanel() { + public CaseImportPanel(CaseImportPanelController theController) { + controller = theController; initComponents(); + badDatabaseCredentials = new ImageIcon(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/warning16.png", false)); //NON-NLS + goodDatabaseCredentials = new ImageIcon(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/tick.png", false)); //NON-NLS + } + + /** + * Validate current panel settings. + */ + boolean valid() { + // Nothing to validate for case import panel as far as Netbeans Tools/Options controller is concerned + return true; + } + + /** + * Store current panel settings. + */ + void store() { + // Nothing to store for case import panel as far as Netbeans Tools/Options controller is concerned + } + + /** + * Load data. + */ + final void load() { caseSourceFolderChooser.setCurrentDirectory(caseSourceFolderChooser.getFileSystemView().getParentDirectory(new File("C:\\"))); //NON-NLS caseSourceFolderChooser.setAcceptAllFileFilterUsed(false); caseSourceFolderChooser.setDialogTitle(NbBundle.getMessage(CaseImportPanel.class, "CaseImportPanel.ChooseCase")); @@ -84,8 +109,6 @@ public class CaseImportPanel extends javax.swing.JPanel implements ImportDoneCal tbImageDestination.setText(AutoIngestUserPreferences.getAutoModeImageFolder()); cbCopyImages.setSelected(true); cbDeleteCase.setSelected(false); - badDatabaseCredentials = new ImageIcon(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/warning16.png", false)); //NON-NLS - goodDatabaseCredentials = new ImageIcon(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/tick.png", false)); //NON-NLS picDbStatus.setText(""); //NON-NLS tbDeleteWarning.setText(""); //NON-NLS tbInputNotification.setText(""); //NON-NLS @@ -94,7 +117,7 @@ public class CaseImportPanel extends javax.swing.JPanel implements ImportDoneCal pbShowProgress.setStringPainted(true); pbShowProgress.setForeground(new Color(51, 153, 255)); pbShowProgress.setString(""); //NON-NLS - showDbStatus(); + showDbStatus(); } /** diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/CaseImportPanelController.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/CaseImportPanelController.java new file mode 100644 index 0000000000..46013d16a9 --- /dev/null +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/CaseImportPanelController.java @@ -0,0 +1,132 @@ + +/* + * Autopsy Forensic Browser + * + * Copyright 2013-2014 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.experimental.autoingest; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import javax.swing.JComponent; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; +import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; +import java.util.logging.Level; +import org.sleuthkit.autopsy.coreutils.Logger; + +@OptionsPanelController.TopLevelRegistration(categoryName = "#OptionsCategory_Name_Case_Import", + iconBase = "org/sleuthkit/autopsy/experimental/images/frame32.gif", + position = 4, + keywords = "#OptionsCategory_Keywords_Case_Import", + keywordsCategory = "Case Import") +public final class CaseImportPanelController extends OptionsPanelController { + + private CaseImportPanel panel; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private boolean changed; + private static final Logger logger = Logger.getLogger(CaseImportPanelController.class.getName()); + + @Override + public void update() { + getPanel().load(); + changed = false; + } + + @Override + public void applyChanges() { + getPanel().store(); + changed = false; + } + + @Override + public void cancel() { + } + + @Override + public boolean isValid() { + return getPanel().valid(); + } + + @Override + public boolean isChanged() { + return changed; + } + + @Override + public HelpCtx getHelpCtx() { + return null; + } + + @Override + public JComponent getComponent(Lookup masterLookup) { + return getPanel(); + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener l) { + if (pcs.getPropertyChangeListeners().length == 0) { + pcs.addPropertyChangeListener(l); + } + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener l) { + /** + * Note the NetBeans Framework does not appear to call this at all. We + * are using NetBeans 7.3.1 Build 201306052037. Perhaps in a future + * version of the Framework this will be resolved, but for now, simply + * don't unregister anything and add one time only in the + * addPropertyChangeListener() method above. + */ + } + + private CaseImportPanel getPanel() { + if (panel == null) { + panel = new CaseImportPanel(this); + } + return panel; + } + + void changed() { + if (!changed) { + changed = true; + + try { + pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); + } catch (Exception e) { + logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS + MessageNotifyUtil.Notify.show( + NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"), + NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"), + MessageNotifyUtil.MessageType.ERROR); + } + } + + try { + pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); + } catch (Exception e) { + logger.log(Level.SEVERE, "GeneralOptionsPanelController listener threw exception", e); //NON-NLS + MessageNotifyUtil.Notify.show( + NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr"), + NbBundle.getMessage(this.getClass(), "GeneralOptionsPanelController.moduleErr.msg"), + MessageNotifyUtil.MessageType.ERROR); + } + } +} + diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/StartupWindow.java b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/StartupWindow.java index 12b5c5dc4e..da78533ff1 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/StartupWindow.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/configuration/StartupWindow.java @@ -26,9 +26,7 @@ import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JDialog; -import javax.swing.JTabbedPane; import javax.swing.WindowConstants; -import org.openide.LifecycleManager; import org.openide.util.ImageUtilities; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; @@ -37,7 +35,6 @@ import org.sleuthkit.autopsy.casemodule.CueBannerPanel; import org.sleuthkit.autopsy.casemodule.StartupWindowInterface; import org.sleuthkit.autopsy.coreutils.NetworkUtils; import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestDashboard; -import org.sleuthkit.autopsy.experimental.autoingest.CaseImportPanel; import org.sleuthkit.autopsy.experimental.autoingest.ReviewModeCasePanel; /** @@ -51,8 +48,6 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa private static CueBannerPanel welcomeWindow; private static final long serialVersionUID = 1L; private ReviewModeCasePanel caseManagementPanel = null; - private CaseImportPanel caseImportPanel = null; - private JTabbedPane copyPane = new JTabbedPane(); private static final String LOCAL_HOST_NAME = NetworkUtils.getLocalHostName(); public StartupWindow() { @@ -130,20 +125,6 @@ public final class StartupWindow extends JDialog implements StartupWindowInterfa setIconImage(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/frame.gif", false)); //NON-NLS add(caseManagementPanel); break; - case COPYFILES: - this.setTitle(NbBundle.getMessage(StartupWindow.class, "StartupWindow.CopyAndImportMode") + " (" + LOCAL_HOST_NAME + ")"); - caseImportPanel = new CaseImportPanel(); - setIconImage(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/frame.gif", false)); //NON-NLS - copyPane.add(NbBundle.getMessage(StartupWindow.class, "StartupWindow.CaseImportMode"), caseImportPanel); - this.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - LifecycleManager.getDefault().exit(); - } - }); - setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - add(copyPane); - break; default: welcomeWindow = new CueBannerPanel(); // add the command to close the window to the button on the Volume Detail Panel