diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java index 3c5a642cf5..68f0271b66 100755 --- a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java +++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestManager.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.ingest; -import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.text.DateFormat; @@ -46,7 +45,6 @@ import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandleFactory; import org.openide.util.Cancellable; import org.openide.util.Lookup; -import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.ingest.IngestMessage.MessageType; import org.sleuthkit.datamodel.FsContent; import org.sleuthkit.datamodel.Image; @@ -88,7 +86,7 @@ public class IngestManager { public final static String SERVICE_STOPPED_EVT = IngestManagerEvents.SERVICE_STOPPED.name(); public final static String SERVICE_HAS_DATA_EVT = IngestManagerEvents.SERVICE_HAS_DATA.name(); //ui - private IngestUI ui = IngestTopComponent.getDefault(); + private IngestUI ui = IngestMessageTopComponent.findInstance(); //singleton private static IngestManager instance; @@ -97,8 +95,8 @@ public class IngestManager { } static synchronized IngestManager getDefault() { - logger.log(Level.INFO, "creating manager instance"); if (instance == null) { + logger.log(Level.INFO, "creating manager instance"); instance = new IngestManager(); } return instance; diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponent.form b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponent.form new file mode 100644 index 0000000000..b8a67a0dd3 --- /dev/null +++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponent.form @@ -0,0 +1,28 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponent.java b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponent.java new file mode 100644 index 0000000000..bae40c776a --- /dev/null +++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponent.java @@ -0,0 +1,264 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011 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.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import org.openide.util.ImageUtilities; +import org.openide.util.NbBundle; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.datamodel.Image; + +/** + * Top component which displays something. + */ + +//@ConvertAsProperties(dtd = "-//org.sleuthkit.autopsy.ingest//IngestMessage//EN", +//autostore = false) +//@TopComponent.Description(preferredID = "IngestMessageTopComponent", +//iconBase = "org/sleuthkit/autopsy/ingest/ingest-msg-icon.png", +//persistenceType = TopComponent.PERSISTENCE_NEVER) +//@TopComponent.Registration(mode = "floatingLeftBottom", openAtStartup = false) +//@ActionID(category = "Window", id = "org.sleuthkit.autopsy.ingest.IngestMessageTopComponent") +//@ActionReference(path = "Menu/Window" /*, position = 333 */) +//@TopComponent.OpenActionRegistration(displayName = "#CTL_IngestMessageAction", +//preferredID = "IngestMessageTopComponent") +public final class IngestMessageTopComponent extends TopComponent implements IngestUI { + + private static IngestMessageTopComponent instance; + private static final Logger logger = Logger.getLogger(IngestMessageTopComponent.class.getName()); + private IngestMessagePanel messagePanel; + private static String PREFERRED_ID = "IngestMessageTopComponent"; + + + public IngestMessageTopComponent() { + initComponents(); + customizeComponents(); + registerListeners(); + setName(NbBundle.getMessage(IngestMessageTopComponent.class, "CTL_IngestMessageTopComponent")); + setToolTipText(NbBundle.getMessage(IngestMessageTopComponent.class, "HINT_IngestMessageTopComponent")); + putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE); + //putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE); + + } + + private static synchronized IngestMessageTopComponent getDefault() { + if (instance == null) { + instance = new IngestMessageTopComponent(); + } + return instance; + } + + public static synchronized IngestMessageTopComponent findInstance() { + TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); + if (win == null) { + return getDefault(); + } + if (win instanceof IngestMessageTopComponent) { + return (IngestMessageTopComponent) win; + } + + return getDefault(); + } + + + /** 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() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 385, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 362, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables + + @Override + public void componentOpened() { + // TODO add custom code on component opening + // WindowManager.getDefault().findMode("floatingLeftBottom").dockInto(this); + IngestManager.getDefault(); //create initial instance + //TODO alternatively, reigster manager with lookup and instantiate when case is opened or image added + } + + @Override + public void componentClosed() { + // TODO add custom code on component closing + // WindowManager.getDefault().findMode("bottomSlidingSide").dockInto(this); + } + + @Override + protected void componentShowing() { + super.componentShowing(); + //WindowManager.getDefault().findMode("floatingLeftBottom").dockInto(this); + } + + @Override + protected void componentHidden() { + super.componentHidden(); + //WindowManager.getDefault().findMode("bottomSlidingSide").dockInto(this); + //WindowManager.getDefault().findMode("floatingLeftBottom").dockInto(this); + } + + @Override + protected void componentActivated() { + super.componentActivated(); + } + + @Override + protected void componentDeactivated() { + super.componentDeactivated(); + } + + @Override + public boolean canClose() { + return false; + } + + @Override + public int getPersistenceType() { + return TopComponent.PERSISTENCE_NEVER; + } + + @Override + public java.awt.Image getIcon() { + return ImageUtilities.loadImage( + "org/sleuthkit/autopsy/ingest/ingest-msg-icon.png"); + } + + + + void writeProperties(java.util.Properties p) { + // better to version settings since initial version as advocated at + // http://wiki.apidesign.org/wiki/PropertyFiles + p.setProperty("version", "1.0"); + // TODO store your settings + } + + void readProperties(java.util.Properties p) { + String version = p.getProperty("version"); + // TODO read your settings according to their version + } + + private void registerListeners() { + //handle case change + Case.addPropertyChangeListener(new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getPropertyName().equals(Case.CASE_CURRENT_CASE)) { + Case oldCase = (Case) evt.getOldValue(); + if (oldCase == null) //nothing to do, new case had been opened + { + return; + } + //stop workers if running + IngestManager.getDefault().stopAll(); + //clear inbox + clearMessages(); + } else if (evt.getPropertyName().equals(Case.CASE_ADD_IMAGE)) { + final Image image = (Image) evt.getNewValue(); + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + displayIngestDialog(image); + } + }); + + } + } + }); + } + + private void customizeComponents() { + //custom GUI setup not done by builder + + messagePanel = new IngestMessagePanel(); + messagePanel.setOpaque(false); + setLayout(new BorderLayout()); + add(messagePanel, BorderLayout.CENTER); + + //messagePanel.addMessage(IngestMessage.createManagerMessage("TEST1")); + //messagePanel.addMessage(IngestMessage.createManagerMessage("TEST2")); + //messagePanel.addMessage(IngestMessage.createManagerMessage("TEST3")); + } + + /** + * Display ingest summary report in some dialog + */ + @Override + public void displayReport(String ingestReport) { + JOptionPane.showMessageDialog( + null, + ingestReport, + "File Ingest Summary", + JOptionPane.INFORMATION_MESSAGE); + } + + /** + * Display IngestMessage from service (forwarded by IngestManager) + */ + @Override + public void displayMessage(IngestMessage ingestMessage) { + addMessage(ingestMessage); + } + + @Override + public void initProgress(int maximum) { + } + + @Override + public void updateProgress(int progress) { + } + + @Override + public void clearMessages() { + clearMessages(); + } + + @Override + public void displayIngestDialog(final Image image) { + final IngestDialog ingestDialog = new IngestDialog(); + ingestDialog.setImage(image); + ingestDialog.display(); + + } + + public void addMessage(IngestMessage m) { + messagePanel.addMessage(m); + } +} diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponentWstcref.xml b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponentWstcref.xml new file mode 100644 index 0000000000..0a085fd645 --- /dev/null +++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestMessageTopComponentWstcref.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java index 1bdc53a342..15de3e3e84 100644 --- a/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java +++ b/Ingest/src/org/sleuthkit/autopsy/ingest/IngestTopComponent.java @@ -35,7 +35,7 @@ import org.sleuthkit.datamodel.Image; /** * Top component explorer for the Ingest module. */ -public final class IngestTopComponent extends TopComponent implements DataExplorer, IngestUI { +public final class IngestTopComponent extends TopComponent implements DataExplorer { private static IngestTopComponent instance; private static final Logger logger = Logger.getLogger(IngestTopComponent.class.getName()); @@ -43,8 +43,8 @@ public final class IngestTopComponent extends TopComponent implements DataExplor private IngestTopComponent() { initComponents(); - customizeComponents(); - registerListeners(); + // customizeComponents(); + //registerListeners(); setName(NbBundle.getMessage(IngestTopComponent.class, "CTL_IngestTopComponent")); setToolTipText(NbBundle.getMessage(IngestTopComponent.class, "HINT_IngestTopComponent")); //putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE); @@ -74,36 +74,6 @@ public final class IngestTopComponent extends TopComponent implements DataExplor return TopComponent.PERSISTENCE_NEVER; } - private void registerListeners() { - //handle case change - Case.addPropertyChangeListener(new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getPropertyName().equals(Case.CASE_CURRENT_CASE)) { - Case oldCase = (Case) evt.getOldValue(); - if (oldCase == null) //nothing to do, new case had been opened - { - return; - } - //stop workers if running - IngestManager.getDefault().stopAll(); - //clear inbox - clearMessages(); - } else if (evt.getPropertyName().equals(Case.CASE_ADD_IMAGE)) { - final Image image = (Image) evt.getNewValue(); - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - displayIngestDialog(image); - } - }); - - } - } - }); - } private void customizeComponents() { //custom GUI setup not done by builder @@ -257,7 +227,7 @@ public final class IngestTopComponent extends TopComponent implements DataExplor @Override public void componentOpened() { logger.log(Level.INFO, "IngestTopComponent opened()"); - IngestManager.getDefault(); //create initial instance + // IngestManager.getDefault(); //create initial instance } @@ -279,46 +249,7 @@ public final class IngestTopComponent extends TopComponent implements DataExplor } - /** - * Display ingest summary report in some dialog - */ - @Override - public void displayReport(String ingestReport) { - JOptionPane.showMessageDialog( - null, - ingestReport, - "File Ingest Summary", - JOptionPane.INFORMATION_MESSAGE); - } + - /** - * Display IngestMessage from service (forwarded by IngestManager) - */ - @Override - public void displayMessage(IngestMessage ingestMessage) { - messagePanel.addMessage(ingestMessage); - } - - @Override - public void initProgress(int maximum) { - this.mainProgressBar.setMaximum(maximum); - } - - @Override - public void updateProgress(int progress) { - this.mainProgressBar.setValue(progress); - } - - @Override - public void clearMessages() { - messagePanel.clearMessages(); - } - - @Override - public void displayIngestDialog(final Image image) { - final IngestDialog ingestDialog = new IngestDialog(); - ingestDialog.setImage(image); - ingestDialog.display(); - - } + } diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/floatingLeftBottomWsmode.xml b/Ingest/src/org/sleuthkit/autopsy/ingest/floatingLeftBottomWsmode.xml new file mode 100644 index 0000000000..9a958c3f6d --- /dev/null +++ b/Ingest/src/org/sleuthkit/autopsy/ingest/floatingLeftBottomWsmode.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/ingest-msg-icon.png b/Ingest/src/org/sleuthkit/autopsy/ingest/ingest-msg-icon.png new file mode 100644 index 0000000000..98a142996e Binary files /dev/null and b/Ingest/src/org/sleuthkit/autopsy/ingest/ingest-msg-icon.png differ diff --git a/Ingest/src/org/sleuthkit/autopsy/ingest/layer.xml b/Ingest/src/org/sleuthkit/autopsy/ingest/layer.xml index 4e31716dc8..0d1f79bfdb 100644 --- a/Ingest/src/org/sleuthkit/autopsy/ingest/layer.xml +++ b/Ingest/src/org/sleuthkit/autopsy/ingest/layer.xml @@ -1,12 +1,18 @@ + + + + + - - - - - + + + + + + + + + +