WIP 3 getting graph selection to populate MessageBrowser WIP 3

This commit is contained in:
millmanorama 2018-01-06 13:39:13 +01:00
parent 3e49de2c1b
commit 461fc11c13
9 changed files with 209 additions and 205 deletions

View File

@ -11,30 +11,28 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="outlineView" pref="400" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="outlineView" pref="300" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="org.openide.explorer.view.OutlineView" name="outlineView">
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Container class="org.openide.explorer.view.OutlineView" name="outlineView">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -31,12 +31,13 @@ import org.openide.explorer.ExplorerManager;
* A panel that goes in the Browse tab of the Communications Visualization Tool.
* Hosts an OutlineView that shows information about Accounts.
*/
public class AccountsBrowser extends JPanel implements ExplorerManager.Provider {
public class AccountsBrowser extends JPanel implements ExplorerManager.Provider, CVTTopComponent.ProxiedExplorerManagerProvider {
private static final long serialVersionUID = 1L;
private final Outline outline;
private ExplorerManager em;
private final ExplorerManager gacEM = new ExplorerManager();
private ExplorerManager tableEM;
/**
* Creates new form AccountsBrowser
@ -54,19 +55,22 @@ public class AccountsBrowser extends JPanel implements ExplorerManager.Provider
((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.AccountNode_accountName());
outline.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
outline.setColumnSorted(3, false, 1); //it would be nice if the column index wasn't hardcoded
}
void init(ExplorerManager acctsBrowserExplorerManager) {
em = acctsBrowserExplorerManager;
em.addPropertyChangeListener(evt -> {
void init(ExplorerManager tableExplorerManager) {
this.tableEM = tableExplorerManager;
tableExplorerManager.addPropertyChangeListener(evt -> {
if (ExplorerManager.PROP_ROOT_CONTEXT.equals(evt.getPropertyName())) {
SwingUtilities.invokeLater(this::setColumnWidths);
} else if (ExplorerManager.PROP_EXPLORED_CONTEXT.equals(evt.getPropertyName())) {
SwingUtilities.invokeLater(this::setColumnWidths);
}
});
}
jSplitPane1.setRightComponent(new MessageBrowser(tableExplorerManager, gacEM));
}
private void setColumnWidths() {
int margin = 4;
int padding = 8;
@ -100,35 +104,29 @@ public class AccountsBrowser extends JPanel implements ExplorerManager.Provider
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane1 = new javax.swing.JSplitPane();
outlineView = new org.openide.explorer.view.OutlineView();
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(outlineView, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(outlineView, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
setLayout(new java.awt.BorderLayout());
jSplitPane1.setLeftComponent(outlineView);
add(jSplitPane1, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JSplitPane jSplitPane1;
private org.openide.explorer.view.OutlineView outlineView;
// End of variables declaration//GEN-END:variables
@Override
public ExplorerManager getExplorerManager() {
return em;
return tableEM;
}
@Override
public ExplorerManager getProxiedExplorerManager() {
return gacEM;
}
}

View File

@ -18,5 +18,6 @@ FiltersPanel.needsRefreshLabel.text=Displayed data is out of date. Press Refresh
VisualizationPanel.jButton1.text=redo layout
CVTTopComponent.vizPanel.TabConstraints.tabTitle=Visualize
VisualizationPanel.jButton2.text=pan
CVTTopComponent.browseSplitPane.TabConstraints.tabTitle=Browse
CVTTopComponent.vizSplitPane.TabConstraints.tabTitle=Visualize
CVTTopComponent.accountsBrowser.TabConstraints.tabTitle_1=Browse
CVTTopComponent.browseVisualizeTabPane.AccessibleContext.accessibleName=Visualize
CVTTopComponent.vizPanel.TabConstraints.tabTitle_1=Visualize

View File

@ -46,15 +46,20 @@
<Font name="Tahoma" size="18" style="0"/>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="CVTTopComponent.browseVisualizeTabPane.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</AccessibilityProperties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JSplitPane" name="browseSplitPane">
<Component class="org.sleuthkit.autopsy.communications.AccountsBrowser" name="accountsBrowser">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Browse">
<Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="CVTTopComponent.browseSplitPane.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="CVTTopComponent.accountsBrowser.TabConstraints.tabTitle_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="tabIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/communications/images/table.png"/>
@ -62,24 +67,13 @@
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Component class="org.sleuthkit.autopsy.communications.AccountsBrowser" name="accountsBrowser">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JSplitPane" name="vizSplitPane">
</Component>
<Component class="org.sleuthkit.autopsy.communications.VisualizationPanel" name="vizPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
<JTabbedPaneConstraints tabName="Visualize">
<Property name="tabTitle" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="CVTTopComponent.vizSplitPane.TabConstraints.tabTitle" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="CVTTopComponent.vizPanel.TabConstraints.tabTitle_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="tabIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/communications/images/emblem-web.png"/>
@ -87,18 +81,7 @@
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Component class="org.sleuthkit.autopsy.communications.VisualizationPanel" name="vizPanel">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>
</Component>
</SubComponents>
</Container>
<Component class="org.sleuthkit.autopsy.communications.FiltersPanel" name="filtersPane">

View File

@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.communications;
import com.google.common.eventbus.Subscribe;
import java.util.List;
import java.util.stream.Collectors;
import javax.swing.JSplitPane;
import org.openide.explorer.ExplorerManager;
import static org.openide.explorer.ExplorerUtils.createLookup;
import org.openide.util.Lookup;
@ -40,15 +39,16 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined;
@TopComponent.Registration(mode = "cvt", openAtStartup = false)
@RetainLocation("cvt")
@NbBundle.Messages("CVTTopComponent.name= Communications Visualization")
public final class CVTTopComponent extends TopComponent implements ExplorerManager.Provider {
public final class CVTTopComponent extends TopComponent {
private static final long serialVersionUID = 1L;
private final ExplorerManager acctsBrowserExplorerManager;
private final ExplorerManager filterToTableEXplorerManager = new ExplorerManager();
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
public CVTTopComponent() {
initComponents();
filtersPane.setExplorerManager(filterToTableEXplorerManager);
setName(Bundle.CVTTopComponent_name());
/*
@ -56,27 +56,25 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag
* use by the messages browsers so that selections in the messages
* browser can be exposed to context-sensitive actions.
*/
ExplorerManager browserExplorerManager = new ExplorerManager();
ExplorerManager vizExplorerManager = new ExplorerManager();
// ExplorerManager browserExplorerManager = new ExplorerManager();
// ExplorerManager vizExplorerManager = new ExplorerManager();
ProxyLookupImpl proxyLookup = new ProxyLookupImpl();
associateLookup(proxyLookup);
browseSplitPane.setRightComponent(new MessageBrowser(browserExplorerManager));
vizSplitPane.setRightComponent(new MessageBrowser(vizExplorerManager));
/*
* Create a second explorer manager to be discovered by the accounts
* browser and the message browser so that the browsers can both listen
* for explorer manager property events for the outline view of the
* accounts browser. This provides a mechanism for pushing selected
* Nodes from the accounts browser to the messages browser.
*/
acctsBrowserExplorerManager = new ExplorerManager();
accountsBrowser.init(acctsBrowserExplorerManager);
vizPanel.initVisualization(acctsBrowserExplorerManager);
accountsBrowser.init(filterToTableEXplorerManager);
// browseSplitPane.setRightComponent(new MessageBrowser(browserExplorerManager));
// vizSplitPane.setRightComponent(new MessageBrowser(vizExplorerManager));
// /*
// * Create a second explorer manager to be discovered by the accounts
// * browser and the message browser so that the browsers can both listen
// * for explorer manager property events for the outline view of the
// * accounts browser. This provides a mechanism for pushing selected
// * Nodes from the accounts browser to the messages browser.
// */
// acctsBrowserExplorerManager = new ExplorerManager();
browseVisualizeTabPane.addChangeListener(changeEvent -> {
JSplitPane selectedComponent = (JSplitPane) browseVisualizeTabPane.getSelectedComponent();
ExplorerManager.Provider leftComponent = (ExplorerManager.Provider) selectedComponent.getLeftComponent();
proxyLookup.changeLookup(createLookup(leftComponent.getExplorerManager(), getActionMap()));
ProxiedExplorerManagerProvider selectedComponent = (ProxiedExplorerManagerProvider) browseVisualizeTabPane.getSelectedComponent();
proxyLookup.changeLookup(createLookup(selectedComponent.getProxiedExplorerManager(), getActionMap()));
});
CVTEvents.getCVTEventBus().register(this);
@ -97,21 +95,13 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag
private void initComponents() {
browseVisualizeTabPane = new javax.swing.JTabbedPane();
browseSplitPane = new javax.swing.JSplitPane();
accountsBrowser = new org.sleuthkit.autopsy.communications.AccountsBrowser();
vizSplitPane = new javax.swing.JSplitPane();
vizPanel = new org.sleuthkit.autopsy.communications.VisualizationPanel();
filtersPane = new org.sleuthkit.autopsy.communications.FiltersPanel();
browseVisualizeTabPane.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
browseSplitPane.setLeftComponent(accountsBrowser);
browseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.browseSplitPane.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/table.png")), browseSplitPane); // NOI18N
vizSplitPane.setLeftComponent(vizPanel);
browseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.vizSplitPane.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/emblem-web.png")), vizSplitPane); // NOI18N
browseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.accountsBrowser.TabConstraints.tabTitle_1"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/table.png")), accountsBrowser); // NOI18N
browseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.vizPanel.TabConstraints.tabTitle_1"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/emblem-web.png")), vizPanel); // NOI18N
filtersPane.setMinimumSize(new java.awt.Dimension(256, 495));
@ -136,16 +126,16 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag
.addComponent(browseVisualizeTabPane)
.addContainerGap())
);
browseVisualizeTabPane.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.browseVisualizeTabPane.AccessibleContext.accessibleName")); // NOI18N
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private org.sleuthkit.autopsy.communications.AccountsBrowser accountsBrowser;
private javax.swing.JSplitPane browseSplitPane;
private javax.swing.JTabbedPane browseVisualizeTabPane;
private org.sleuthkit.autopsy.communications.FiltersPanel filtersPane;
private org.sleuthkit.autopsy.communications.VisualizationPanel vizPanel;
private javax.swing.JSplitPane vizSplitPane;
// End of variables declaration//GEN-END:variables
@Override
@ -154,11 +144,6 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag
WindowManager.getDefault().setTopComponentFloating(this, true);
}
@Override
public ExplorerManager getExplorerManager() {
return acctsBrowserExplorerManager;
}
@Override
public void open() {
super.open();
@ -184,11 +169,16 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag
private static class ProxyLookupImpl extends ProxyLookup {
public ProxyLookupImpl() {
ProxyLookupImpl() {
}
void changeLookup(Lookup l){
void changeLookup(Lookup l) {
setLookups(l);
}
}
static interface ProxiedExplorerManagerProvider {
ExplorerManager getProxiedExplorerManager();
}
}

View File

@ -30,6 +30,7 @@ import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.stream.Collectors;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import org.openide.explorer.ExplorerManager;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
@ -59,7 +60,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* Panel that holds the Filter control widgets and translates user filtering
* changes into queries against the CommunicationsManager.
*/
final public class FiltersPanel extends javax.swing.JPanel {
final public class FiltersPanel extends JPanel {
private static final Logger logger = Logger.getLogger(FiltersPanel.class.getName());
private static final long serialVersionUID = 1L;
@ -119,9 +120,9 @@ final public class FiltersPanel extends javax.swing.JPanel {
if (eventType.equals(DATA_ADDED.toString())) {
// Indicate that a refresh may be needed, unless the data added is Keyword or Hashset hits
ModuleDataEvent eventData = (ModuleDataEvent) pce.getOldValue();
if (null != eventData &&
eventData.getBlackboardArtifactType().getTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID() &&
eventData.getBlackboardArtifactType().getTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
if (null != eventData
&& eventData.getBlackboardArtifactType().getTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()
&& eventData.getBlackboardArtifactType().getTypeID() != BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()) {
updateFilters();
needsRefresh = true;
validateFilters();
@ -173,11 +174,6 @@ final public class FiltersPanel extends javax.swing.JPanel {
@Override
public void addNotify() {
super.addNotify();
/*
* Since we get the exploreremanager from the parent JComponenet, wait
* till this FiltersPanel is actaully added to a parent.
*/
em = ExplorerManager.find(this);
IngestManager.getInstance().addIngestModuleEventListener(ingestListener);
Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> {
devicesMap.clear();
@ -625,4 +621,8 @@ final public class FiltersPanel extends javax.swing.JPanel {
private final javax.swing.JButton unCheckAllAccountTypesButton = new javax.swing.JButton();
private final javax.swing.JButton unCheckAllDevicesButton = new javax.swing.JButton();
// End of variables declaration//GEN-END:variables
void setExplorerManager(ExplorerManager explorerManager) {
em = explorerManager;
}
}

View File

@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.swing.JPanel;
import org.openide.explorer.ExplorerManager;
import org.openide.nodes.Node;
import org.sleuthkit.autopsy.communications.AccountsRootChildren.AccountDeviceInstanceNode;
@ -37,9 +38,10 @@ import org.sleuthkit.datamodel.CommunicationsManager;
* The right hand side of the CVT. Has a DataResultPanel to show messages and
* other account details, and a ContentViewer to show individual
*/
final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager.Provider {
public final class MessageBrowser extends JPanel {
private static final long serialVersionUID = 1L;
private final ExplorerManager tableEM;
private final ExplorerManager gacExplorerManager;
private final DataResultPanel messagesResultPanel;
private DataResultViewerTable dataResultViewerTable;
@ -53,7 +55,8 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager
* in the messages browser can be exposed to
* context-sensitive actions.
*/
MessageBrowser(ExplorerManager gacExplorerManager) {
public MessageBrowser(ExplorerManager tableEM, ExplorerManager gacExplorerManager) {
this.tableEM = tableEM;
this.gacExplorerManager = gacExplorerManager;
initComponents();
//create an uninitialized DataResultPanel so we can control the ResultViewers that get added.
@ -61,11 +64,11 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager
splitPane.setTopComponent(messagesResultPanel);
splitPane.setBottomComponent(messageDataContent);
}
@Override
public void addNotify() {
super.addNotify();
ExplorerManager parentEm = ExplorerManager.find(this);
// ExplorerManager parentEm = ExplorerManager.find(this);
// parentEm.addPropertyChangeListener(pce -> {
// gacExplorerManager.setRootContext(parentEm.getRootContext());
// try {
@ -74,14 +77,14 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager
// Exceptions.printStackTrace(ex);
// }
// });
parentEm.addPropertyChangeListener(pce -> {
tableEM.addPropertyChangeListener(pce -> {
if (pce.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
final Node[] selectedNodes = parentEm.getSelectedNodes();
final Node[] selectedNodes = tableEM.getSelectedNodes();
messagesResultPanel.setNumMatches(0);
messagesResultPanel.setNode(null);
if (selectedNodes.length == 0) {
//reset panel when there is no selection
messagesResultPanel.setPath("");
@ -92,7 +95,7 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager
CommunicationsFilter filter = adiNode.getFilter();
CommunicationsManager commsManager = adiNode.getCommsManager();
final Set<AccountDeviceInstance> accountDeviceInstances;
if (selectedNodes.length == 1) {
final AccountDeviceInstance accountDeviceInstance = adiNode.getAccountDeviceInstance();
accountDeviceInstances = Collections.singleton(accountDeviceInstance);
@ -121,11 +124,6 @@ final class MessageBrowser extends javax.swing.JPanel implements ExplorerManager
}
messagesResultPanel.open();
}
@Override
public ExplorerManager getExplorerManager() {
return gacExplorerManager;
}
/**
* This method is called from within the constructor to initialize the form.

View File

@ -16,44 +16,66 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Container class="javax.swing.JSplitPane" name="splitPane">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="VisualizationPanel.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="VisualizationPanel.jButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="left"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="VisualizationPanel.jButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/communications/Bundle.properties" key="VisualizationPanel.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2017 Basis Technology Corp.
* Copyright 2017-18 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -26,6 +26,7 @@ import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.util.mxConstants;
import com.mxgraph.view.mxGraph;
import com.mxgraph.view.mxStylesheet;
import java.awt.BorderLayout;
import java.awt.Color;
import java.beans.PropertyVetoException;
import java.util.HashMap;
@ -42,6 +43,7 @@ import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.communications.AccountsRootChildren.AccountDeviceInstanceNode;
import org.sleuthkit.autopsy.communications.CVTTopComponent.ProxiedExplorerManagerProvider;
import static org.sleuthkit.autopsy.communications.RelationshipNode.getAttributeDisplayString;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AccountDeviceInstance;
@ -57,23 +59,25 @@ import org.sleuthkit.datamodel.TskCoreException;
/**
*
*/
public class VisualizationPanel extends JPanel implements ExplorerManager.Provider {
public class VisualizationPanel extends JPanel implements ExplorerManager.Provider, ProxiedExplorerManagerProvider {
private static final long serialVersionUID = 1L;
static final private mxStylesheet mxStylesheet = new mxStylesheet();
private ExplorerManager explorerManager;
private final mxGraph graph;
private final Map<String, mxCell> nodeMap = new HashMap<>();
private ExplorerManager vizEM = new ExplorerManager();
private final ExplorerManager gacEM = new ExplorerManager();
private final mxGraphComponent graphComponent;
private final mxGraph graph;
private final Map<String, mxCell> nodeMap = new HashMap<>();
static {
//initialize defaul cell properties
mxStylesheet.getDefaultVertexStyle().put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE);
mxStylesheet.getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, true);
}
/**
* Creates new form VizPanel
*/
public VisualizationPanel() {
initComponents();
graph = new mxGraph();
@ -89,17 +93,12 @@ public class VisualizationPanel extends JPanel implements ExplorerManager.Provid
graphComponent.setAutoScroll(true);
graphComponent.setOpaque(true);
graphComponent.setBackground(Color.WHITE);
this.add(graphComponent);
jPanel1.add(graphComponent, BorderLayout.CENTER);
splitPane.setRightComponent(new MessageBrowser(vizEM, gacEM));
CVTEvents.getCVTEventBus().register(this);
graph.setStylesheet(mxStylesheet);
}
public void initVisualization(ExplorerManager em) {
explorerManager = em;
graph.getSelectionModel().addListener(null, (sender, evt) -> {
Object[] selectionCells = graph.getSelectionCells();
if (selectionCells.length == 1) {
@ -111,8 +110,8 @@ public class VisualizationPanel extends JPanel implements ExplorerManager.Provid
final AccountDeviceInstanceNode accountDeviceInstanceNode =
new AccountDeviceInstanceNode(((AccountDeviceInstanceKey) selectionCell.getValue()),
commsManager);
explorerManager.setRootContext(SimpleParentNode.createFromChildNodes(accountDeviceInstanceNode));
explorerManager.setSelectedNodes(new Node[]{accountDeviceInstanceNode});
vizEM.setRootContext(SimpleParentNode.createFromChildNodes(accountDeviceInstanceNode));
vizEM.setSelectedNodes(new Node[]{accountDeviceInstanceNode});
} else if (selectionCell.isEdge()) {
System.out.println(selectionCell.getId());
@ -130,7 +129,12 @@ public class VisualizationPanel extends JPanel implements ExplorerManager.Provid
@Override
public ExplorerManager getExplorerManager() {
return explorerManager;
return vizEM;
}
@Override
public ExplorerManager getProxiedExplorerManager() {
return gacEM;
}
private void addEdge(mxCell pinnedAccountVertex, mxCell relatedAccountVertex) {
@ -276,24 +280,17 @@ public class VisualizationPanel extends JPanel implements ExplorerManager.Provid
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
splitPane = new javax.swing.JSplitPane();
jPanel1 = new javax.swing.JPanel();
jToolBar1 = new javax.swing.JToolBar();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
setLayout(new java.awt.BorderLayout());
jToolBar1.setRollover(true);
jPanel1.setLayout(new java.awt.BorderLayout());
jButton1.setText(org.openide.util.NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.jButton1.text")); // NOI18N
jButton1.setFocusable(false);
jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jToolBar1.add(jButton1);
jToolBar1.setRollover(true);
jButton2.setText(org.openide.util.NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.jButton2.text")); // NOI18N
jButton2.setFocusable(false);
@ -306,7 +303,22 @@ public class VisualizationPanel extends JPanel implements ExplorerManager.Provid
});
jToolBar1.add(jButton2);
add(jToolBar1, java.awt.BorderLayout.PAGE_START);
jButton1.setText(org.openide.util.NbBundle.getMessage(VisualizationPanel.class, "VisualizationPanel.jButton1.text")); // NOI18N
jButton1.setFocusable(false);
jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jToolBar1.add(jButton1);
jPanel1.add(jToolBar1, java.awt.BorderLayout.PAGE_START);
splitPane.setLeftComponent(jPanel1);
add(splitPane, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
@ -324,7 +336,9 @@ public class VisualizationPanel extends JPanel implements ExplorerManager.Provid
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JPanel jPanel1;
private javax.swing.JToolBar jToolBar1;
private javax.swing.JSplitPane splitPane;
// End of variables declaration//GEN-END:variables
static class SimpleParentNode extends AbstractNode {