19 package org.sleuthkit.autopsy.filequery;
21 import com.google.common.eventbus.Subscribe;
22 import java.awt.Color;
23 import java.util.List;
24 import java.util.stream.Collectors;
25 import javax.swing.SwingUtilities;
26 import javax.swing.event.ListSelectionEvent;
27 import javax.swing.event.ListSelectionListener;
28 import org.openide.util.NbBundle;
29 import org.openide.windows.Mode;
30 import org.openide.windows.RetainLocation;
31 import org.openide.windows.TopComponent;
32 import org.openide.windows.WindowManager;
43 @TopComponent.Description(preferredID =
"DiscoveryTopComponent", persistenceType = TopComponent.PERSISTENCE_NEVER)
44 @TopComponent.Registration(mode =
"discovery", openAtStartup =
false)
45 @RetainLocation(
"discovery")
46 @NbBundle.Messages(
"DiscoveryTopComponent.name= File Discovery")
50 private static final String
PREFERRED_ID =
"DiscoveryTopComponent";
64 setName(Bundle.DiscoveryTopComponent_name());
65 fileSearchPanel =
new FileSearchPanel();
68 groupListPanel =
new GroupListPanel();
75 resultsPanel.addListSelectionListener(
new ListSelectionListener() {
77 public void valueChanged(ListSelectionEvent e) {
78 if (!e.getValueIsAdjusting()) {
79 SwingUtilities.invokeLater(() -> {
80 AbstractFile file = resultsPanel.getSelectedFile();
106 resultsPanel.resetResultViewer();
107 groupListPanel.resetGroupList();
113 void updateSearchSettings() {
115 fileSearchPanel.resetPanel();
123 fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
128 super.componentOpened();
129 WindowManager.getDefault().setTopComponentFloating(
this,
true);
130 DiscoveryEventUtils.getDiscoveryEventBus().register(
this);
131 DiscoveryEventUtils.getDiscoveryEventBus().register(resultsPanel);
132 DiscoveryEventUtils.getDiscoveryEventBus().register(groupListPanel);
133 DiscoveryEventUtils.getDiscoveryEventBus().register(fileSearchPanel);
138 fileSearchPanel.cancelSearch();
139 DiscoveryEventUtils.getDiscoveryEventBus().unregister(
this);
140 DiscoveryEventUtils.getDiscoveryEventBus().unregister(fileSearchPanel);
141 DiscoveryEventUtils.getDiscoveryEventBus().unregister(groupListPanel);
142 DiscoveryEventUtils.getDiscoveryEventBus().unregister(resultsPanel);
143 super.componentClosed();
151 @SuppressWarnings(
"unchecked")
155 javax.swing.JSplitPane mainSplitPane =
new javax.swing.JSplitPane();
158 javax.swing.JPanel toolBarPanel =
new javax.swing.JPanel();
159 javax.swing.JToolBar toolBar =
new javax.swing.JToolBar();
161 javax.swing.JLabel stepOneLabel =
new javax.swing.JLabel();
163 javax.swing.Box.Filler filler1 =
new javax.swing.Box.Filler(
new java.awt.Dimension(62, 0),
new java.awt.Dimension(62, 0),
new java.awt.Dimension(62, 32767));
165 setPreferredSize(
new java.awt.Dimension(1400, 900));
166 setLayout(
new java.awt.BorderLayout());
168 mainSplitPane.setDividerLocation(450);
169 mainSplitPane.setPreferredSize(
new java.awt.Dimension(1400, 828));
173 leftSplitPane.setPreferredSize(
new java.awt.Dimension(400, 828));
177 rightSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
179 rightSplitPane.setPreferredSize(
new java.awt.Dimension(1000, 828));
182 add(mainSplitPane, java.awt.BorderLayout.CENTER);
184 toolBar.setFloatable(
false);
185 toolBar.setRollover(
true);
187 imagesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
189 imagesButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
191 imagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
192 imagesButton.setMaximumSize(
new java.awt.Dimension(90, 43));
193 imagesButton.setMinimumSize(
new java.awt.Dimension(90, 43));
194 imagesButton.setPreferredSize(
new java.awt.Dimension(90, 43));
195 imagesButton.addActionListener(
new java.awt.event.ActionListener() {
196 public void actionPerformed(java.awt.event.ActionEvent evt) {
201 org.openide.awt.Mnemonics.setLocalizedText(stepOneLabel,
org.openide.util.NbBundle.getMessage(
DiscoveryTopComponent.class,
"DiscoveryTopComponent.stepOneLabel.text"));
203 videosButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
205 videosButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
206 videosButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
208 videosButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
209 videosButton.setMaximumSize(
new java.awt.Dimension(90, 43));
210 videosButton.setMinimumSize(
new java.awt.Dimension(90, 43));
211 videosButton.setPreferredSize(
new java.awt.Dimension(90, 43));
212 videosButton.addActionListener(
new java.awt.event.ActionListener() {
213 public void actionPerformed(java.awt.event.ActionEvent evt) {
218 javax.swing.GroupLayout toolBarPanelLayout =
new javax.swing.GroupLayout(toolBarPanel);
219 toolBarPanel.setLayout(toolBarPanelLayout);
220 toolBarPanelLayout.setHorizontalGroup(
221 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
222 .addGroup(toolBarPanelLayout.createSequentialGroup()
223 .addContainerGap(486, Short.MAX_VALUE)
224 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
225 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, toolBarPanelLayout.createSequentialGroup()
226 .addComponent(
imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
227 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
228 .addComponent(
videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
229 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, toolBarPanelLayout.createSequentialGroup()
230 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
232 .addComponent(stepOneLabel)
233 .addGap(62, 62, 62)))
234 .addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
235 .addContainerGap(486, Short.MAX_VALUE))
237 toolBarPanelLayout.setVerticalGroup(
238 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
239 .addComponent(toolBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
240 .addGroup(toolBarPanelLayout.createSequentialGroup()
242 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
243 .addComponent(stepOneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
244 .addComponent(filler1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
245 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
246 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
247 .addComponent(
videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
248 .addComponent(
imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
252 add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
264 fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
276 fileSearchPanel.setSelectedType(FileSearchData.FileType.VIDEO);
285 void handleSearchCancelledEvent(DiscoveryEventUtils.SearchCancelledEvent searchCancelledEvent) {
286 SwingUtilities.invokeLater(() -> {
287 if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
289 }
else if (fileSearchPanel.getSelectedType() == FileType.IMAGE) {
301 void handleSearchCompletedEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompletedEvent) {
302 SwingUtilities.invokeLater(() -> {
303 if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
305 }
else if (fileSearchPanel.getSelectedType() == FileType.IMAGE) {
318 return modes.stream().filter(mode -> mode.getName().equals(
"discovery"))
319 .collect(Collectors.toList());
328 void handleSearchStartedEvent(DiscoveryEventUtils.SearchStartedEvent searchStartedEvent) {
329 SwingUtilities.invokeLater(() -> {
javax.swing.JSplitPane rightSplitPane
void videosButtonActionPerformed(java.awt.event.ActionEvent evt)
static final String PREFERRED_ID
void setNode(Node selectedNode)
final FileSearchPanel fileSearchPanel
final ResultsPanel resultsPanel
static final Color UNSELECTED_COLOR
static DataContentPanel createInstance()
javax.swing.JButton videosButton
static DiscoveryTopComponent getTopComponent()
final DataContentPanel dataContentPanel
static final long serialVersionUID
static final Color SELECTED_COLOR
void imagesButtonActionPerformed(java.awt.event.ActionEvent evt)
final GroupListPanel groupListPanel
List< Mode > availableModes(List< Mode > modes)
javax.swing.JButton imagesButton
javax.swing.JSplitPane leftSplitPane