19 package org.sleuthkit.autopsy.communications;
21 import com.google.common.eventbus.Subscribe;
22 import java.awt.BorderLayout;
23 import java.awt.Component;
25 import java.awt.event.MouseAdapter;
26 import java.awt.event.MouseEvent;
27 import java.util.HashSet;
28 import java.util.List;
29 import java.util.stream.Collectors;
30 import javax.swing.ImageIcon;
31 import javax.swing.JPanel;
32 import javax.swing.JSplitPane;
33 import javax.swing.JTabbedPane;
34 import org.openide.util.Lookup;
35 import org.openide.util.NbBundle;
36 import org.openide.windows.Mode;
37 import org.openide.windows.RetainLocation;
38 import org.openide.windows.TopComponent;
39 import org.openide.windows.WindowManager;
48 @TopComponent.Description(preferredID =
"CVTTopComponent", persistenceType = TopComponent.PERSISTENCE_NEVER)
49 @TopComponent.Registration(mode =
"cvt", openAtStartup =
false)
50 @RetainLocation(
"cvt")
51 @NbBundle.Messages(
"CVTTopComponent.name= Communications Visualization")
52 @SuppressWarnings(
"PMD.SingularField")
55 private static final long serialVersionUID = 1L;
56 private boolean filtersVisible =
true;
64 splitPane.setRightComponent(relationshipBrowser);
65 splitPane.setDividerLocation(0.25);
67 setName(Bundle.CVTTopComponent_name());
75 associateLookup(proxyLookup);
77 browseVisualizeTabPane.addChangeListener(changeEvent -> {
78 Component selectedComponent = browseVisualizeTabPane.getSelectedComponent();
79 if(selectedComponent instanceof Lookup.Provider) {
80 Lookup lookup = ((Lookup.Provider)selectedComponent).getLookup();
81 proxyLookup.setNewLookups(lookup);
92 CVTEvents.getCVTEventBus().register(
this);
93 CVTEvents.getCVTEventBus().register(vizPanel);
94 CVTEvents.getCVTEventBus().register(accountsBrowser);
95 CVTEvents.getCVTEventBus().register(filtersPane);
97 filterTabbedPane.setIconAt(0,
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/arrow-left.png")));
98 filterTabbedPane.setTitleAt(0,
"");
102 void pinAccount(CVTEvents.PinAccountsEvent pinEvent) {
103 browseVisualizeTabPane.setSelectedIndex(1);
107 void handle(
final CVTEvents.FilterChangeEvent filterChangeEvent) {
108 currentFilter = filterChangeEvent.getNewFilter();
119 filterTabbedPane =
new JTabbedPane();
120 filterTabPanel =
new JPanel();
122 splitPane =
new JSplitPane();
123 browseVisualizeTabPane =
new JTabbedPane();
127 setLayout(
new BorderLayout());
129 filterTabbedPane.addMouseListener(
new MouseAdapter() {
130 public void mouseClicked(MouseEvent evt) {
131 filterTabbedPaneMouseClicked(evt);
135 filterTabPanel.setLayout(
new BorderLayout());
136 filterTabPanel.add(filtersPane, BorderLayout.CENTER);
138 filterTabbedPane.addTab(NbBundle.getMessage(
CVTTopComponent.class,
"CVTTopComponent.filterTabPanel.TabConstraints.tabTitle"), filterTabPanel);
140 add(filterTabbedPane, BorderLayout.WEST);
142 splitPane.setDividerLocation(1);
143 splitPane.setResizeWeight(0.25);
145 browseVisualizeTabPane.setFont(
new Font(
"Tahoma", 0, 18));
146 browseVisualizeTabPane.addTab(NbBundle.getMessage(
CVTTopComponent.class,
"CVTTopComponent.accountsBrowser.TabConstraints.tabTitle_1"),
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/table.png")), accountsBrowser);
147 browseVisualizeTabPane.addTab(NbBundle.getMessage(
CVTTopComponent.class,
"CVTTopComponent.vizPanel.TabConstraints.tabTitle_1"),
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/emblem-web.png")), vizPanel);
149 splitPane.setLeftComponent(browseVisualizeTabPane);
150 browseVisualizeTabPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(
CVTTopComponent.class,
"CVTTopComponent.browseVisualizeTabPane.AccessibleContext.accessibleName"));
152 add(splitPane, BorderLayout.CENTER);
156 int index = filterTabbedPane.indexAtLocation(evt.getX(), evt.getY());
159 filterTabbedPane.setIconAt(0,
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/arrow-right.png")));
160 filterTabPanel.removeAll();
161 filterTabPanel.revalidate();
162 filtersVisible =
false;
164 filterTabbedPane.setIconAt(0,
new ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/arrow-left.png")));
165 filterTabPanel.add(filtersPane, BorderLayout.CENTER);
166 filterTabPanel.revalidate();
167 filtersVisible =
true;
185 super.componentOpened();
186 WindowManager.getDefault().setTopComponentFloating(
this,
true);
198 filtersPane.updateAndApplyFilters(
true);
208 return modes.stream().filter(mode -> mode.getName().equals(
"cvt"))
209 .collect(Collectors.toList());
void setSelectionInfo(SelectionInfo info)
VisualizationPanel vizPanel
CommunicationsFilter currentFilter
JTabbedPane browseVisualizeTabPane
AccountsBrowser accountsBrowser
void filterTabbedPaneMouseClicked(MouseEvent evt)
List< Mode > availableModes(List< Mode > modes)
JTabbedPane filterTabbedPane