From b19f8d99afb85fbac75e35cc9b613a9b0d8caa5f Mon Sep 17 00:00:00 2001 From: Tim McIver Date: Fri, 8 Feb 2013 12:57:11 -0500 Subject: [PATCH 1/3] Added blocking dialog box 'TimelineProgressDialog' that comes up when timeline processing begins and closes when it is finished. This is to prevent users from starting another timeline processing job while one is already underway. --- .../autopsy/timeline/Bundle.properties | 1 + .../sleuthkit/autopsy/timeline/Simile2.java | 13 ++ .../timeline/TimelineProgressDialog.form | 52 ++++++++ .../timeline/TimelineProgressDialog.java | 114 ++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.form create mode 100644 Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.java diff --git a/Timeline/src/org/sleuthkit/autopsy/timeline/Bundle.properties b/Timeline/src/org/sleuthkit/autopsy/timeline/Bundle.properties index 8695a80f7c..65071f9662 100644 --- a/Timeline/src/org/sleuthkit/autopsy/timeline/Bundle.properties +++ b/Timeline/src/org/sleuthkit/autopsy/timeline/Bundle.properties @@ -1,2 +1,3 @@ OpenIDE-Module-Name=Timeline CTL_MakeTimeline="Make Timeline (Beta)" +TimelineProgressDialog.jLabel1.text=Computing timeline . . . diff --git a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java index d479dde84b..f112e55949 100644 --- a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java +++ b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java @@ -137,6 +137,7 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, private List data; private boolean listeningToAddImage = false; private long lastObjectId = -1; + private TimelineProgressDialog dialog; //Swing components and JavafX components don't play super well together //Swing components need to be initialized first, in the swing specific thread @@ -299,6 +300,9 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, } finally { // stop the progress bar progress.finish(); + + // close the dialog + dialog.doClose(0); } } }); @@ -975,6 +979,15 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, listeningToAddImage = true; } + // create the modal dialog + SwingUtilities.invokeLater(new Runnable () { + @Override + public void run() { + dialog = new TimelineProgressDialog(jf, true); + dialog.setVisible(true); + } + }); + // initialize mactimeFileName mactimeFileName = Case.getCurrentCase().getName() + "-MACTIME.txt"; diff --git a/Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.form b/Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.form new file mode 100644 index 0000000000..0d37383f5a --- /dev/null +++ b/Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.form @@ -0,0 +1,52 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.java b/Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.java new file mode 100644 index 0000000000..71983d603d --- /dev/null +++ b/Timeline/src/org/sleuthkit/autopsy/timeline/TimelineProgressDialog.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.timeline; + +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import javax.swing.AbstractAction; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.KeyStroke; + +/** + * + * @author mciver + */ +public class TimelineProgressDialog extends javax.swing.JDialog { + + /** + * A return status code - returned if Cancel button has been pressed + */ + public static final int RET_CANCEL = 0; + /** + * A return status code - returned if OK button has been pressed + */ + public static final int RET_OK = 1; + + /** + * Creates new form TimelineProgressDialog + */ + public TimelineProgressDialog(java.awt.Frame parent, boolean modal) { + super(parent, modal); + initComponents(); + + setLocationRelativeTo(null); + + // Close the dialog when Esc is pressed + String cancelName = "cancel"; + InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), cancelName); + ActionMap actionMap = getRootPane().getActionMap(); + actionMap.put(cancelName, new AbstractAction() { + public void actionPerformed(ActionEvent e) { + doClose(RET_CANCEL); + } + }); + } + + /** + * @return the return status of this dialog - one of RET_OK or RET_CANCEL + */ + public int getReturnStatus() { + return returnStatus; + } + + /** + * 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. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + closeDialog(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(TimelineProgressDialog.class, "TimelineProgressDialog.jLabel1.text")); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(51, 51, 51) + .addComponent(jLabel1) + .addContainerGap(121, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(37, 37, 37) + .addComponent(jLabel1) + .addContainerGap(64, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + /** + * Closes the dialog + */ + private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog + doClose(RET_CANCEL); + }//GEN-LAST:event_closeDialog + + public void doClose(int retStatus) { + returnStatus = retStatus; + setVisible(false); + dispose(); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + // End of variables declaration//GEN-END:variables + private int returnStatus = RET_CANCEL; +} From 82bf72b3e72cac69bf3f4f69966510f8b3f6054b Mon Sep 17 00:00:00 2001 From: Tim McIver Date: Fri, 8 Feb 2013 14:15:47 -0500 Subject: [PATCH 2/3] Added code to prevent selection of 'Make Timeline' (from Tools menu) from running timeline again and opening additional windows. --- Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java index f112e55949..422ee53d43 100644 --- a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java +++ b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java @@ -970,6 +970,11 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, } else { logger.log(Level.INFO, "Beginning generation of timeline"); + // if the timeline window is already open, do nothing + if (jf != null && jf.isVisible()) { + return; + } + Platform.setImplicitExit(false); // listen for case changes (specifically images being added). From bff95881fdbbca27d1a4c927bbad056cc2120e57 Mon Sep 17 00:00:00 2001 From: Tim McIver Date: Fri, 8 Feb 2013 17:18:19 -0500 Subject: [PATCH 3/3] Added JSplitPane to timeline window to separate the barchar area on the top from the viewers on the bottom. --- .../org/sleuthkit/autopsy/timeline/Simile2.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java index 422ee53d43..48332bda45 100644 --- a/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java +++ b/Timeline/src/org/sleuthkit/autopsy/timeline/Simile2.java @@ -68,6 +68,7 @@ import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.JSplitPane; import javax.swing.SwingUtilities; import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandleFactory; @@ -175,8 +176,10 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, //ComboJPanel holds both of the above JPanels together, //aligned vertically (Y_AXIS) - final JPanel comboJPanel = new JPanel(); - comboJPanel.setLayout(new BoxLayout(comboJPanel, BoxLayout.Y_AXIS)); + + // create a horizontal split pane + final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, chartJPanel, viewerJPanel); + splitPane.setDividerLocation(450); //JavaFX thread //JavaFX components MUST be run in the JavaFX thread, otherwise massive amounts of exceptions will be thrown and caught. Liable to freeze up and crash. @@ -289,13 +292,12 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, viewerJPanel.add(dataContentPanel); chartJPanel.setAlignmentX(Component.LEFT_ALIGNMENT); viewerJPanel.setAlignmentX(Component.LEFT_ALIGNMENT); - comboJPanel.add(chartJPanel); - comboJPanel.add(viewerJPanel); chart_TopLevel = createYearChartWithDrill(data); chart_Events = chart_TopLevel; scroll_Events.setContent(chart_Events); - jf.add(comboJPanel); + + jf.add(splitPane); jf.setVisible(true); } finally { // stop the progress bar @@ -1010,8 +1012,6 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar, } catch (TskCoreException ex) { Exceptions.printStackTrace(ex); } - - } @Override