Merge branch 'master' of https://github.com/tmciver-basis/autopsy into zipmodule

This commit is contained in:
adam-m 2013-02-11 13:58:29 -05:00
commit 1777ad28bd
4 changed files with 192 additions and 7 deletions

View File

@ -1,2 +1,3 @@
OpenIDE-Module-Name=Timeline OpenIDE-Module-Name=Timeline
CTL_MakeTimeline="Make Timeline (Beta)" CTL_MakeTimeline="Make Timeline (Beta)"
TimelineProgressDialog.jLabel1.text=Computing timeline . . .

View File

@ -68,6 +68,7 @@ import javax.swing.BoxLayout;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandle;
import org.netbeans.api.progress.ProgressHandleFactory; import org.netbeans.api.progress.ProgressHandleFactory;
@ -137,6 +138,7 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
private List<YearEpoch> data; private List<YearEpoch> data;
private boolean listeningToAddImage = false; private boolean listeningToAddImage = false;
private long lastObjectId = -1; private long lastObjectId = -1;
private TimelineProgressDialog dialog;
//Swing components and JavafX components don't play super well together //Swing components and JavafX components don't play super well together
//Swing components need to be initialized first, in the swing specific thread //Swing components need to be initialized first, in the swing specific thread
@ -174,8 +176,10 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
//ComboJPanel holds both of the above JPanels together, //ComboJPanel holds both of the above JPanels together,
//aligned vertically (Y_AXIS) //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 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. //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.
@ -288,17 +292,19 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
viewerJPanel.add(dataContentPanel); viewerJPanel.add(dataContentPanel);
chartJPanel.setAlignmentX(Component.LEFT_ALIGNMENT); chartJPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
viewerJPanel.setAlignmentX(Component.LEFT_ALIGNMENT); viewerJPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
comboJPanel.add(chartJPanel);
comboJPanel.add(viewerJPanel);
chart_TopLevel = createYearChartWithDrill(data); chart_TopLevel = createYearChartWithDrill(data);
chart_Events = chart_TopLevel; chart_Events = chart_TopLevel;
scroll_Events.setContent(chart_Events); scroll_Events.setContent(chart_Events);
jf.add(comboJPanel);
jf.add(splitPane);
jf.setVisible(true); jf.setVisible(true);
} finally { } finally {
// stop the progress bar // stop the progress bar
progress.finish(); progress.finish();
// close the dialog
dialog.doClose(0);
} }
} }
}); });
@ -966,6 +972,11 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
} else { } else {
logger.log(Level.INFO, "Beginning generation of timeline"); 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); Platform.setImplicitExit(false);
// listen for case changes (specifically images being added). // listen for case changes (specifically images being added).
@ -975,6 +986,15 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
listeningToAddImage = true; listeningToAddImage = true;
} }
// create the modal dialog
SwingUtilities.invokeLater(new Runnable () {
@Override
public void run() {
dialog = new TimelineProgressDialog(jf, true);
dialog.setVisible(true);
}
});
// initialize mactimeFileName // initialize mactimeFileName
mactimeFileName = Case.getCurrentCase().getName() + "-MACTIME.txt"; mactimeFileName = Case.getCurrentCase().getName() + "-MACTIME.txt";
@ -992,8 +1012,6 @@ public class Simile2 extends CallableSystemAction implements Presenter.Toolbar,
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
Exceptions.printStackTrace(ex); Exceptions.printStackTrace(ex);
} }
} }
@Override @Override

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="closeDialog"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="51" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="121" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="37" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="64" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/timeline/Bundle.properties" key="TimelineProgressDialog.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@ -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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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();
}// </editor-fold>//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;
}