From b6b9783a63497a1a6c1398a22fb4cdd3a90e00ac Mon Sep 17 00:00:00 2001 From: millmanorama Date: Fri, 27 Oct 2017 13:39:18 +0200 Subject: [PATCH 01/10] begin hookup of ResultPanel in CVT --- .../autopsy/communications/Bundle.properties | 2 - .../communications/CVTTopComponent.form | 45 +------------- .../communications/CVTTopComponent.java | 40 ++++++------- .../communications/MessageBrowser.form | 44 ++++++++++++++ .../communications/MessageBrowser.java | 58 +++++++++++++++++++ .../corecomponents/DataResultPanel.java | 23 ++------ .../corecomponents/DataResultViewerTable.java | 2 +- 7 files changed, 129 insertions(+), 85 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form create mode 100644 Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java diff --git a/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties b/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties index 99621e3e12..9e5cf923e1 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties @@ -1,5 +1,3 @@ -CVTTopComponent.jTextField1.text=place holder for messages ,thumbnail list, etc -CVTTopComponent.jTextField2.text=place holder for message viewer CVTTopComponent.TabConstraints.tabTitle=Visualize CVTTopComponent.accountsBrowser.TabConstraints.tabTitle=Browse FiltersPanel.applyFiltersButton.text=Apply Filters diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form index 09ebfc73f0..82be39bf3d 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form @@ -20,7 +20,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -106,45 +106,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java index c4b5721911..5bc19cf2fe 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.communications; +import java.beans.PropertyChangeEvent; import java.util.List; import java.util.stream.Collectors; import org.openide.explorer.ExplorerManager; @@ -44,10 +45,20 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag @ThreadConfined(type = ThreadConfined.ThreadType.AWT) private final ExplorerManager em = new ExplorerManager(); + private final ExplorerManager messageExplorerManager; public CVTTopComponent() { initComponents(); setName(Bundle.CVTTopComponent_name()); + messageExplorerManager = new ExplorerManager(); + splitPane.setRightComponent(new MessageBrowser(messageExplorerManager)); + + em.addPropertyChangeListener((PropertyChangeEvent evt) -> { + if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { + + messageExplorerManager.setRootContext(em.getSelectedNodes()[0]); + } + }); } /** @@ -58,16 +69,13 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag // //GEN-BEGIN:initComponents private void initComponents() { - HSplitPane = new javax.swing.JSplitPane(); + splitPane = new javax.swing.JSplitPane(); BrowseVisualizeTabPane = new javax.swing.JTabbedPane(); accountsBrowser = new org.sleuthkit.autopsy.communications.AccountsBrowser(); jPanel1 = new javax.swing.JPanel(); - VSplitPane = new javax.swing.JSplitPane(); - jTextField1 = new javax.swing.JTextField(); - jTextField2 = new javax.swing.JTextField(); filtersPane = new org.sleuthkit.autopsy.communications.FiltersPanel(); - HSplitPane.setDividerLocation(600); + splitPane.setDividerLocation(600); BrowseVisualizeTabPane.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N BrowseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.accountsBrowser.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/table.png")), accountsBrowser); // NOI18N @@ -87,18 +95,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag BrowseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/emblem-web.png")), jPanel1); // NOI18N - HSplitPane.setLeftComponent(BrowseVisualizeTabPane); - - VSplitPane.setDividerLocation(200); - VSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); - - jTextField1.setText(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.jTextField1.text")); // NOI18N - VSplitPane.setTopComponent(jTextField1); - - jTextField2.setText(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.jTextField2.text")); // NOI18N - VSplitPane.setRightComponent(jTextField2); - - HSplitPane.setRightComponent(VSplitPane); + splitPane.setLeftComponent(BrowseVisualizeTabPane); filtersPane.setBorder(javax.swing.BorderFactory.createEtchedBorder()); filtersPane.setMinimumSize(new java.awt.Dimension(256, 495)); @@ -111,7 +108,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag .addContainerGap() .addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(HSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1322, Short.MAX_VALUE) + .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1322, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( @@ -120,7 +117,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(filtersPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(HSplitPane)) + .addComponent(splitPane)) .addContainerGap()) ); }// //GEN-END:initComponents @@ -128,13 +125,10 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTabbedPane BrowseVisualizeTabPane; - private javax.swing.JSplitPane HSplitPane; - private javax.swing.JSplitPane VSplitPane; private org.sleuthkit.autopsy.communications.AccountsBrowser accountsBrowser; private org.sleuthkit.autopsy.communications.FiltersPanel filtersPane; private javax.swing.JPanel jPanel1; - private javax.swing.JTextField jTextField1; - private javax.swing.JTextField jTextField2; + private javax.swing.JSplitPane splitPane; // End of variables declaration//GEN-END:variables @Override diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form new file mode 100644 index 0000000000..148bd68314 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form @@ -0,0 +1,44 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java new file mode 100644 index 0000000000..1f6abece25 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -0,0 +1,58 @@ +/* + * 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; + +import org.openide.explorer.ExplorerManager; + +final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager.Provider { + + private final ExplorerManager em; + + MessageBrowser(ExplorerManager em) { + this.em = em; + +splitPane } + + /** + * 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() { + + splitPane = new javax.swing.JSplitPane(); + + splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, 0) + .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, 0) + .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE) + .addGap(0, 0, 0)) + ); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JSplitPane splitPane; + // End of variables declaration//GEN-END:variables + + @Override + public ExplorerManager getExplorerManager() { + return em; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java index 34397cf960..e5252e035b 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultPanel.java @@ -22,6 +22,7 @@ import java.awt.Cursor; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; @@ -260,11 +261,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C */ @Override public List getViewers() { - List viewers = new ArrayList<>(); - resultViewers.forEach((viewer) -> { - viewers.add(viewer); - }); - return viewers; + return Collections.unmodifiableList(resultViewers); } /** @@ -397,9 +394,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C * @param selectedNodes The nodes to be selected. */ public void setSelectedNodes(Node[] selectedNodes) { - this.resultViewers.forEach((viewer) -> { - viewer.setSelectedNodes(selectedNodes); - }); + this.resultViewers.forEach((viewer) -> viewer.setSelectedNodes(selectedNodes)); } /** @@ -517,14 +512,10 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C explorerManager = null; } - this.resultViewers.forEach((viewer) -> { - viewer.setNode(null); - }); + this.resultViewers.forEach((viewer) -> viewer.setNode(null)); if (!this.isMain) { - this.resultViewers.forEach((viewer) -> { - viewer.clearComponent(); - }); + this.resultViewers.forEach(DataResultViewer::clearComponent); this.directoryTablePath.removeAll(); this.directoryTablePath = null; this.numberMatchLabel.removeAll(); @@ -563,9 +554,7 @@ public class DataResultPanel extends javax.swing.JPanel implements DataResult, C * Pass the selected nodes to all of the result viewers * sharing this explorer manager. */ - resultViewers.forEach((viewer) -> { - viewer.setSelectedNodes(selectedNodes); - }); + resultViewers.forEach((viewer) -> viewer.setSelectedNodes(selectedNodes)); /* * Passing null signals that either multiple nodes are diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java index e922e74c4f..c09ebc92f3 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java @@ -764,7 +764,7 @@ public class DataResultViewerTable extends AbstractDataResultViewer { Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); // only override the color if a node is not selected - if (!isSelected) { + if (currentRoot != null && !isSelected) { Node node = currentRoot.getChildren().getNodeAt(table.convertRowIndexToModel(row)); boolean tagFound = false; if (node != null) { From dd948ea878c5fe97d5fed8453d07a7ac10a5ce9e Mon Sep 17 00:00:00 2001 From: millmanorama Date: Mon, 30 Oct 2017 15:26:21 +0100 Subject: [PATCH 02/10] initial commit wiring up MessageBrowser --- .../communications/AccountDetailsNode.java | 84 ++++++++++++++++++ .../AccountDeviceInstanceNode.java | 10 ++- .../AccountDeviceInstancesNodeChildren.java | 63 -------------- .../AccountsDeviceInstanceChildren.java | 7 +- .../communications/CVTTopComponent.java | 13 +-- .../autopsy/communications/FiltersPanel.java | 4 +- .../communications/MessageBrowser.java | 85 +++++++++++++++++-- .../RelationShipFilterNode.java | 33 +++++++ 8 files changed, 209 insertions(+), 90 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java delete mode 100644 Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstancesNodeChildren.java create mode 100644 Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java new file mode 100644 index 0000000000..8935864d0b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java @@ -0,0 +1,84 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 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.communications; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.openide.nodes.FilterNode; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; +import org.sleuthkit.datamodel.Account; +import org.sleuthkit.datamodel.AccountDeviceInstance; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.CommunicationsManager; +import org.sleuthkit.datamodel.TskCoreException; + +class AccountDetailsNode extends FilterNode { + + /** + * @param wrappedNode the value of selectedNode + */ + AccountDetailsNode(AccountDeviceInstanceNode wrappedNode) throws TskCoreException { + super(wrappedNode, new AccountRelationshipChildren(wrappedNode)); + } + + /** + * Children object for the relationships that the account is a member of. + */ + private static class AccountRelationshipChildren extends Children.Keys { + + private final AccountDeviceInstanceNode wrappedNode; + + private AccountRelationshipChildren(AccountDeviceInstanceNode wrappedNode) { + this.wrappedNode = wrappedNode; + } + + @Override + protected Node[] createNodes(BlackboardArtifact t) { + + final RelationShipFilterNode blackboardArtifactNode = new RelationShipFilterNode(new BlackboardArtifactNode(t)); + return new Node[]{blackboardArtifactNode}; + } + + @Override + protected void addNotify() { + try { + AccountDeviceInstance adi = wrappedNode.getLookup().lookup(AccountDeviceInstance.class); + CommunicationsManager communicationsManager = wrappedNode.getLookup().lookup(CommunicationsManager.class); + List accountsWithRelationship = communicationsManager.getAccountsWithRelationship(adi.getAccount()); + Set keys = new HashSet<>(); + + accountsWithRelationship.forEach(account -> { + try { + keys.addAll(communicationsManager.getRelationships(adi.getAccount(), account)); + } catch (TskCoreException ex) { + Exceptions.printStackTrace(ex); + } + }); + + setKeys(keys); + } catch (TskCoreException ex) { + //TODO: proper logging + Exceptions.printStackTrace(ex); + } + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java index 721adcc300..4abd3b84d3 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java @@ -25,10 +25,10 @@ import org.openide.nodes.Children; import org.openide.nodes.Sheet; import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.datamodel.NodeProperty; import org.sleuthkit.datamodel.AccountDeviceInstance; import org.sleuthkit.datamodel.CommunicationsFilter; +import org.sleuthkit.datamodel.CommunicationsManager; import org.sleuthkit.datamodel.TskCoreException; /** @@ -38,10 +38,12 @@ class AccountDeviceInstanceNode extends AbstractNode { private static final Logger LOGGER = Logger.getLogger(AccountDeviceInstanceNode.class.getName()); private final AccountDeviceInstance accountDeviceInstance; + private final CommunicationsManager commsManager; - AccountDeviceInstanceNode(AccountDeviceInstance accountDeviceInstance) { - super(Children.LEAF, Lookups.fixed(accountDeviceInstance)); + AccountDeviceInstanceNode(AccountDeviceInstance accountDeviceInstance, CommunicationsManager commsManager) { + super(Children.LEAF, Lookups.fixed(accountDeviceInstance, commsManager)); this.accountDeviceInstance = accountDeviceInstance; + this.commsManager = commsManager; setName(accountDeviceInstance.getAccount().getAccountUniqueID()); setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/" + AccountUtils.getIconFileName(accountDeviceInstance.getAccount().getAccountType())); @@ -67,7 +69,7 @@ class AccountDeviceInstanceNode extends AbstractNode { long msgCount = 0; try { CommunicationsFilter filter = null; - msgCount = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager().getRelationshipsCount(filter, accountDeviceInstance); + msgCount = commsManager.getRelationshipsCount(filter, accountDeviceInstance); } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "Failed to get message count for account", ex); //NON-NLS } diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstancesNodeChildren.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstancesNodeChildren.java deleted file mode 100644 index 03c28c4c13..0000000000 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstancesNodeChildren.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2017 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.communications; - -import java.util.Collections; -import java.util.List; -import org.openide.nodes.Children; -import org.openide.nodes.Node; -import org.sleuthkit.datamodel.AccountDeviceInstance; - -class AccountDeviceInstancesNodeChildren extends Children.Keys { - - private final List accountDeviceInstances; - - AccountDeviceInstancesNodeChildren(List accountDeviceInstances) { - super(true); - this.accountDeviceInstances = accountDeviceInstances; - } - - @Override - protected void removeNotify() { - super.removeNotify(); - setKeys(Collections.emptySet()); - } - - @Override - protected void addNotify() { - super.addNotify(); - setKeys(accountDeviceInstances); - } - - //These are the methods for ChildFactory. I am going to keep them around but commented until we make a final descision. - // @Override - // protected boolean createKeys(List list) { - // list.addAll(accounts); - // return true; - // } - // - // @Override - // protected Node createNodeForKey(Account key) { - // return new AccountDeviceInstanceNode(key); - // } - @Override - protected Node[] createNodes(AccountDeviceInstance key) { - return new Node[]{new AccountDeviceInstanceNode(key)}; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java b/Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java index 93856af02b..fe85f9d01d 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java @@ -23,14 +23,17 @@ import java.util.List; import org.openide.nodes.Children; import org.openide.nodes.Node; import org.sleuthkit.datamodel.AccountDeviceInstance; +import org.sleuthkit.datamodel.CommunicationsManager; class AccountsDeviceInstanceChildren extends Children.Keys { private final List accountDeviceInstances; + private final CommunicationsManager commsManager; - AccountsDeviceInstanceChildren(List accountDeviceInstances) { + AccountsDeviceInstanceChildren(List accountDeviceInstances, CommunicationsManager commsManager) { super(true); this.accountDeviceInstances = accountDeviceInstances; + this.commsManager = commsManager; } @Override @@ -58,6 +61,6 @@ class AccountsDeviceInstanceChildren extends Children.Keys { - if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { - - messageExplorerManager.setRootContext(em.getSelectedNodes()[0]); - } - }); + splitPane.setRightComponent(new MessageBrowser()); } /** diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java index 4ed80b63e9..cd40ca445f 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java @@ -33,11 +33,11 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.datamodel.Account; import org.sleuthkit.datamodel.AccountDeviceInstance; +import org.sleuthkit.datamodel.AccountTypeFilter; import org.sleuthkit.datamodel.CommunicationsFilter; import org.sleuthkit.datamodel.CommunicationsManager; import org.sleuthkit.datamodel.DataSource; import org.sleuthkit.datamodel.DeviceFilter; -import org.sleuthkit.datamodel.AccountTypeFilter; import org.sleuthkit.datamodel.TskCoreException; /** @@ -307,7 +307,7 @@ final public class FiltersPanel extends javax.swing.JPanel { final CommunicationsManager communicationsManager = Case.getCurrentCase().getSleuthkitCase().getCommunicationsManager(); accountDeviceInstances.addAll(communicationsManager.getAccountDeviceInstancesWithRelationships(commsFilter)); - em.setRootContext(new AbstractNode(new AccountsDeviceInstanceChildren(accountDeviceInstances))); + em.setRootContext(new AbstractNode(new AccountsDeviceInstanceChildren(accountDeviceInstances, communicationsManager))); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "There was a error loading the accounts.", ex); } diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java index 1f6abece25..9da9dc04ec 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -1,20 +1,89 @@ /* - * 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. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 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 obt ain 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.communications; +import java.beans.PropertyChangeEvent; import org.openide.explorer.ExplorerManager; +import org.openide.nodes.Node; +import org.openide.util.Exceptions; +import org.sleuthkit.autopsy.corecomponents.DataContentPanel; +import org.sleuthkit.autopsy.corecomponents.DataResultPanel; +import org.sleuthkit.autopsy.corecomponents.TableFilterNode; +import org.sleuthkit.datamodel.TskCoreException; +/** + * The right hand side of the CVT. Has a DataResultPanel to show messages and + * account details, and a Content viewer to show individual + */ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager.Provider { - private final ExplorerManager em; + private static final long serialVersionUID = 1L; - MessageBrowser(ExplorerManager em) { - this.em = em; + private ExplorerManager parentExplorereManager; + private final DataContentPanel customContentView; + private final DataResultPanel messagesResultPanel; + private ExplorerManager internalExplorerManager; -splitPane } + MessageBrowser() { + initComponents(); + customContentView = DataContentPanel.createInstance(); + messagesResultPanel = DataResultPanel.createInstanceUninitialized("Account", "", Node.EMPTY, 0, customContentView); + splitPane.setTopComponent(messagesResultPanel); + splitPane.setBottomComponent(customContentView); + + } + + @Override + public void addNotify() { + super.addNotify(); + this.parentExplorereManager = ExplorerManager.find(this); + + internalExplorerManager = new ExplorerManager(); + + parentExplorereManager.addPropertyChangeListener((PropertyChangeEvent evt) -> { + if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { + final Node[] selectedNodes = parentExplorereManager.getSelectedNodes(); + switch (selectedNodes.length) { + case 0: + messagesResultPanel.setNode(null); + break; + case 1: + final Node selectedNode = selectedNodes[0]; + if (selectedNode instanceof AccountDeviceInstanceNode) { + try { + final AccountDetailsNode accountDetailsNode = new AccountDetailsNode((AccountDeviceInstanceNode) selectedNode); + messagesResultPanel.setNode(new TableFilterNode(accountDetailsNode, true)); + } catch (TskCoreException ex) { + Exceptions.printStackTrace(ex); + } + } else { + internalExplorerManager.setRootContext(selectedNode); + } + break; + // TODO: fill in multiseelct support + default: + break; + } + } + }); + messagesResultPanel.open(); + } /** * This method is called from within the constructor to initialize the form. @@ -53,6 +122,6 @@ splitPane } @Override public ExplorerManager getExplorerManager() { - return em; + return internalExplorerManager; } } diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java new file mode 100644 index 0000000000..8b0a7f53d5 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java @@ -0,0 +1,33 @@ +/* + * 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; + +import org.openide.nodes.FilterNode; +import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; + +/** + * + */ +public class RelationShipFilterNode extends FilterNode { + + private final BlackboardArtifactNode wrappedNode; + + public RelationShipFilterNode(BlackboardArtifactNode wrappedNode) { + super(wrappedNode, Children.LEAF); + this.wrappedNode = wrappedNode; + } + + @Override + public PropertySet[] getPropertySets() { + PropertySet[] propertySets = super.getPropertySets(); + for (PropertySet set : propertySets) { + for (Property p : set.getProperties()) { +// p.getName().equals(); + } + } + return propertySets; + } +} From 711a59db072d81fa7553177a8bc216abecb62c66 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Mon, 30 Oct 2017 16:29:33 +0100 Subject: [PATCH 03/10] begin to suppress unneeded columns --- .../RelationShipFilterNode.java | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java index 8b0a7f53d5..b98eb431fd 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java @@ -5,8 +5,13 @@ */ package org.sleuthkit.autopsy.communications; +import java.util.ArrayList; +import java.util.HashSet; import org.openide.nodes.FilterNode; +import org.openide.nodes.Sheet; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; +import org.sleuthkit.autopsy.datamodel.NodeProperty; +import org.sleuthkit.datamodel.BlackboardAttribute; /** * @@ -23,11 +28,39 @@ public class RelationShipFilterNode extends FilterNode { @Override public PropertySet[] getPropertySets() { PropertySet[] propertySets = super.getPropertySets(); + + HashSet suppressedPropertyNames = new HashSet<>(); + suppressedPropertyNames.add("Source File"); + suppressedPropertyNames.add("Data Source"); + suppressedPropertyNames.add("Path"); + suppressedPropertyNames.add("Message (Plaintext)"); + + ArrayList retPropSets = new ArrayList<>(); + boolean first = false; for (PropertySet set : propertySets) { - for (Property p : set.getProperties()) { -// p.getName().equals(); + Sheet.Set set1 = copySet(set); + if (first){ + first = false; + + String valueString = wrappedNode.getArtifact().getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE)).getValueString(); + set1.put(new NodeProperty<>("Type", "Type", "Type", valueString)); } + + for (Property p : set.getProperties()) { + if (false == suppressedPropertyNames.contains(p.getName())) { + set1.put(p); + } + } + retPropSets.add(set1); } - return propertySets; + return retPropSets.toArray(new PropertySet[retPropSets.size()]); + } + + private Sheet.Set copySet(PropertySet set) { + Sheet.Set set1 = new Sheet.Set(); + set1.setName(set.getName()); + set1.setDisplayName(set.getDisplayName()); + set1.setShortDescription(set.getShortDescription()); + return set1; } } From 9df3f3229143aa7656286d244f92be9f1088ff63 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Mon, 30 Oct 2017 16:45:17 +0100 Subject: [PATCH 04/10] suppress Message ID and tags, add relationship Type --- .../communications/RelationShipFilterNode.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java index b98eb431fd..8d08c2e19a 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java @@ -33,17 +33,19 @@ public class RelationShipFilterNode extends FilterNode { suppressedPropertyNames.add("Source File"); suppressedPropertyNames.add("Data Source"); suppressedPropertyNames.add("Path"); + suppressedPropertyNames.add("Message ID"); + suppressedPropertyNames.add("Tags"); suppressedPropertyNames.add("Message (Plaintext)"); ArrayList retPropSets = new ArrayList<>(); - boolean first = false; + boolean first = true; for (PropertySet set : propertySets) { Sheet.Set set1 = copySet(set); - if (first){ + if (first) { first = false; - - String valueString = wrappedNode.getArtifact().getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE)).getValueString(); - set1.put(new NodeProperty<>("Type", "Type", "Type", valueString)); + + final String artifactTypeName = wrappedNode.getArtifact().getArtifactTypeName(); + set1.put(new NodeProperty<>("Type", "Type", "Type", artifactTypeName)); } for (Property p : set.getProperties()) { @@ -55,6 +57,7 @@ public class RelationShipFilterNode extends FilterNode { } return retPropSets.toArray(new PropertySet[retPropSets.size()]); } + private static final BlackboardAttribute.Type MSG_TYPE = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE); private Sheet.Set copySet(PropertySet set) { Sheet.Set set1 = new Sheet.Set(); From 3eae38f53b50b6d27a55a2941c7ec6bc7078ee91 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Tue, 31 Oct 2017 15:21:17 +0100 Subject: [PATCH 05/10] suppress more columns --- .../RelationShipFilterNode.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java index 8d08c2e19a..42e7db75b9 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java @@ -7,6 +7,7 @@ package org.sleuthkit.autopsy.communications; import java.util.ArrayList; import java.util.HashSet; +import org.apache.commons.lang3.StringUtils; import org.openide.nodes.FilterNode; import org.openide.nodes.Sheet; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; @@ -18,24 +19,27 @@ import org.sleuthkit.datamodel.BlackboardAttribute; */ public class RelationShipFilterNode extends FilterNode { - private final BlackboardArtifactNode wrappedNode; public RelationShipFilterNode(BlackboardArtifactNode wrappedNode) { super(wrappedNode, Children.LEAF); - this.wrappedNode = wrappedNode; + setDisplayName( StringUtils.stripEnd(wrappedNode.getArtifact().getDisplayName(),"s")); } @Override public PropertySet[] getPropertySets() { PropertySet[] propertySets = super.getPropertySets(); - HashSet suppressedPropertyNames = new HashSet<>(); - suppressedPropertyNames.add("Source File"); - suppressedPropertyNames.add("Data Source"); - suppressedPropertyNames.add("Path"); - suppressedPropertyNames.add("Message ID"); - suppressedPropertyNames.add("Tags"); - suppressedPropertyNames.add("Message (Plaintext)"); + HashSet propertyNames = new HashSet<>(); + propertyNames.add("Source File"); + propertyNames.add("Data Source"); + propertyNames.add("Path"); + propertyNames.add("Message ID"); + propertyNames.add("Tags"); + propertyNames.add("Text"); + propertyNames.add("Read"); + propertyNames.add("Directon"); + propertyNames.add("Name"); + propertyNames.add("Message (Plaintext)"); ArrayList retPropSets = new ArrayList<>(); boolean first = true; @@ -43,13 +47,11 @@ public class RelationShipFilterNode extends FilterNode { Sheet.Set set1 = copySet(set); if (first) { first = false; - - final String artifactTypeName = wrappedNode.getArtifact().getArtifactTypeName(); - set1.put(new NodeProperty<>("Type", "Type", "Type", artifactTypeName)); + set1.put(new NodeProperty<>("Type", "Type", "Type", getDisplayName())); } for (Property p : set.getProperties()) { - if (false == suppressedPropertyNames.contains(p.getName())) { + if (false == propertyNames.contains(p.getName())) { set1.put(p); } } From 35588f5b134a29ac2438bd76713e838015ebc821 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Tue, 31 Oct 2017 20:48:21 +0100 Subject: [PATCH 06/10] continue wiring up Message Results and Viewer --- .../communications/AccountDetailsNode.java | 62 +++--- .../AccountDeviceInstanceNode.java | 12 ++ .../communications/MessageBrowser.form | 15 +- .../communications/MessageBrowser.java | 64 +++--- .../communications/MessageDataContent.java | 25 +++ .../RelationShipFilterNode.java | 3 +- .../contentviewers/MessageContentViewer.java | 185 ++++++++---------- .../corecomponentinterfaces/DataContent.java | 2 - 8 files changed, 206 insertions(+), 162 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java index 8935864d0b..6452931d2b 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java @@ -18,26 +18,30 @@ */ package org.sleuthkit.autopsy.communications; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.openide.nodes.FilterNode; +import java.util.logging.Level; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; import org.openide.nodes.Node; -import org.openide.util.Exceptions; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.Account; -import org.sleuthkit.datamodel.AccountDeviceInstance; import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.CommunicationsFilter; import org.sleuthkit.datamodel.CommunicationsManager; import org.sleuthkit.datamodel.TskCoreException; -class AccountDetailsNode extends FilterNode { +class AccountDetailsNode extends AbstractNode { - /** - * @param wrappedNode the value of selectedNode - */ - AccountDetailsNode(AccountDeviceInstanceNode wrappedNode) throws TskCoreException { - super(wrappedNode, new AccountRelationshipChildren(wrappedNode)); + private final static Logger logger = Logger.getLogger(AccountDetailsNode.class.getName()); + private final CommunicationsFilter filter; //TODO: Use this + + AccountDetailsNode(Set accounts,CommunicationsFilter filter, CommunicationsManager commsManager) { + super(new AccountRelationshipChildren(accounts, commsManager)); + this.filter = filter; } /** @@ -45,40 +49,40 @@ class AccountDetailsNode extends FilterNode { */ private static class AccountRelationshipChildren extends Children.Keys { - private final AccountDeviceInstanceNode wrappedNode; + private final Set accounts; + private final CommunicationsManager commsManager; - private AccountRelationshipChildren(AccountDeviceInstanceNode wrappedNode) { - this.wrappedNode = wrappedNode; + private AccountRelationshipChildren(Set accounts, CommunicationsManager commsManager) { + this.accounts = accounts; + this.commsManager = commsManager; } @Override - protected Node[] createNodes(BlackboardArtifact t) { - - final RelationShipFilterNode blackboardArtifactNode = new RelationShipFilterNode(new BlackboardArtifactNode(t)); - return new Node[]{blackboardArtifactNode}; + protected Node[] createNodes(BlackboardArtifact key) { + return new Node[]{new RelationShipFilterNode(new BlackboardArtifactNode(key))}; } @Override protected void addNotify() { - try { - AccountDeviceInstance adi = wrappedNode.getLookup().lookup(AccountDeviceInstance.class); - CommunicationsManager communicationsManager = wrappedNode.getLookup().lookup(CommunicationsManager.class); - List accountsWithRelationship = communicationsManager.getAccountsWithRelationship(adi.getAccount()); - Set keys = new HashSet<>(); + Set keys = new HashSet<>(); + for (Account account : accounts) { + List accountsWithRelationship = new ArrayList<>(); + try { + accountsWithRelationship.addAll(commsManager.getAccountsWithRelationship(account)); //TODO: Use filter + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Error loading with relationships to " + account, ex); + } - accountsWithRelationship.forEach(account -> { + accountsWithRelationship.forEach(otherAcount -> { try { - keys.addAll(communicationsManager.getRelationships(adi.getAccount(), account)); + keys.addAll(commsManager.getRelationships(account, otherAcount)); //TODO:Use filter } catch (TskCoreException ex) { - Exceptions.printStackTrace(ex); + logger.log(Level.WARNING, "Error loading relationships between " + account + " and " + otherAcount, ex); } }); - - setKeys(keys); - } catch (TskCoreException ex) { - //TODO: proper logging - Exceptions.printStackTrace(ex); } + setKeys(keys); } } + } diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java index 1627312e34..4c45f647f3 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java @@ -52,6 +52,18 @@ class AccountDeviceInstanceNode extends AbstractNode { + AccountUtils.getIconFileName(accountDeviceInstance.getAccount().getAccountType())); } + public AccountDeviceInstance getAccountDeviceInstance() { + return accountDeviceInstance; + } + + public CommunicationsManager getCommsManager() { + return commsManager; + } + + public CommunicationsFilter getFilter() { + return filter; + } + @Override @NbBundle.Messages({ "AccountNode.device=Device", diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form index 148bd68314..ee473957ee 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form @@ -18,7 +18,7 @@ - + @@ -26,7 +26,7 @@ - + @@ -35,10 +35,21 @@ + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java index 9da9dc04ec..75964a6558 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -18,14 +18,15 @@ */ package org.sleuthkit.autopsy.communications; -import java.beans.PropertyChangeEvent; +import java.util.HashSet; +import java.util.Set; import org.openide.explorer.ExplorerManager; import org.openide.nodes.Node; -import org.openide.util.Exceptions; -import org.sleuthkit.autopsy.corecomponents.DataContentPanel; import org.sleuthkit.autopsy.corecomponents.DataResultPanel; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; -import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.datamodel.Account; +import org.sleuthkit.datamodel.CommunicationsFilter; +import org.sleuthkit.datamodel.CommunicationsManager; /** * The right hand side of the CVT. Has a DataResultPanel to show messages and @@ -36,16 +37,14 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager private static final long serialVersionUID = 1L; private ExplorerManager parentExplorereManager; - private final DataContentPanel customContentView; private final DataResultPanel messagesResultPanel; private ExplorerManager internalExplorerManager; MessageBrowser() { initComponents(); - customContentView = DataContentPanel.createInstance(); - messagesResultPanel = DataResultPanel.createInstanceUninitialized("Account", "", Node.EMPTY, 0, customContentView); + messagesResultPanel = DataResultPanel.createInstanceUninitialized("Account", "", Node.EMPTY, 0, messageDataContent); splitPane.setTopComponent(messagesResultPanel); - splitPane.setBottomComponent(customContentView); + splitPane.setBottomComponent(messageDataContent); } @@ -56,28 +55,34 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager internalExplorerManager = new ExplorerManager(); - parentExplorereManager.addPropertyChangeListener((PropertyChangeEvent evt) -> { - if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { + parentExplorereManager.addPropertyChangeListener(pce -> { + if (pce.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { final Node[] selectedNodes = parentExplorereManager.getSelectedNodes(); switch (selectedNodes.length) { case 0: - messagesResultPanel.setNode(null); + messagesResultPanel.setNode(null); break; - case 1: - final Node selectedNode = selectedNodes[0]; - if (selectedNode instanceof AccountDeviceInstanceNode) { - try { - final AccountDetailsNode accountDetailsNode = new AccountDetailsNode((AccountDeviceInstanceNode) selectedNode); - messagesResultPanel.setNode(new TableFilterNode(accountDetailsNode, true)); - } catch (TskCoreException ex) { - Exceptions.printStackTrace(ex); - } - } else { - internalExplorerManager.setRootContext(selectedNode); - } - break; - // TODO: fill in multiseelct support default: + Set accounts = new HashSet<>(); + CommunicationsFilter filter = null; + CommunicationsManager commsManager = null; + for (Node n : selectedNodes) { + if (n instanceof AccountDeviceInstanceNode) { + final AccountDeviceInstanceNode adiNode = (AccountDeviceInstanceNode) n; + accounts.add(adiNode.getAccountDeviceInstance().getAccount()); + if (commsManager == null) { + commsManager = adiNode.getCommsManager(); + } + if (filter == null) { + filter = adiNode.getFilter(); + } else if (filter != adiNode.getFilter()) { + //different filters ..... exception? + } + } else { + ///this should never happen... + } + } + messagesResultPanel.setNode(new TableFilterNode(new AccountDetailsNode(accounts, filter, commsManager), true)); break; } } @@ -95,8 +100,12 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager private void initComponents() { splitPane = new javax.swing.JSplitPane(); + messageDataContent = new org.sleuthkit.autopsy.communications.MessageDataContent(); + splitPane.setDividerLocation(400); splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); + splitPane.setResizeWeight(0.5); + splitPane.setBottomComponent(messageDataContent); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -104,19 +113,20 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, 0) - .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)) + .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 652, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(0, 0, 0) - .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE) + .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE) .addGap(0, 0, 0)) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables + private org.sleuthkit.autopsy.communications.MessageDataContent messageDataContent; private javax.swing.JSplitPane splitPane; // End of variables declaration//GEN-END:variables diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java b/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java new file mode 100644 index 0000000000..4f432f0b94 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java @@ -0,0 +1,25 @@ +/* + * 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; + +import java.beans.PropertyChangeEvent; +import org.sleuthkit.autopsy.contentviewers.MessageContentViewer; +import org.sleuthkit.autopsy.corecomponentinterfaces.DataContent; + +/** + * Extend MessageContentViewer so that it implements DataContent and can be set + * as the only ContentViewer for a DataResultPanel + */ +public class MessageDataContent extends MessageContentViewer implements DataContent { + + private static final long serialVersionUID = 1L; + + @Override + public void propertyChange(PropertyChangeEvent evt) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java index 42e7db75b9..3420f531c0 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java @@ -37,9 +37,10 @@ public class RelationShipFilterNode extends FilterNode { propertyNames.add("Tags"); propertyNames.add("Text"); propertyNames.add("Read"); - propertyNames.add("Directon"); + propertyNames.add("Direction"); propertyNames.add("Name"); propertyNames.add("Message (Plaintext)"); + propertyNames.add("Message Type"); ArrayList retPropSets = new ArrayList<>(); boolean first = true; diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java index bdd07871fc..17ad5ba3d6 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java @@ -20,6 +20,8 @@ package org.sleuthkit.autopsy.contentviewers; import java.awt.Component; import java.util.logging.Level; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; import org.openide.nodes.Node; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; @@ -28,8 +30,6 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; /** * Shows SMS/MMS/EMail messages @@ -37,16 +37,15 @@ import org.jsoup.nodes.Document; @ServiceProvider(service = DataContentViewer.class, position = 4) public class MessageContentViewer extends javax.swing.JPanel implements DataContentViewer { - private static final Logger LOGGER = Logger.getLogger(MessageContentViewer.class.getName()); - + private static final int HDR_TAB_INDEX = 0; private static final int TEXT_TAB_INDEX = 1; private static final int HTML_TAB_INDEX = 2; private static final int RTF_TAB_INDEX = 3; - + private BlackboardArtifact artifact; // Artifact currently being displayed - + /** * Creates new form MessageContentViewer */ @@ -252,19 +251,18 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont }// //GEN-END:initComponents private void showImagesToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showImagesToggleButtonActionPerformed - + try { BlackboardAttribute attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML)); if (attr != null && !attr.getValueString().isEmpty()) { - + if (showImagesToggleButton.isSelected()) { showImagesToggleButton.setText(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.showImagesToggleButton.hide.text")); - + this.htmlbodyTextPane.setText("" + attr.getValueString() + ""); - } - else { + } else { showImagesToggleButton.setText(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.showImagesToggleButton.text")); - + this.htmlbodyTextPane.setText("" + cleanseHTML(attr.getValueString()) + ""); } } @@ -302,27 +300,30 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont private void customizeComponents() { // do any customizations here - Utilities.configureTextPaneAsHtml(htmlbodyTextPane); - Utilities.configureTextPaneAsRtf(rtfbodyTextPane); - + Utilities.configureTextPaneAsHtml(htmlbodyTextPane); + Utilities.configureTextPaneAsRtf(rtfbodyTextPane); + } - + @Override public void setNode(Node node) { - - artifact = node.getLookup().lookup(BlackboardArtifact.class); - - if (artifact == null) { + + if (node == null) { return; } + artifact = node.getLookup().lookup(BlackboardArtifact.class); + + if (artifact == null) { + return; + } + if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) { displayMsg(); - } - else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) { + } else if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) { displayEmailMsg(); } - + } @Override @@ -352,211 +353,193 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont @Override public boolean isSupported(Node node) { - BlackboardArtifact artifact = node.getLookup().lookup(BlackboardArtifact.class); - return ( (artifact != null) + BlackboardArtifact artifact = node.getLookup().lookup(BlackboardArtifact.class); + return ((artifact != null) && ((artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) || (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()))); } @Override public int isPreferred(Node node) { - - if ( isSupported(node)){ + + if (isSupported(node)) { return 6; } return 0; } - - - private void displayEmailMsg() - { + + private void displayEmailMsg() { directionText.setVisible(false); - + showImagesToggleButton.setVisible(false); showImagesToggleButton.setText("Show Images"); showImagesToggleButton.setSelected(false); - + try { BlackboardAttribute attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM)); this.fromText.setText(attr.getValueString()); - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO)); if (attr != null) { - this.toText.setText(attr.getValueString()); + this.toText.setText(attr.getValueString()); } - - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CC)); if (attr != null && !attr.getValueString().isEmpty()) { this.ccText.setVisible(true); this.ccText.setText(attr.getValueString()); - } - else { + } else { this.ccText.setVisible(false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT)); if (attr != null && !attr.getValueString().isEmpty()) { this.subjectText.setVisible(true); this.subjectText.setText(attr.getValueString()); - } - else { + } else { this.subjectText.setVisible(false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_RCVD)); if (attr != null && !attr.getDisplayString().isEmpty()) { this.datetimeText.setVisible(true); this.datetimeText.setText(attr.getDisplayString()); - } - else { + } else { this.datetimeText.setVisible(false); } - + int selectedTabIndex = -1; attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN)); if (attr != null && !attr.getValueString().isEmpty()) { this.textbodyTextArea.setVisible(true); this.textbodyTextArea.setText(attr.getValueString()); - + msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, true); selectedTabIndex = TEXT_TAB_INDEX; - } - else { + } else { msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML)); if (attr != null && !attr.getValueString().isEmpty()) { - + this.showImagesToggleButton.setVisible(true); - - + this.htmlbodyTextPane.setVisible(true); this.htmlbodyTextPane.setText("" + cleanseHTML(attr.getValueString()) + ""); //this.htmlbodyTextPane.setText(cleanseHTML(attr.getValueString())); - + msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, true); selectedTabIndex = HTML_TAB_INDEX; - } - else { + } else { msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false); this.htmlbodyTextPane.setVisible(false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF)); if (attr != null && !attr.getValueString().isEmpty()) { - + this.rtfbodyTextPane.setVisible(true); this.rtfbodyTextPane.setText(attr.getValueString()); - + msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, true); selectedTabIndex = RTF_TAB_INDEX; - } - else { + } else { msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_HEADERS)); if (attr != null && !attr.getValueString().isEmpty()) { this.headersTextArea.setVisible(true); this.headersTextArea.setText(attr.getValueString()); if (selectedTabIndex < 0) { - selectedTabIndex = HDR_TAB_INDEX; + selectedTabIndex = HDR_TAB_INDEX; } - } - else { + } else { msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false); } - + msgbodyTabbedPane.setSelectedIndex(selectedTabIndex); - } - catch (TskCoreException ex) { + } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "Failed to get attributes for email message.", ex); //NON-NLS } } - + private void displayMsg() { - + this.ccText.setVisible(false); this.showImagesToggleButton.setVisible(false); msgbodyTabbedPane.setEnabledAt(HTML_TAB_INDEX, false); msgbodyTabbedPane.setEnabledAt(RTF_TAB_INDEX, false); msgbodyTabbedPane.setEnabledAt(HDR_TAB_INDEX, false); - + try { - + BlackboardAttribute attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM)); if (attr != null) { this.fromText.setText(attr.getValueString()); - }else { - this.fromText.setVisible(false); + } else { + this.fromText.setVisible(false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO)); if (attr != null) { - this.toText.setText(attr.getValueString()); - }else { - this.toText.setVisible(false); + this.toText.setText(attr.getValueString()); + } else { + this.toText.setVisible(false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION)); if (attr != null) { - this.directionText.setText(attr.getValueString()); - }else { - this.directionText.setVisible(false); + this.directionText.setText(attr.getValueString()); + } else { + this.directionText.setVisible(false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT)); if (attr != null && !attr.getValueString().isEmpty()) { this.subjectText.setVisible(true); this.subjectText.setText(attr.getValueString()); - } - else { + } else { this.subjectText.setVisible(false); } - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); if (attr != null && !attr.getDisplayString().isEmpty()) { this.datetimeText.setVisible(true); this.datetimeText.setText(attr.getDisplayString()); - } - else { + } else { this.datetimeText.setVisible(false); } - - + attr = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT)); if (attr != null && !attr.getValueString().isEmpty()) { this.textbodyTextArea.setVisible(true); this.textbodyTextArea.setText(attr.getValueString()); - + msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, true); - } - else { + } else { msgbodyTabbedPane.setEnabledAt(TEXT_TAB_INDEX, false); } msgbodyTabbedPane.setSelectedIndex(TEXT_TAB_INDEX); - } - catch (TskCoreException ex) { + } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "Failed to get attributes for message.", ex); //NON-NLS } - + } - + /** * Cleans out input HTML string */ - private String cleanseHTML(String htmlInString) { - + private String cleanseHTML(String htmlInString) { + Document doc = Jsoup.parse(htmlInString); - + // fix all img tags doc.select("img[src]").forEach((img) -> { img.attr("src", ""); }); return doc.html(); - } } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataContent.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataContent.java index 92d0e39547..f51f558f74 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataContent.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataContent.java @@ -20,12 +20,10 @@ package org.sleuthkit.autopsy.corecomponentinterfaces; import java.beans.PropertyChangeListener; import org.openide.nodes.Node; -import org.openide.windows.TopComponent; /** * The interface for the "bottom right component" window. * - * @author jantonius */ public interface DataContent extends PropertyChangeListener { From 56870ab605316b33117dfeedaa0e13fdf5d35295 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Tue, 31 Oct 2017 21:06:36 +0100 Subject: [PATCH 07/10] tweak UI layout --- .../autopsy/communications/Bundle.properties | 4 ++-- .../communications/CVTTopComponent.form | 14 +++++++++++--- .../communications/CVTTopComponent.java | 8 ++++++-- .../autopsy/communications/FiltersPanel.form | 2 +- .../autopsy/communications/FiltersPanel.java | 19 +++++++------------ .../communications/MessageBrowser.form | 2 +- .../communications/MessageBrowser.java | 2 +- 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties b/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties index 9e5cf923e1..c95f1af5c8 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/communications/Bundle.properties @@ -1,9 +1,9 @@ CVTTopComponent.TabConstraints.tabTitle=Visualize CVTTopComponent.accountsBrowser.TabConstraints.tabTitle=Browse -FiltersPanel.applyFiltersButton.text=Apply Filters +FiltersPanel.applyFiltersButton.text=Apply FiltersPanel.devicesLabel.text=Devices: FiltersPanel.accountTypesLabel.text=Account Types: -FiltersPanel.filtersTitleLabel.text=Filters +FiltersPanel.filtersTitleLabel.text=Account Filters FiltersPanel.unCheckAllAccountTypesButton.text=Uncheck All FiltersPanel.checkAllAccountTypesButton.text=Check All FiltersPanel.unCheckAllDevicesButton.text=Uncheck All diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form index 82be39bf3d..f2ba98c5b9 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form @@ -17,9 +17,9 @@ - - - + + + @@ -42,6 +42,7 @@ + @@ -106,6 +107,13 @@ + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java index fa789271a2..aa09e14560 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java @@ -49,7 +49,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag initComponents(); setName(Bundle.CVTTopComponent_name()); - splitPane.setRightComponent(new MessageBrowser()); +// splitPane.setRightComponent(new MessageBrowser()); } /** @@ -64,9 +64,11 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag BrowseVisualizeTabPane = new javax.swing.JTabbedPane(); accountsBrowser = new org.sleuthkit.autopsy.communications.AccountsBrowser(); jPanel1 = new javax.swing.JPanel(); + messageBrowser1 = new org.sleuthkit.autopsy.communications.MessageBrowser(); filtersPane = new org.sleuthkit.autopsy.communications.FiltersPanel(); splitPane.setDividerLocation(600); + splitPane.setResizeWeight(0.3); BrowseVisualizeTabPane.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N BrowseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.accountsBrowser.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/table.png")), accountsBrowser); // NOI18N @@ -87,6 +89,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag BrowseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/emblem-web.png")), jPanel1); // NOI18N splitPane.setLeftComponent(BrowseVisualizeTabPane); + splitPane.setRightComponent(messageBrowser1); filtersPane.setBorder(javax.swing.BorderFactory.createEtchedBorder()); filtersPane.setMinimumSize(new java.awt.Dimension(256, 495)); @@ -97,7 +100,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, 244, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1322, Short.MAX_VALUE) .addContainerGap()) @@ -119,6 +122,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag private org.sleuthkit.autopsy.communications.AccountsBrowser accountsBrowser; private org.sleuthkit.autopsy.communications.FiltersPanel filtersPane; private javax.swing.JPanel jPanel1; + private org.sleuthkit.autopsy.communications.MessageBrowser messageBrowser1; private javax.swing.JSplitPane splitPane; // End of variables declaration//GEN-END:variables diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form index e020c001a1..907dcace44 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form @@ -116,7 +116,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java index a8bf3d1e4a..5d840df9eb 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java @@ -134,8 +134,6 @@ final public class FiltersPanel extends javax.swing.JPanel { // //GEN-BEGIN:initComponents private void initComponents() { - jList1 = new javax.swing.JList<>(); - jList1.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } @@ -185,7 +183,7 @@ final public class FiltersPanel extends javax.swing.JPanel { .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addContainerGap(51, Short.MAX_VALUE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(unCheckAllAccountTypesButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(checkAllAccountTypesButton)) @@ -233,15 +231,12 @@ final public class FiltersPanel extends javax.swing.JPanel { .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(devicesLabel) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(devicesPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createSequentialGroup() - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(devicesPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel3Layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(unCheckAllDevicesButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(checkAllDevicesButton))) - .addGap(0, 0, 0)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(unCheckAllDevicesButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(checkAllDevicesButton)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -372,7 +367,7 @@ final public class FiltersPanel extends javax.swing.JPanel { private final javax.swing.JLabel devicesLabel = new javax.swing.JLabel(); private final javax.swing.JPanel devicesPane = new javax.swing.JPanel(); private final javax.swing.JLabel filtersTitleLabel = new javax.swing.JLabel(); - private javax.swing.JList jList1; + private final javax.swing.JList jList1 = new javax.swing.JList<>(); private final javax.swing.JPanel jPanel2 = new javax.swing.JPanel(); private final javax.swing.JPanel jPanel3 = new javax.swing.JPanel(); private final javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form index ee473957ee..25399629ca 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form @@ -37,7 +37,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java index 75964a6558..0bdc2514ed 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -104,7 +104,7 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager splitPane.setDividerLocation(400); splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); - splitPane.setResizeWeight(0.5); + splitPane.setResizeWeight(0.4); splitPane.setBottomComponent(messageDataContent); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); From 825a614b07c79f3906745eb372a466e0a3dea937 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Wed, 1 Nov 2017 12:20:09 +0100 Subject: [PATCH 08/10] override createSheet instead of using the implementation in BlackboardArtifactNode and suppressing some columns. --- .../communications/AccountDetailsNode.java | 3 +- .../AccountDeviceInstanceNode.java | 104 ------------ .../AccountsDeviceInstanceChildren.java | 65 -------- .../communications/AccountsRootChildren.java | 128 ++++++++++++++ .../communications/CVTTopComponent.form | 7 - .../communications/CVTTopComponent.java | 5 +- .../autopsy/communications/FiltersPanel.form | 14 +- .../autopsy/communications/FiltersPanel.java | 13 +- .../communications/MessageBrowser.form | 8 +- .../communications/MessageBrowser.java | 6 +- .../communications/MessageDataContent.java | 19 ++- .../RelationShipFilterNode.java | 156 ++++++++++++------ 12 files changed, 274 insertions(+), 254 deletions(-) delete mode 100644 Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java delete mode 100644 Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java create mode 100644 Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java index 6452931d2b..c428cbb3fd 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java @@ -27,7 +27,6 @@ import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.Node; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode; import org.sleuthkit.datamodel.Account; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.CommunicationsFilter; @@ -59,7 +58,7 @@ class AccountDetailsNode extends AbstractNode { @Override protected Node[] createNodes(BlackboardArtifact key) { - return new Node[]{new RelationShipFilterNode(new BlackboardArtifactNode(key))}; + return new Node[]{new RelationShipFilterNode(key)}; } @Override diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java deleted file mode 100644 index 4c45f647f3..0000000000 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDeviceInstanceNode.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2017 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.communications; - -import java.util.logging.Level; -import java.util.logging.Logger; -import org.openide.nodes.AbstractNode; -import org.openide.nodes.Children; -import org.openide.nodes.Sheet; -import org.openide.util.NbBundle; -import org.openide.util.lookup.Lookups; -import org.sleuthkit.autopsy.datamodel.NodeProperty; -import org.sleuthkit.datamodel.AccountDeviceInstance; -import org.sleuthkit.datamodel.CommunicationsFilter; -import org.sleuthkit.datamodel.CommunicationsManager; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Node to represent an Account in the AccountsBrowser - */ -class AccountDeviceInstanceNode extends AbstractNode { - - private static final Logger LOGGER = Logger.getLogger(AccountDeviceInstanceNode.class.getName()); - private final AccountDeviceInstance accountDeviceInstance; - private final CommunicationsManager commsManager; - private final CommunicationsFilter filter; - - AccountDeviceInstanceNode(AccountDeviceInstanceKey accountDeviceInstanceKey, CommunicationsManager commsManager) { - super(Children.LEAF, Lookups.fixed(accountDeviceInstanceKey, commsManager)); - this.accountDeviceInstance = accountDeviceInstanceKey.getAccountDeviceInstance(); - this.commsManager = commsManager; - this.filter = accountDeviceInstanceKey.getCommunicationsFilter(); - - setName(accountDeviceInstance.getAccount().getAccountUniqueID()); - setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/" - + AccountUtils.getIconFileName(accountDeviceInstance.getAccount().getAccountType())); - } - - public AccountDeviceInstance getAccountDeviceInstance() { - return accountDeviceInstance; - } - - public CommunicationsManager getCommsManager() { - return commsManager; - } - - public CommunicationsFilter getFilter() { - return filter; - } - - @Override - @NbBundle.Messages({ - "AccountNode.device=Device", - "AccountNode.accountName=Account", - "AccountNode.accountType=Type", - "AccountNode.messageCount=Msg Count"}) - protected Sheet createSheet() { - Sheet s = super.createSheet(); - Sheet.Set properties = s.get(Sheet.PROPERTIES); - if (properties == null) { - properties = Sheet.createPropertiesSet(); - s.put(properties); - } - - long msgCount = 0; - try { - msgCount = commsManager.getRelationshipsCount(filter, accountDeviceInstance); - } catch (TskCoreException ex) { - LOGGER.log(Level.WARNING, "Failed to get message count for account", ex); //NON-NLS - } - - properties.put(new NodeProperty<>("type", - Bundle.AccountNode_accountType(), - "type", - accountDeviceInstance.getAccount().getAccountType().getDisplayName())); // NON-NLS - - properties.put(new NodeProperty<>("count", - Bundle.AccountNode_messageCount(), - "count", - msgCount)); // NON-NLS - - properties.put(new NodeProperty<>("device", - Bundle.AccountNode_device(), - "device", - accountDeviceInstance.getDeviceId())); // NON-NLS - return s; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java b/Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java deleted file mode 100644 index 51db6d0e4f..0000000000 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountsDeviceInstanceChildren.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2017 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.communications; - -import java.util.Collections; -import java.util.List; -import org.openide.nodes.Children; -import org.openide.nodes.Node; -import org.sleuthkit.datamodel.CommunicationsManager; - -class AccountsDeviceInstanceChildren extends Children.Keys { - - private final List accountDeviceInstanceKeys; - private final CommunicationsManager commsManager; - - AccountsDeviceInstanceChildren(List accountDeviceInstanceKeys, CommunicationsManager commsManager) { - super(true); - this.accountDeviceInstanceKeys = accountDeviceInstanceKeys; - this.commsManager = commsManager; - } - - @Override - protected void removeNotify() { - super.removeNotify(); - setKeys(Collections.emptySet()); - } - - @Override - protected void addNotify() { - super.addNotify(); - setKeys(accountDeviceInstanceKeys); - } - - //These are the methods for ChildFactory. I am going to keep them around but commented until we make a final descision. - // @Override - // protected boolean createKeys(List list) { - // list.addAll(accounts); - // return true; - // } - // - // @Override - // protected Node createNodeForKey(Account key) { - // return new AccountDeviceInstanceNode(key); - // } - @Override - protected Node[] createNodes(AccountDeviceInstanceKey key) { - return new Node[]{new AccountDeviceInstanceNode(key, commsManager)}; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java b/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java new file mode 100644 index 0000000000..3da39f6776 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountsRootChildren.java @@ -0,0 +1,128 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 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.communications; + +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.nodes.Sheet; +import org.openide.util.NbBundle; +import org.openide.util.lookup.Lookups; +import org.sleuthkit.autopsy.datamodel.NodeProperty; +import org.sleuthkit.datamodel.AccountDeviceInstance; +import org.sleuthkit.datamodel.CommunicationsFilter; +import org.sleuthkit.datamodel.CommunicationsManager; +import org.sleuthkit.datamodel.TskCoreException; + +class AccountsRootChildren extends Children.Keys { + + private final List accountDeviceInstanceKeys; + private final CommunicationsManager commsManager; + + AccountsRootChildren(List accountDeviceInstanceKeys, CommunicationsManager commsManager) { + super(true); + this.accountDeviceInstanceKeys = accountDeviceInstanceKeys; + this.commsManager = commsManager; + } + + @Override + protected void removeNotify() { + super.removeNotify(); + setKeys(Collections.emptySet()); + } + + @Override + protected void addNotify() { + super.addNotify(); + setKeys(accountDeviceInstanceKeys); + } + + //These are the methods for ChildFactory. I am going to keep them around but commented until we make a final descision. + // @Override + // protected boolean createKeys(List list) { + // list.addAll(accounts); + // return true; + // } + // + // @Override + // protected Node createNodeForKey(Account key) { + // return new AccountDeviceInstanceNode(key); + // } + @Override + protected Node[] createNodes(AccountDeviceInstanceKey key) { + return new Node[]{new AccountDeviceInstanceNode(key, commsManager)}; + } + + /** + * Node to represent an Account in the AccountsBrowser + */ + static class AccountDeviceInstanceNode extends AbstractNode { + + private static final Logger LOGGER = Logger.getLogger(AccountDeviceInstanceNode.class.getName()); + private final AccountDeviceInstance accountDeviceInstance; + private final CommunicationsManager commsManager; + private final CommunicationsFilter filter; + + private AccountDeviceInstanceNode(AccountDeviceInstanceKey accountDeviceInstanceKey, CommunicationsManager commsManager) { + super(Children.LEAF, Lookups.fixed(accountDeviceInstanceKey, commsManager)); + this.accountDeviceInstance = accountDeviceInstanceKey.getAccountDeviceInstance(); + this.commsManager = commsManager; + this.filter = accountDeviceInstanceKey.getCommunicationsFilter(); + setName(accountDeviceInstance.getAccount().getAccountUniqueID()); + setIconBaseWithExtension("org/sleuthkit/autopsy/communications/images/" + AccountUtils.getIconFileName(accountDeviceInstance.getAccount().getAccountType())); + } + + public AccountDeviceInstance getAccountDeviceInstance() { + return accountDeviceInstance; + } + + public CommunicationsManager getCommsManager() { + return commsManager; + } + + public CommunicationsFilter getFilter() { + return filter; + } + + @Override + @NbBundle.Messages(value = {"AccountNode.device=Device", "AccountNode.accountName=Account", "AccountNode.accountType=Type", "AccountNode.messageCount=Msg Count"}) + protected Sheet createSheet() { + Sheet s = super.createSheet(); + Sheet.Set properties = s.get(Sheet.PROPERTIES); + if (properties == null) { + properties = Sheet.createPropertiesSet(); + s.put(properties); + } + long msgCount = 0; + try { + msgCount = commsManager.getRelationshipsCount(filter, accountDeviceInstance); + } catch (TskCoreException ex) { + LOGGER.log(Level.WARNING, "Failed to get message count for account", ex); //NON-NLS + } + properties.put(new NodeProperty<>("type", Bundle.AccountNode_accountType(), "type", accountDeviceInstance.getAccount().getAccountType().getDisplayName())); // NON-NLS + properties.put(new NodeProperty<>("count", Bundle.AccountNode_messageCount(), "count", msgCount)); // NON-NLS + properties.put(new NodeProperty<>("device", Bundle.AccountNode_device(), "device", accountDeviceInstance.getDeviceId())); // NON-NLS + return s; + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form index f2ba98c5b9..524529e9bd 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.form @@ -107,13 +107,6 @@ - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java index aa09e14560..9a108d3271 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/CVTTopComponent.java @@ -49,7 +49,7 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag initComponents(); setName(Bundle.CVTTopComponent_name()); -// splitPane.setRightComponent(new MessageBrowser()); + splitPane.setRightComponent(new MessageBrowser()); } /** @@ -64,7 +64,6 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag BrowseVisualizeTabPane = new javax.swing.JTabbedPane(); accountsBrowser = new org.sleuthkit.autopsy.communications.AccountsBrowser(); jPanel1 = new javax.swing.JPanel(); - messageBrowser1 = new org.sleuthkit.autopsy.communications.MessageBrowser(); filtersPane = new org.sleuthkit.autopsy.communications.FiltersPanel(); splitPane.setDividerLocation(600); @@ -89,7 +88,6 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag BrowseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/emblem-web.png")), jPanel1); // NOI18N splitPane.setLeftComponent(BrowseVisualizeTabPane); - splitPane.setRightComponent(messageBrowser1); filtersPane.setBorder(javax.swing.BorderFactory.createEtchedBorder()); filtersPane.setMinimumSize(new java.awt.Dimension(256, 495)); @@ -122,7 +120,6 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag private org.sleuthkit.autopsy.communications.AccountsBrowser accountsBrowser; private org.sleuthkit.autopsy.communications.FiltersPanel filtersPane; private javax.swing.JPanel jPanel1; - private org.sleuthkit.autopsy.communications.MessageBrowser messageBrowser1; private javax.swing.JSplitPane splitPane; // End of variables declaration//GEN-END:variables diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form index 907dcace44..ef451b0751 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.form @@ -28,11 +28,6 @@ - - - - - @@ -56,7 +51,7 @@ - + @@ -90,6 +85,9 @@ + + + @@ -98,7 +96,7 @@ - + @@ -116,7 +114,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java index 5d840df9eb..90cee25853 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java +++ b/Core/src/org/sleuthkit/autopsy/communications/FiltersPanel.java @@ -141,18 +141,17 @@ final public class FiltersPanel extends javax.swing.JPanel { }); jScrollPane1.setViewportView(jList1); - setPreferredSize(new java.awt.Dimension(256, 469)); - applyFiltersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/control-double.png"))); // NOI18N applyFiltersButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.applyFiltersButton.text")); // NOI18N applyFiltersButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); + applyFiltersButton.setPreferredSize(null); applyFiltersButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { applyFiltersButtonActionPerformed(evt); } }); - filtersTitleLabel.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N + filtersTitleLabel.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N filtersTitleLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/funnel.png"))); // NOI18N filtersTitleLabel.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.filtersTitleLabel.text")); // NOI18N @@ -183,7 +182,7 @@ final public class FiltersPanel extends javax.swing.JPanel { .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap(43, Short.MAX_VALUE) .addComponent(unCheckAllAccountTypesButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(checkAllAccountTypesButton)) @@ -264,7 +263,7 @@ final public class FiltersPanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(filtersTitleLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(applyFiltersButton))) + .addComponent(applyFiltersButton, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); layout.setVerticalGroup( @@ -273,7 +272,7 @@ final public class FiltersPanel extends javax.swing.JPanel { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(filtersTitleLabel) - .addComponent(applyFiltersButton)) + .addComponent(applyFiltersButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) @@ -307,7 +306,7 @@ final public class FiltersPanel extends javax.swing.JPanel { accountDeviceInstances.forEach(accountDeviceInstance -> accountDeviceInstanceKeys.add(new AccountDeviceInstanceKey(accountDeviceInstance, commsFilter))); - em.setRootContext(new AbstractNode(new AccountsDeviceInstanceChildren(accountDeviceInstanceKeys, commsManager))); + em.setRootContext(new AbstractNode(new AccountsRootChildren(accountDeviceInstanceKeys, commsManager))); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "There was a error loading the accounts.", ex); } diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form index 25399629ca..606d60c7df 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.form @@ -26,7 +26,7 @@ - + @@ -36,6 +36,7 @@ + @@ -43,6 +44,11 @@ + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java index 0bdc2514ed..20a4388dae 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.Set; import org.openide.explorer.ExplorerManager; import org.openide.nodes.Node; +import org.sleuthkit.autopsy.communications.AccountsRootChildren.AccountDeviceInstanceNode; import org.sleuthkit.autopsy.corecomponents.DataResultPanel; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; import org.sleuthkit.datamodel.Account; @@ -103,8 +104,11 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager messageDataContent = new org.sleuthkit.autopsy.communications.MessageDataContent(); splitPane.setDividerLocation(400); + splitPane.setDividerSize(10); splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); splitPane.setResizeWeight(0.4); + + messageDataContent.setMinimumSize(null); splitPane.setBottomComponent(messageDataContent); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); @@ -119,7 +123,7 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(0, 0, 0) - .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE) + .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1083, Short.MAX_VALUE) .addGap(0, 0, 0)) ); }// //GEN-END:initComponents diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java b/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java index 4f432f0b94..1b7b5dc3c0 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageDataContent.java @@ -1,7 +1,20 @@ /* - * 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. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 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.communications; diff --git a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java index 3420f531c0..71508f807a 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/RelationShipFilterNode.java @@ -1,72 +1,124 @@ /* - * 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. + * Autopsy Forensic Browser + * + * Copyright 2011-2017 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.communications; -import java.util.ArrayList; -import java.util.HashSet; +import java.util.logging.Level; import org.apache.commons.lang3.StringUtils; -import org.openide.nodes.FilterNode; import org.openide.nodes.Sheet; +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; +import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_SENT; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_FROM; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL_TO; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO; +import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT; +import org.sleuthkit.datamodel.TskCoreException; /** * */ -public class RelationShipFilterNode extends FilterNode { - - - public RelationShipFilterNode(BlackboardArtifactNode wrappedNode) { - super(wrappedNode, Children.LEAF); - setDisplayName( StringUtils.stripEnd(wrappedNode.getArtifact().getDisplayName(),"s")); +public class RelationShipFilterNode extends BlackboardArtifactNode { + + private static final Logger logger = Logger.getLogger(RelationShipFilterNode.class.getName()); + + public RelationShipFilterNode(BlackboardArtifact artifact) { + super(artifact); + final String stripEnd = StringUtils.stripEnd(artifact.getDisplayName(), "s"); + String removeEndIgnoreCase = StringUtils.removeEndIgnoreCase(stripEnd, "message"); + setDisplayName(removeEndIgnoreCase.isEmpty() ? stripEnd : removeEndIgnoreCase); } - + @Override - public PropertySet[] getPropertySets() { - PropertySet[] propertySets = super.getPropertySets(); - - HashSet propertyNames = new HashSet<>(); - propertyNames.add("Source File"); - propertyNames.add("Data Source"); - propertyNames.add("Path"); - propertyNames.add("Message ID"); - propertyNames.add("Tags"); - propertyNames.add("Text"); - propertyNames.add("Read"); - propertyNames.add("Direction"); - propertyNames.add("Name"); - propertyNames.add("Message (Plaintext)"); - propertyNames.add("Message Type"); - - ArrayList retPropSets = new ArrayList<>(); - boolean first = true; - for (PropertySet set : propertySets) { - Sheet.Set set1 = copySet(set); - if (first) { - first = false; - set1.put(new NodeProperty<>("Type", "Type", "Type", getDisplayName())); - } - - for (Property p : set.getProperties()) { - if (false == propertyNames.contains(p.getName())) { - set1.put(p); - } - } - retPropSets.add(set1); + protected Sheet createSheet() { + + Sheet s = new Sheet(); + Sheet.Set ss = s.get(Sheet.PROPERTIES); + if (ss == null) { + ss = Sheet.createPropertiesSet(); + s.put(ss); } - return retPropSets.toArray(new PropertySet[retPropSets.size()]); + + ss.put(new NodeProperty<>("Type", "Type", "Type", getDisplayName())); + final BlackboardArtifact artifact = getArtifact(); + BlackboardArtifact.ARTIFACT_TYPE fromID = BlackboardArtifact.ARTIFACT_TYPE.fromID(getArtifact().getArtifactTypeID()); + if (null != fromID) { + switch (fromID) { + case TSK_EMAIL_MSG: + ss.put(new NodeProperty<>("From", "From", "From", + getAttributeDisplayString(artifact, TSK_EMAIL_FROM))); + ss.put(new NodeProperty<>("To", "To", "To", + getAttributeDisplayString(artifact, TSK_EMAIL_TO))); + ss.put(new NodeProperty<>("Date", "Date", "Date", + getAttributeDisplayString(artifact, TSK_DATETIME_SENT))); + ss.put(new NodeProperty<>("Subject", "Subject", "Subject", + getAttributeDisplayString(artifact, TSK_SUBJECT))); + break; + case TSK_MESSAGE: + ss.put(new NodeProperty<>("From", "From", "From", + getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM))); + ss.put(new NodeProperty<>("To", "To", "To", + getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO))); + ss.put(new NodeProperty<>("Date", "Date", "Date", + getAttributeDisplayString(artifact, TSK_DATETIME))); + ss.put(new NodeProperty<>("Subject", "Subject", "Subject", + getAttributeDisplayString(artifact, TSK_SUBJECT))); + break; + case TSK_CALLLOG: + ss.put(new NodeProperty<>("From", "From", "From", + getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_FROM))); + ss.put(new NodeProperty<>("To", "To", "To", + getAttributeDisplayString(artifact, TSK_PHONE_NUMBER_TO))); + ss.put(new NodeProperty<>("Date", "Date", "Date", + getAttributeDisplayString(artifact, TSK_DATETIME_START))); + break; + default: + break; + } + } + return s; } - private static final BlackboardAttribute.Type MSG_TYPE = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE); - private Sheet.Set copySet(PropertySet set) { - Sheet.Set set1 = new Sheet.Set(); - set1.setName(set.getName()); - set1.setDisplayName(set.getDisplayName()); - set1.setShortDescription(set.getShortDescription()); - return set1; + /** + * + * @param artifact the value of artifact + * @param attributeType the value of TSK_SUBJECT1 + * + * @throws TskCoreException + */ + private static String getAttributeDisplayString(final BlackboardArtifact artifact, final ATTRIBUTE_TYPE attributeType) { + try { + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attributeType.getTypeID()))); + if (attribute == null) { + return ""; + } else { + return attribute.getDisplayString(); + } + } catch (TskCoreException tskCoreException) { + logger.log(Level.WARNING, "Error getting attribute value.", tskCoreException); + return ""; + } } } From ca36a50b16d11ffe8666bed26f5a732798a6bba3 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Wed, 1 Nov 2017 12:34:44 +0100 Subject: [PATCH 09/10] tweak MessageContentViewer for better resizing. eliminate nested scrollpanes --- .../autopsy/contentviewers/Bundle.properties | 2 +- .../contentviewers/MessageContentViewer.form | 172 ++++++++---------- .../contentviewers/MessageContentViewer.java | 115 ++++++------ 3 files changed, 131 insertions(+), 158 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties index ed52040276..09048ca131 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties @@ -37,4 +37,4 @@ MessageContentViewer.directionText.text=direction MessageContentViewer.ccLabel.text=CC: MessageContentViewer.showImagesToggleButton.text=Show Images MessageContentViewer.showImagesToggleButton.hide.text=Hide Images -MessageContentViewer.htmlbodyScrollPane.TabConstraints.tabTitle=HTML +MessageContentViewer.htmlPane.TabConstraints.tabTitle=HTML diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.form index a83f08d765..7c089d54a7 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.form @@ -3,7 +3,7 @@
- + @@ -21,22 +21,24 @@ - - - - + + + + + + + - + + - - - - + + @@ -53,53 +55,46 @@ - + - - - - - + - - - - + - + + + + + + - - - - - - - - - - - - - + + + + + + + + - + - + @@ -116,12 +111,12 @@ - + - + @@ -136,6 +131,7 @@ + @@ -192,6 +188,7 @@ + @@ -247,81 +244,64 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - + - - - + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java index 17ad5ba3d6..fc1df57e6d 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MessageContentViewer.java @@ -43,6 +43,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont private static final int TEXT_TAB_INDEX = 1; private static final int HTML_TAB_INDEX = 2; private static final int RTF_TAB_INDEX = 3; + private static final long serialVersionUID = 1L; private BlackboardArtifact artifact; // Artifact currently being displayed @@ -79,20 +80,20 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont headersTextArea = new javax.swing.JTextArea(); textbodyScrollPane = new javax.swing.JScrollPane(); textbodyTextArea = new javax.swing.JTextArea(); - htmlbodyScrollPane = new javax.swing.JScrollPane(); - jPanel2 = new javax.swing.JPanel(); + htmlPane = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); htmlbodyTextPane = new javax.swing.JTextPane(); showImagesToggleButton = new javax.swing.JToggleButton(); rtfbodyScrollPane = new javax.swing.JScrollPane(); rtfbodyTextPane = new javax.swing.JTextPane(); - setMinimumSize(new java.awt.Dimension(650, 546)); + setMinimumSize(null); envelopePanel.setBackground(new java.awt.Color(204, 204, 204)); org.openide.awt.Mnemonics.setLocalizedText(fromLabel, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.fromLabel.text")); // NOI18N + datetimeText.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); org.openide.awt.Mnemonics.setLocalizedText(datetimeText, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.datetimeText.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(fromText, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.fromText.text")); // NOI18N @@ -109,6 +110,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont org.openide.awt.Mnemonics.setLocalizedText(subjectText, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.subjectText.text")); // NOI18N + directionText.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); org.openide.awt.Mnemonics.setLocalizedText(directionText, org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.directionText.text")); // NOI18N javax.swing.GroupLayout envelopePanelLayout = new javax.swing.GroupLayout(envelopePanel); @@ -116,40 +118,36 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont envelopePanelLayout.setHorizontalGroup( envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(envelopePanelLayout.createSequentialGroup() - .addContainerGap() + .addGap(5, 5, 5) .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(envelopePanelLayout.createSequentialGroup() .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fromLabel) .addComponent(toLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(fromText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(toText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(envelopePanelLayout.createSequentialGroup() - .addGap(8, 8, 8) - .addComponent(datetimeText)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, envelopePanelLayout.createSequentialGroup() + .addComponent(toText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(directionText)))) + .addComponent(directionText, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(envelopePanelLayout.createSequentialGroup() + .addComponent(fromText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(datetimeText, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(envelopePanelLayout.createSequentialGroup() - .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(envelopePanelLayout.createSequentialGroup() - .addComponent(ccLabel) - .addGap(18, 18, 18) - .addComponent(ccText)) - .addGroup(envelopePanelLayout.createSequentialGroup() - .addComponent(subjectLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(subjectText, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()) + .addComponent(ccLabel) + .addGap(26, 26, 26) + .addComponent(ccText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(envelopePanelLayout.createSequentialGroup() + .addComponent(subjectLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(subjectText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addGap(5, 5, 5)) ); envelopePanelLayout.setVerticalGroup( envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(envelopePanelLayout.createSequentialGroup() - .addContainerGap() + .addGap(5, 5, 5) .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fromLabel) .addComponent(datetimeText) @@ -163,11 +161,11 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ccLabel) .addComponent(ccText)) - .addGap(18, 18, 18) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(envelopePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(subjectLabel) .addComponent(subjectText)) - .addContainerGap(24, Short.MAX_VALUE)) + .addGap(5, 5, 5)) ); headersTextArea.setEditable(false); @@ -194,35 +192,26 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont } }); - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addContainerGap(536, Short.MAX_VALUE) + javax.swing.GroupLayout htmlPaneLayout = new javax.swing.GroupLayout(htmlPane); + htmlPane.setLayout(htmlPaneLayout); + htmlPaneLayout.setHorizontalGroup( + htmlPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane2) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, htmlPaneLayout.createSequentialGroup() + .addContainerGap(533, Short.MAX_VALUE) .addComponent(showImagesToggleButton) - .addContainerGap()) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 623, Short.MAX_VALUE) - .addContainerGap())) + .addGap(3, 3, 3)) ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() + htmlPaneLayout.setVerticalGroup( + htmlPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(htmlPaneLayout.createSequentialGroup() .addComponent(showImagesToggleButton) - .addContainerGap(333, Short.MAX_VALUE)) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() - .addGap(0, 34, Short.MAX_VALUE) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 333, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane2) + .addGap(0, 0, 0)) ); - htmlbodyScrollPane.setViewportView(jPanel2); - - msgbodyTabbedPane.addTab(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.htmlbodyScrollPane.TabConstraints.tabTitle"), htmlbodyScrollPane); // NOI18N + msgbodyTabbedPane.addTab(org.openide.util.NbBundle.getMessage(MessageContentViewer.class, "MessageContentViewer.htmlPane.TabConstraints.tabTitle"), htmlPane); // NOI18N rtfbodyTextPane.setEditable(false); rtfbodyScrollPane.setViewportView(rtfbodyTextPane); @@ -233,20 +222,21 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(envelopePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - .addComponent(msgbodyTabbedPane) + .addGroup(layout.createSequentialGroup() + .addGap(5, 5, 5) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(msgbodyTabbedPane) + .addComponent(envelopePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(5, 5, 5)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(envelopePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(5, 5, 5) + .addComponent(envelopePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(msgbodyTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 397, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) + .addComponent(msgbodyTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE) + .addGap(0, 0, 0)) ); }// //GEN-END:initComponents @@ -282,9 +272,8 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont private javax.swing.JLabel fromText; private javax.swing.JScrollPane headersScrollPane; private javax.swing.JTextArea headersTextArea; - private javax.swing.JScrollPane htmlbodyScrollPane; + private javax.swing.JPanel htmlPane; private javax.swing.JTextPane htmlbodyTextPane; - private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTabbedPane msgbodyTabbedPane; private javax.swing.JScrollPane rtfbodyScrollPane; @@ -311,7 +300,7 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont if (node == null) { return; } - + artifact = node.getLookup().lookup(BlackboardArtifact.class); if (artifact == null) { @@ -530,6 +519,10 @@ public class MessageContentViewer extends javax.swing.JPanel implements DataCont /** * Cleans out input HTML string + * + * @param htmlInString The HTML string to cleanse + * + * @return The cleansed HTML String */ private String cleanseHTML(String htmlInString) { From 974bf77fc82a79a72776f17ac4f4558244fc0e97 Mon Sep 17 00:00:00 2001 From: millmanorama Date: Wed, 1 Nov 2017 12:45:55 +0100 Subject: [PATCH 10/10] refactor and cleanup slightly --- .../communications/AccountDetailsNode.java | 11 ++-- .../communications/MessageBrowser.java | 58 +++++++++++-------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java index c428cbb3fd..34245f1a6d 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java +++ b/Core/src/org/sleuthkit/autopsy/communications/AccountDetailsNode.java @@ -39,7 +39,7 @@ class AccountDetailsNode extends AbstractNode { private final CommunicationsFilter filter; //TODO: Use this AccountDetailsNode(Set accounts,CommunicationsFilter filter, CommunicationsManager commsManager) { - super(new AccountRelationshipChildren(accounts, commsManager)); + super(new AccountRelationshipChildren(accounts, commsManager, filter)); this.filter = filter; } @@ -50,10 +50,12 @@ class AccountDetailsNode extends AbstractNode { private final Set accounts; private final CommunicationsManager commsManager; + private final CommunicationsFilter filter;//TODO: Use this - private AccountRelationshipChildren(Set accounts, CommunicationsManager commsManager) { + private AccountRelationshipChildren(Set accounts, CommunicationsManager commsManager, CommunicationsFilter filter) { this.accounts = accounts; this.commsManager = commsManager; + this.filter = filter; } @Override @@ -67,14 +69,14 @@ class AccountDetailsNode extends AbstractNode { for (Account account : accounts) { List accountsWithRelationship = new ArrayList<>(); try { - accountsWithRelationship.addAll(commsManager.getAccountsWithRelationship(account)); //TODO: Use filter + accountsWithRelationship.addAll(commsManager.getAccountsWithRelationship(account)); //TODO: Use filter here } catch (TskCoreException ex) { logger.log(Level.WARNING, "Error loading with relationships to " + account, ex); } accountsWithRelationship.forEach(otherAcount -> { try { - keys.addAll(commsManager.getRelationships(account, otherAcount)); //TODO:Use filter + keys.addAll(commsManager.getRelationships(account, otherAcount)); //TODO:Use filter here } catch (TskCoreException ex) { logger.log(Level.WARNING, "Error loading relationships between " + account + " and " + otherAcount, ex); } @@ -83,5 +85,4 @@ class AccountDetailsNode extends AbstractNode { setKeys(keys); } } - } diff --git a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java index 20a4388dae..e5c6704f10 100644 --- a/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java +++ b/Core/src/org/sleuthkit/autopsy/communications/MessageBrowser.java @@ -18,13 +18,16 @@ */ package org.sleuthkit.autopsy.communications; +import com.google.common.collect.Iterables; import java.util.HashSet; import java.util.Set; +import java.util.logging.Level; import org.openide.explorer.ExplorerManager; import org.openide.nodes.Node; import org.sleuthkit.autopsy.communications.AccountsRootChildren.AccountDeviceInstanceNode; import org.sleuthkit.autopsy.corecomponents.DataResultPanel; import org.sleuthkit.autopsy.corecomponents.TableFilterNode; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.Account; import org.sleuthkit.datamodel.CommunicationsFilter; import org.sleuthkit.datamodel.CommunicationsManager; @@ -35,6 +38,8 @@ import org.sleuthkit.datamodel.CommunicationsManager; */ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager.Provider { + private static final Logger logger = Logger.getLogger(MessageBrowser.class.getName()); + private static final long serialVersionUID = 1L; private ExplorerManager parentExplorereManager; @@ -59,32 +64,37 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager parentExplorereManager.addPropertyChangeListener(pce -> { if (pce.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) { final Node[] selectedNodes = parentExplorereManager.getSelectedNodes(); - switch (selectedNodes.length) { - case 0: - messagesResultPanel.setNode(null); - break; - default: - Set accounts = new HashSet<>(); - CommunicationsFilter filter = null; - CommunicationsManager commsManager = null; - for (Node n : selectedNodes) { - if (n instanceof AccountDeviceInstanceNode) { - final AccountDeviceInstanceNode adiNode = (AccountDeviceInstanceNode) n; - accounts.add(adiNode.getAccountDeviceInstance().getAccount()); - if (commsManager == null) { - commsManager = adiNode.getCommsManager(); - } - if (filter == null) { - filter = adiNode.getFilter(); - } else if (filter != adiNode.getFilter()) { - //different filters ..... exception? - } - } else { - ///this should never happen... + if (selectedNodes.length == 0) { + messagesResultPanel.setNode(null); + messagesResultPanel.setPath(""); + } else { + Set accounts = new HashSet<>(); + CommunicationsFilter filter = null; + CommunicationsManager commsManager = null; + for (Node n : selectedNodes) { + if (n instanceof AccountDeviceInstanceNode) { + final AccountDeviceInstanceNode adiNode = (AccountDeviceInstanceNode) n; + accounts.add(adiNode.getAccountDeviceInstance().getAccount()); + if (commsManager == null) { + commsManager = adiNode.getCommsManager(); } + if (filter == null) { + filter = adiNode.getFilter(); + } else if (filter != adiNode.getFilter()) { + ///this should never happen... + logger.log(Level.WARNING, "Not all AccountDeviceInstanceNodes have the same filter. Using the first."); + } + } else { + ///this should never happen... + logger.log(Level.WARNING, "Unexpected Node encountered: " + n.toString()); } - messagesResultPanel.setNode(new TableFilterNode(new AccountDetailsNode(accounts, filter, commsManager), true)); - break; + } + messagesResultPanel.setNode(new TableFilterNode(new AccountDetailsNode(accounts, filter, commsManager), true)); + if (accounts.size() == 1) { + messagesResultPanel.setPath(Iterables.getOnlyElement(accounts).getAccountUniqueID()); + } else { + messagesResultPanel.setPath(accounts.size() + " accounts"); + } } } });