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;
42 @TopComponent.Description(preferredID =
"DiscoveryTopComponent", persistenceType = TopComponent.PERSISTENCE_NEVER)
43 @TopComponent.Registration(mode =
"discovery", openAtStartup =
false)
44 @RetainLocation(
"discovery")
45 @NbBundle.Messages(
"DiscoveryTopComponent.name= File Discovery")
49 private static final String
PREFERRED_ID =
"DiscoveryTopComponent";
63 setName(Bundle.DiscoveryTopComponent_name());
64 fileSearchPanel =
new FileSearchPanel();
67 groupListPanel =
new GroupListPanel();
74 resultsPanel.addListSelectionListener(
new ListSelectionListener() {
76 public void valueChanged(ListSelectionEvent e) {
77 if (!e.getValueIsAdjusting()) {
78 SwingUtilities.invokeLater(() -> {
79 AbstractFile file = resultsPanel.getSelectedFile();
105 resultsPanel.resetResultViewer();
106 groupListPanel.resetGroupList();
112 void updateSearchSettings() {
114 fileSearchPanel.resetPanel();
125 fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
130 super.componentOpened();
131 WindowManager.getDefault().setTopComponentFloating(
this,
true);
132 DiscoveryEventUtils.getDiscoveryEventBus().register(
this);
133 DiscoveryEventUtils.getDiscoveryEventBus().register(resultsPanel);
134 DiscoveryEventUtils.getDiscoveryEventBus().register(groupListPanel);
135 DiscoveryEventUtils.getDiscoveryEventBus().register(fileSearchPanel);
140 fileSearchPanel.cancelSearch();
141 DiscoveryEventUtils.getDiscoveryEventBus().unregister(
this);
142 DiscoveryEventUtils.getDiscoveryEventBus().unregister(fileSearchPanel);
143 DiscoveryEventUtils.getDiscoveryEventBus().unregister(groupListPanel);
144 DiscoveryEventUtils.getDiscoveryEventBus().unregister(resultsPanel);
145 super.componentClosed();
153 @SuppressWarnings(
"unchecked")
157 javax.swing.JSplitPane mainSplitPane =
new javax.swing.JSplitPane();
160 javax.swing.JPanel toolBarPanel =
new javax.swing.JPanel();
162 javax.swing.JLabel stepOneLabel =
new javax.swing.JLabel();
164 javax.swing.Box.Filler filler1 =
new javax.swing.Box.Filler(
new java.awt.Dimension(119, 0),
new java.awt.Dimension(119, 0),
new java.awt.Dimension(119, 32767));
167 setPreferredSize(
new java.awt.Dimension(1400, 900));
168 setLayout(
new java.awt.BorderLayout());
170 mainSplitPane.setDividerLocation(450);
171 mainSplitPane.setPreferredSize(
new java.awt.Dimension(1400, 828));
175 leftSplitPane.setPreferredSize(
new java.awt.Dimension(400, 828));
179 rightSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
181 rightSplitPane.setPreferredSize(
new java.awt.Dimension(1000, 828));
184 add(mainSplitPane, java.awt.BorderLayout.CENTER);
186 imagesButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
188 imagesButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/pictures-icon.png")));
190 imagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
191 imagesButton.setMaximumSize(
new java.awt.Dimension(90, 43));
192 imagesButton.setMinimumSize(
new java.awt.Dimension(90, 43));
193 imagesButton.setPreferredSize(
new java.awt.Dimension(90, 43));
194 imagesButton.addActionListener(
new java.awt.event.ActionListener() {
195 public void actionPerformed(java.awt.event.ActionEvent evt) {
200 org.openide.awt.Mnemonics.setLocalizedText(stepOneLabel,
org.openide.util.NbBundle.getMessage(
DiscoveryTopComponent.class,
"DiscoveryTopComponent.stepOneLabel.text"));
202 videosButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
204 videosButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
205 videosButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/video-icon.png")));
207 videosButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
208 videosButton.setMaximumSize(
new java.awt.Dimension(90, 43));
209 videosButton.setMinimumSize(
new java.awt.Dimension(90, 43));
210 videosButton.setPreferredSize(
new java.awt.Dimension(90, 43));
211 videosButton.addActionListener(
new java.awt.event.ActionListener() {
212 public void actionPerformed(java.awt.event.ActionEvent evt) {
217 documentsButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
219 documentsButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
220 documentsButton.setDisabledSelectedIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/documents-icon.png")));
222 documentsButton.addActionListener(
new java.awt.event.ActionListener() {
223 public void actionPerformed(java.awt.event.ActionEvent evt) {
228 javax.swing.GroupLayout toolBarPanelLayout =
new javax.swing.GroupLayout(toolBarPanel);
229 toolBarPanel.setLayout(toolBarPanelLayout);
230 toolBarPanelLayout.setHorizontalGroup(
231 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
232 .addGroup(toolBarPanelLayout.createSequentialGroup()
233 .addContainerGap(414, Short.MAX_VALUE)
234 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
235 .addGroup(toolBarPanelLayout.createSequentialGroup()
236 .addComponent(
imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
237 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
238 .addComponent(
videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
239 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
241 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, toolBarPanelLayout.createSequentialGroup()
242 .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
244 .addComponent(stepOneLabel)
245 .addGap(119, 119, 119)))
246 .addContainerGap(413, Short.MAX_VALUE))
249 toolBarPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {documentsButton, imagesButton, videosButton});
251 toolBarPanelLayout.setVerticalGroup(
252 toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
253 .addGroup(toolBarPanelLayout.createSequentialGroup()
255 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
256 .addComponent(stepOneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
257 .addComponent(filler1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
258 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
259 .addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
260 .addComponent(
videosButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
261 .addComponent(
imagesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
262 .addComponent(
documentsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
266 toolBarPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
new java.awt.Component[] {documentsButton, imagesButton, videosButton});
268 add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
283 fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
298 fileSearchPanel.setSelectedType(FileSearchData.FileType.VIDEO);
313 fileSearchPanel.setSelectedType(FileSearchData.FileType.DOCUMENTS);
322 void handleSearchCancelledEvent(DiscoveryEventUtils.SearchCancelledEvent searchCancelledEvent) {
323 SwingUtilities.invokeLater(() -> {
324 if (null != fileSearchPanel.getSelectedType()) {
325 switch (fileSearchPanel.getSelectedType()) {
352 void handleSearchCompletedEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompletedEvent) {
353 SwingUtilities.invokeLater(() -> {
354 if (null != fileSearchPanel.getSelectedType()) {
355 switch (fileSearchPanel.getSelectedType()) {
382 return modes.stream().filter(mode -> mode.getName().equals(
"discovery"))
383 .collect(Collectors.toList());
392 void handleSearchStartedEvent(DiscoveryEventUtils.SearchStartedEvent searchStartedEvent) {
393 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
javax.swing.JButton documentsButton
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 documentsButtonActionPerformed(java.awt.event.ActionEvent evt)
void imagesButtonActionPerformed(java.awt.event.ActionEvent evt)
final GroupListPanel groupListPanel
List< Mode > availableModes(List< Mode > modes)
javax.swing.JButton imagesButton
javax.swing.JSplitPane leftSplitPane