mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
First cut at refactoring CaseImportPanel into a Tool
This commit is contained in:
parent
8701b87a45
commit
0796d54cda
@ -97,6 +97,8 @@ DisplayLogDialog.cannotFindLog=Unable to find the selected case log file
|
|||||||
DisplayLogDialog.unableToShowLogFile=Unable to show log file
|
DisplayLogDialog.unableToShowLogFile=Unable to show log file
|
||||||
DisplayLogDialog.okay=Okay
|
DisplayLogDialog.okay=Okay
|
||||||
ReviewModeCasePanel.bnShowLog.text=&Show Log
|
ReviewModeCasePanel.bnShowLog.text=&Show Log
|
||||||
|
OptionsCategory_Name_Case_Import=Case Import
|
||||||
|
OptionsCategory_Keywords_Case_Import=Case Import Settings
|
||||||
CopyFilesPanel.lbFrom.text=From Source
|
CopyFilesPanel.lbFrom.text=From Source
|
||||||
CopyFilesPanel.lbTo.text=Destination Case
|
CopyFilesPanel.lbTo.text=Destination Case
|
||||||
CopyFilesPanel.bnCopy.text=&Copy
|
CopyFilesPanel.bnCopy.text=&Copy
|
||||||
|
@ -46,6 +46,7 @@ import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreference
|
|||||||
*/
|
*/
|
||||||
public class CaseImportPanel extends javax.swing.JPanel implements ImportDoneCallback {
|
public class CaseImportPanel extends javax.swing.JPanel implements ImportDoneCallback {
|
||||||
|
|
||||||
|
private final CaseImportPanelController controller;
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final Logger logger = Logger.getLogger(CaseImportPanel.class.getName());
|
private static final Logger logger = Logger.getLogger(CaseImportPanel.class.getName());
|
||||||
private Thread ongoingImport; // used to interrupt thread if we need to
|
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
|
* Creates new panel CaseImportPanel
|
||||||
*/
|
*/
|
||||||
public CaseImportPanel() {
|
public CaseImportPanel(CaseImportPanelController theController) {
|
||||||
|
controller = theController;
|
||||||
initComponents();
|
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.setCurrentDirectory(caseSourceFolderChooser.getFileSystemView().getParentDirectory(new File("C:\\"))); //NON-NLS
|
||||||
caseSourceFolderChooser.setAcceptAllFileFilterUsed(false);
|
caseSourceFolderChooser.setAcceptAllFileFilterUsed(false);
|
||||||
caseSourceFolderChooser.setDialogTitle(NbBundle.getMessage(CaseImportPanel.class, "CaseImportPanel.ChooseCase"));
|
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());
|
tbImageDestination.setText(AutoIngestUserPreferences.getAutoModeImageFolder());
|
||||||
cbCopyImages.setSelected(true);
|
cbCopyImages.setSelected(true);
|
||||||
cbDeleteCase.setSelected(false);
|
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
|
picDbStatus.setText(""); //NON-NLS
|
||||||
tbDeleteWarning.setText(""); //NON-NLS
|
tbDeleteWarning.setText(""); //NON-NLS
|
||||||
tbInputNotification.setText(""); //NON-NLS
|
tbInputNotification.setText(""); //NON-NLS
|
||||||
|
@ -0,0 +1,132 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* Autopsy Forensic Browser
|
||||||
|
*
|
||||||
|
* Copyright 2013-2014 Basis Technology Corp.
|
||||||
|
* Contact: carrier <at> sleuthkit <dot> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -26,9 +26,7 @@ import java.awt.event.ActionListener;
|
|||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JTabbedPane;
|
|
||||||
import javax.swing.WindowConstants;
|
import javax.swing.WindowConstants;
|
||||||
import org.openide.LifecycleManager;
|
|
||||||
import org.openide.util.ImageUtilities;
|
import org.openide.util.ImageUtilities;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.openide.util.lookup.ServiceProvider;
|
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.casemodule.StartupWindowInterface;
|
||||||
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
|
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
|
||||||
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestDashboard;
|
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestDashboard;
|
||||||
import org.sleuthkit.autopsy.experimental.autoingest.CaseImportPanel;
|
|
||||||
import org.sleuthkit.autopsy.experimental.autoingest.ReviewModeCasePanel;
|
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 CueBannerPanel welcomeWindow;
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private ReviewModeCasePanel caseManagementPanel = null;
|
private ReviewModeCasePanel caseManagementPanel = null;
|
||||||
private CaseImportPanel caseImportPanel = null;
|
|
||||||
private JTabbedPane copyPane = new JTabbedPane();
|
|
||||||
private static final String LOCAL_HOST_NAME = NetworkUtils.getLocalHostName();
|
private static final String LOCAL_HOST_NAME = NetworkUtils.getLocalHostName();
|
||||||
|
|
||||||
public StartupWindow() {
|
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
|
setIconImage(ImageUtilities.loadImage("org/sleuthkit/autopsy/experimental/images/frame.gif", false)); //NON-NLS
|
||||||
add(caseManagementPanel);
|
add(caseManagementPanel);
|
||||||
break;
|
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:
|
default:
|
||||||
welcomeWindow = new CueBannerPanel();
|
welcomeWindow = new CueBannerPanel();
|
||||||
// add the command to close the window to the button on the Volume Detail Panel
|
// add the command to close the window to the button on the Volume Detail Panel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user