modifying message view based on talks with Brian

This commit is contained in:
Kelly Kelly
2019-06-13 14:31:12 -04:00
parent 49772123f8
commit d60052f281
13 changed files with 194 additions and 254 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

@@ -15,11 +15,9 @@ ThreadRootMessagePanel.showAllCheckBox.text=Show All Messages
ThreadPane.backButton.text=<---
SummaryViewer.caseReferencesPanel.border.title=Other Occurrences
SummaryViewer.fileReferencesPanel.border.title=File References in Current Case
MessageViewer.threadsLabel.text=Threads
MessageViewer.threadsLabel.text=Select a Thread to View
MessageViewer.threadNameLabel.text=<threadName>
MessageViewer.showingMessagesLabel.text=Showing Messages for Thread:
MessageViewer.messagesLabel.text=Messages
MessageViewer.backButton.AccessibleContext.accessibleDescription=
MessageViewer.backButton.text=
MessageViewer.showMessagesButton.text=
MessageViewer.viewMessageLabel.text=View Messages:
MessageViewer.backButton.text=Threads
MessageViewer.showAllButton.text=All Messages
@@ -19,7 +19,8 @@ MessageNode_Node_Property_Subject=Subject
MessageNode_Node_Property_To=To
MessageNode_Node_Property_Type=Type
MessageViewer_columnHeader_Attms=Attachments
MessageViewer_columnHeader_Date=Date
MessageViewer_columnHeader_Date=Data
MessageViewer_columnHeader_EarlyDate=Earliest Message
MessageViewer_columnHeader_From=From
MessageViewer_columnHeader_Subject=Subject
MessageViewer_columnHeader_To=To
@@ -50,11 +51,9 @@ ThreadRootMessagePanel.showAllCheckBox.text=Show All Messages
ThreadPane.backButton.text=<---
SummaryViewer.caseReferencesPanel.border.title=Other Occurrences
SummaryViewer.fileReferencesPanel.border.title=File References in Current Case
MessageViewer.threadsLabel.text=Threads
MessageViewer.threadsLabel.text=Select a Thread to View
MessageViewer.threadNameLabel.text=<threadName>
MessageViewer.showingMessagesLabel.text=Showing Messages for Thread:
MessageViewer.messagesLabel.text=Messages
MessageViewer.backButton.AccessibleContext.accessibleDescription=
MessageViewer.backButton.text=
MessageViewer.showMessagesButton.text=
MessageViewer.viewMessageLabel.text=View Messages:
MessageViewer.backButton.text=Threads
MessageViewer.showAllButton.text=All Messages
@@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils;
import org.openide.nodes.Sheet;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
import org.sleuthkit.autopsy.datamodel.NodeProperty;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
@@ -41,6 +40,7 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.TSK_BLACKBOARD_ATTRIBU
import org.sleuthkit.datamodel.TimeUtilities;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.autopsy.communications.Utils;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
/**
* Wraps a BlackboardArtifact as an AbstractNode for use in an OutlookView
@@ -86,8 +86,8 @@ class MessageNode extends BlackboardArtifactNode {
}
sheetSet.put(new NodeProperty<>("Type", Bundle.MessageNode_Node_Property_Type(), "", getDisplayName())); //NON-NLS
final BlackboardArtifact artifact = getArtifact();
BlackboardArtifact artifact = this.getArtifact();
BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
if (null != fromID) {
@@ -28,71 +28,44 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Component class="org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel" name="rootTablePane">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="4" gridWidth="4" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="15" insetsBottom="15" insetsRight="15" anchor="18" weightX="0.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="threadsLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="24" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/relationships/Bundle.properties" key="MessageViewer.threadsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="3" fill="2" ipadX="0" ipadY="0" insetsTop="15" insetsLeft="15" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="15" insetsLeft="15" insetsBottom="9" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="viewMessageComboBox">
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="viewMessageComboBoxActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;VIEW_MESSAGE_TYPE&gt;"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="4" fill="0" ipadX="0" ipadY="0" insetsTop="15" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="viewMessageLabel">
<Component class="javax.swing.JButton" name="showAllButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/relationships/Bundle.properties" key="MessageViewer.viewMessageLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/communications/relationships/Bundle.properties" key="MessageViewer.showAllButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showAllButtonActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="2" fill="0" ipadX="0" ipadY="0" insetsTop="15" insetsLeft="0" insetsBottom="0" insetsRight="5" anchor="13" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="15" insetsBottom="15" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="showMessagesButton">
<Component class="org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel" name="rootTablePane">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/timeline/images/btn_step_forward.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/relationships/Bundle.properties" key="MessageViewer.showMessagesButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showMessagesButtonActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="15" insetsLeft="5" insetsBottom="0" insetsRight="15" anchor="18" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="1" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="15" insetsBottom="9" insetsRight="15" anchor="18" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
@@ -113,22 +86,18 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="3" gridWidth="5" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="15" insetsBottom="0" insetsRight="15" anchor="18" weightX="1.0" weightY="1.0"/>
<GridBagConstraints gridX="0" gridY="3" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="15" insetsBottom="0" insetsRight="15" anchor="18" weightX="1.0" weightY="1.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="backButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/timeline/images/btn_step_back.png"/>
<Image iconType="3" name="/org/sleuthkit/autopsy/timeline/images/arrow-180.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/relationships/Bundle.properties" key="MessageViewer.backButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="borderPainted" type="boolean" value="false"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@@ -140,22 +109,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="16" insetsLeft="15" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="messagesLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="24" style="0"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/relationships/Bundle.properties" key="MessageViewer.messagesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="1" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="15" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="9" insetsLeft="0" insetsBottom="9" insetsRight="15" anchor="13" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -167,7 +121,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="2" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="15" insetsBottom="5" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="9" insetsLeft="15" insetsBottom="5" insetsRight="0" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -179,7 +133,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="5" insetsRight="15" anchor="18" weightX="1.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="9" insetsLeft="5" insetsBottom="5" insetsRight="15" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@@ -24,11 +24,13 @@ import java.awt.KeyboardFocusManager;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.logging.Level;
import javax.swing.AbstractAction;
import javax.swing.JPanel;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import static javax.swing.SwingUtilities.isDescendingFrom;
import org.netbeans.swing.outline.DefaultOutlineModel;
@@ -40,6 +42,7 @@ import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.nodes.Node.Property;
import org.openide.nodes.Node.PropertySet;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.communications.ModifiableProxyLookup;
@@ -47,12 +50,11 @@ import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
/**
*
*
*/
public class MessageViewer extends JPanel implements RelationshipsViewer{
public class MessageViewer extends JPanel implements RelationshipsViewer {
private static final Logger logger = Logger.getLogger(MessageViewer.class.getName());
@@ -64,27 +66,25 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
private SelectionInfo currentSelectionInfo = null;
OutlineViewPanel currentPanel;
@Messages({
"MessageViewer_tabTitle=Messages",
"MessageViewer_columnHeader_From=From",
"MessageViewer_columnHeader_Date=Data",
"MessageViewer_columnHeader_To=To",
"MessageViewer_columnHeader_Date=Date",
"MessageViewer_columnHeader_EarlyDate=Earliest Message",
"MessageViewer_columnHeader_Subject=Subject",
"MessageViewer_columnHeader_Attms=Attachments",
"MessageViewer_no_messages=<No messages found for selected account>",
"MessageViewer_viewMessage_all=All",
"MessageViewer_viewMessage_selected=Selected",
"MessageViewer_viewMessage_unthreaded=Unthreaded",
})
"MessageViewer_viewMessage_unthreaded=Unthreaded",})
/**
* Creates new form MessageViewer2
*/
public MessageViewer() {
initComponents();
currentPanel = rootTablePane;
proxyLookup = new ModifiableProxyLookup(createLookup(rootTablePane.getExplorerManager(), getActionMap()));
@@ -108,7 +108,6 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
}
};
rootTablePane.getExplorerManager().setRootContext(
new TableFilterNode(
new DataResultFilterNode(
@@ -119,40 +118,27 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
Outline outline = rootTablePane.getOutlineView().getOutline();
rootTablePane.getOutlineView().setPropertyColumns(
"From", Bundle.MessageViewer_columnHeader_From(),
"To", Bundle.MessageViewer_columnHeader_To(),
"Date", Bundle.MessageViewer_columnHeader_Date(),
"Subject", Bundle.MessageViewer_columnHeader_Subject(),
"Attms", Bundle.MessageViewer_columnHeader_Attms()
"Date", Bundle.MessageViewer_columnHeader_EarlyDate(),
"Subject", Bundle.MessageViewer_columnHeader_Subject()
);
outline.setRootVisible(false);
((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel("Type");
outline.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
rootTablePane.getExplorerManager().addPropertyChangeListener((PropertyChangeEvent evt) -> {
if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
final Node[] nodes = rootTablePane.getExplorerManager().getSelectedNodes();
switch((VIEW_MESSAGE_TYPE)viewMessageComboBox.getSelectedItem()) {
case ALL:
showMessagesButton.setEnabled((nodes != null && nodes.length > 0));
break;
case SELECTED:
showMessagesButton.setEnabled((nodes != null && nodes.length == 1));
break;
}
showSelectedThread();
}
});
threadMessagesPanel.setChildFactory(threadMessageNodeFactory);
this.viewMessageComboBox.addItem(VIEW_MESSAGE_TYPE.SELECTED);
this.viewMessageComboBox.addItem(VIEW_MESSAGE_TYPE.ALL);
rootTablePane.setTableColumnsWidth(10, 20, 70);
}
@Override
public String getDisplayName() {
return Bundle.MessageViewer_tabTitle();
return Bundle.MessageViewer_tabTitle();
}
@Override
@@ -191,31 +177,16 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.removePropertyChangeListener("focusOwner", focusPropertyListener);
}
private void showMessages() {
VIEW_MESSAGE_TYPE viewType = (VIEW_MESSAGE_TYPE)viewMessageComboBox.getSelectedItem();
switch((VIEW_MESSAGE_TYPE)viewMessageComboBox.getSelectedItem()){
case ALL:
threadMessageNodeFactory.refresh(currentSelectionInfo, null);
threadNameLabel.setText("All Messages");
((CardLayout)getLayout()).show(this, "messages");
break;
case SELECTED:
showSelectedThread();
break;
}
}
@SuppressWarnings("rawtypes")
private void showSelectedThread() {
final Node[] nodes = rootTablePane.getExplorerManager().getSelectedNodes();
if(nodes == null) {
if (nodes == null) {
return;
}
if(nodes.length == 0 || nodes.length > 1) {
if (nodes.length == 0 || nodes.length > 1) {
return;
}
@@ -223,19 +194,19 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
String subject = "";
PropertySet[] propertySets = nodes[0].getPropertySets();
for(PropertySet pset: propertySets) {
for (PropertySet pset : propertySets) {
Property[] properties = pset.getProperties();
for(Property prop: properties) {
if(prop.getName().equalsIgnoreCase("threadid")){
for (Property prop : properties) {
if (prop.getName().equalsIgnoreCase("threadid")) {
try {
String threadID = prop.getValue().toString();
if(!threadIDList.contains(threadID)){
if (!threadIDList.contains(threadID)) {
threadIDList.add(threadID);
}
} catch (IllegalAccessException | InvocationTargetException ex) {
logger.log(Level.WARNING, String.format("Unable to get threadid for node: %s", nodes[0].getDisplayName()), ex);
}
} else if(prop.getName().equalsIgnoreCase("subject")) {
} else if (prop.getName().equalsIgnoreCase("subject")) {
try {
subject = prop.getValue().toString();
} catch (IllegalAccessException | InvocationTargetException ex) {
@@ -247,17 +218,34 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
}
if(!threadIDList.isEmpty()) {
if (!threadIDList.isEmpty()) {
threadMessageNodeFactory.refresh(currentSelectionInfo, threadIDList);
if(!subject.isEmpty()){
if (!subject.isEmpty()) {
threadNameLabel.setText(subject);
}
// Come back and put involk later for safety.
CardLayout layout = (CardLayout)getLayout();
layout.show(this, "messages");
showMessagesPane();
}
}
private void showThreadsPane() {
switchCard("threads");
}
private void showMessagesPane() {
switchCard("messages");
}
private void switchCard(String cardName) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
CardLayout layout = (CardLayout)getLayout();
layout.show(MessageViewer.this, cardName);
}
});
}
/**
* This method is called from within the constructor to initialize the form.
@@ -270,15 +258,12 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
java.awt.GridBagConstraints gridBagConstraints;
rootMessagesPane = new javax.swing.JPanel();
rootTablePane = new org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel();
threadsLabel = new javax.swing.JLabel();
viewMessageComboBox = new javax.swing.JComboBox<>();
viewMessageLabel = new javax.swing.JLabel();
showMessagesButton = new javax.swing.JButton();
showAllButton = new javax.swing.JButton();
rootTablePane = new org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel();
messagePanel = new javax.swing.JPanel();
threadMessagesPanel = new MessagesPanel();
backButton = new javax.swing.JButton();
messagesLabel = new javax.swing.JLabel();
showingMessagesLabel = new javax.swing.JLabel();
threadNameLabel = new javax.swing.JLabel();
@@ -286,64 +271,41 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
rootMessagesPane.setOpaque(false);
rootMessagesPane.setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.gridwidth = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 15, 15, 15);
rootMessagesPane.add(rootTablePane, gridBagConstraints);
threadsLabel.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(threadsLabel, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.threadsLabel.text")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(15, 15, 0, 0);
gridBagConstraints.insets = new java.awt.Insets(15, 15, 9, 0);
rootMessagesPane.add(threadsLabel, gridBagConstraints);
viewMessageComboBox.addActionListener(new java.awt.event.ActionListener() {
org.openide.awt.Mnemonics.setLocalizedText(showAllButton, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.showAllButton.text")); // NOI18N
showAllButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
viewMessageComboBoxActionPerformed(evt);
showAllButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(15, 0, 0, 0);
rootMessagesPane.add(viewMessageComboBox, gridBagConstraints);
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 15, 15, 0);
rootMessagesPane.add(showAllButton, gridBagConstraints);
org.openide.awt.Mnemonics.setLocalizedText(viewMessageLabel, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.viewMessageLabel.text")); // NOI18N
rootTablePane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(15, 0, 0, 5);
rootMessagesPane.add(viewMessageLabel, gridBagConstraints);
showMessagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/timeline/images/btn_step_forward.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(showMessagesButton, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.showMessagesButton.text")); // NOI18N
showMessagesButton.setBorder(null);
showMessagesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
showMessagesButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(15, 5, 0, 15);
rootMessagesPane.add(showMessagesButton, gridBagConstraints);
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 15, 9, 15);
rootMessagesPane.add(rootTablePane, gridBagConstraints);
add(rootMessagesPane, "threads");
@@ -351,7 +313,7 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 5;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
@@ -359,102 +321,74 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
gridBagConstraints.insets = new java.awt.Insets(0, 15, 0, 15);
messagePanel.add(threadMessagesPanel, gridBagConstraints);
backButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/timeline/images/btn_step_back.png"))); // NOI18N
backButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/timeline/images/arrow-180.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(backButton, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.backButton.text")); // NOI18N
backButton.setBorder(null);
backButton.setBorderPainted(false);
backButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(16, 15, 0, 0);
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(9, 0, 9, 15);
messagePanel.add(backButton, gridBagConstraints);
backButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.backButton.AccessibleContext.accessibleDescription")); // NOI18N
messagesLabel.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(messagesLabel, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.messagesLabel.text")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(5, 15, 0, 0);
messagePanel.add(messagesLabel, gridBagConstraints);
org.openide.awt.Mnemonics.setLocalizedText(showingMessagesLabel, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.showingMessagesLabel.text")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(5, 15, 5, 0);
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(9, 15, 5, 0);
messagePanel.add(showingMessagesLabel, gridBagConstraints);
org.openide.awt.Mnemonics.setLocalizedText(threadNameLabel, org.openide.util.NbBundle.getMessage(MessageViewer.class, "MessageViewer.threadNameLabel.text")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 15);
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(9, 5, 5, 15);
messagePanel.add(threadNameLabel, gridBagConstraints);
add(messagePanel, "messages");
}// </editor-fold>//GEN-END:initComponents
private void backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backButtonActionPerformed
CardLayout layout = (CardLayout) this.getLayout();
layout.show(this, "threads");
try {
rootTablePane.getExplorerManager().setSelectedNodes(new Node[0]);
} catch (PropertyVetoException ex) {
Exceptions.printStackTrace(ex);
}
showThreadsPane();
}//GEN-LAST:event_backButtonActionPerformed
private void showMessagesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showMessagesButtonActionPerformed
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
showMessages();
}
});
}//GEN-LAST:event_showMessagesButtonActionPerformed
private void viewMessageComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewMessageComboBoxActionPerformed
boolean accountSelected = (currentSelectionInfo != null && currentSelectionInfo.getAccounts() != null && !currentSelectionInfo.getAccounts().isEmpty());
switch((VIEW_MESSAGE_TYPE)viewMessageComboBox.getSelectedItem()) {
case ALL:
showMessagesButton.setEnabled(accountSelected);
break;
case SELECTED:
Node[] selected = rootTablePane.getExplorerManager().getSelectedNodes();
showMessagesButton.setEnabled(selected != null && selected.length == 1);
break;
}
}//GEN-LAST:event_viewMessageComboBoxActionPerformed
private void showAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showAllButtonActionPerformed
threadMessageNodeFactory.refresh(currentSelectionInfo, null);
threadNameLabel.setText("All Messages");
showMessagesPane();
}//GEN-LAST:event_showAllButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton backButton;
private javax.swing.JPanel messagePanel;
private javax.swing.JLabel messagesLabel;
private javax.swing.JPanel rootMessagesPane;
private org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel rootTablePane;
private javax.swing.JButton showMessagesButton;
private javax.swing.JButton showAllButton;
private javax.swing.JLabel showingMessagesLabel;
private org.sleuthkit.autopsy.communications.relationships.MessagesPanel threadMessagesPanel;
private javax.swing.JLabel threadNameLabel;
private javax.swing.JLabel threadsLabel;
private javax.swing.JComboBox<VIEW_MESSAGE_TYPE> viewMessageComboBox;
private javax.swing.JLabel viewMessageLabel;
// End of variables declaration//GEN-END:variables
class ShowThreadMessagesAction extends AbstractAction {
@Override
public void actionPerformed(ActionEvent e) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
@@ -463,19 +397,4 @@ public class MessageViewer extends JPanel implements RelationshipsViewer{
});
}
}
private enum VIEW_MESSAGE_TYPE{
ALL(Bundle.MessageViewer_viewMessage_all()),
SELECTED(Bundle.MessageViewer_viewMessage_selected());
private final String displayLabel;
VIEW_MESSAGE_TYPE(String label) {
displayLabel = label;
}
@Override
public String toString() {
return displayLabel;
}
}
}
@@ -100,7 +100,7 @@ public class MessagesPanel extends javax.swing.JPanel implements Lookup.Provider
splitPane.setResizeWeight(0.5);
splitPane.setDividerLocation(0.5);
outlineViewPanel.setTableColumnsWidth(5,10,10,15,50,10);
}
public MessagesPanel(ChildFactory<?> nodeFactory) {
@@ -19,7 +19,9 @@
package org.sleuthkit.autopsy.communications.relationships;
import java.awt.CardLayout;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.TableColumn;
import org.openide.explorer.ExplorerManager;
import static org.openide.explorer.ExplorerUtils.createLookup;
import org.openide.explorer.view.OutlineView;
@@ -98,6 +100,28 @@ public class OutlineViewPanel extends javax.swing.JPanel implements ExplorerMana
super.setEnabled(enabled);
outlineView.setEnabled(enabled);
}
/**
* Sets the width of the columns of the OutlineView based on the passed in
* list of percentages. There should be on double value for each column
* in the OutlineView.
*
* @param percentages A series of double percentages values representing
* what percent of the total width of the table each
* column should have.
*/
public void setTableColumnsWidth(double... percentages) {
JTable table = outlineView.getOutline();
double total = 0;
for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
total += percentages[i];
}
for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
TableColumn column = table.getColumnModel().getColumn(i);
column.setPreferredWidth((int) (table.getPreferredSize().width * (percentages[i] / total)));
}
}
/**
* This method is called from within the constructor to initialize the form.
@@ -171,7 +171,7 @@ final class ThreadChildNodeFactory extends ChildFactory<BlackboardArtifact> {
}
if (attribute != null) {
return new MessageNode(bba, attribute.getValueString(), preferredAction);
return new ThreadNode(bba, attribute.getValueString());
} else {
// Only one of these should occur.
return new UnthreadedNode();
@@ -0,0 +1,46 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.sleuthkit.autopsy.communications.relationships;
import javax.swing.Action;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Sheet;
import org.sleuthkit.datamodel.BlackboardArtifact;
/**
*
* @author kelly
*/
final class ThreadNode extends AbstractNode{
final private MessageNode messageNode;
ThreadNode(BlackboardArtifact artifact, String threadID) {
super(Children.LEAF);
messageNode = new MessageNode(artifact, threadID, null);
this.setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/threaded.png" );
}
@Override
protected Sheet createSheet() {
return messageNode.createSheet();
}
String getThreadID() {
return messageNode.getThreadID();
}
@Override
public Action getPreferredAction() {
return messageNode.getPreferredAction();
}
@Override
public String getDisplayName() {
return messageNode.getDisplayName();
}
}