19 package org.sleuthkit.autopsy.discovery.ui;
22 import com.google.common.eventbus.Subscribe;
23 import java.awt.Cursor;
24 import java.awt.Image;
25 import java.awt.event.ItemEvent;
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.concurrent.CancellationException;
29 import java.util.concurrent.ExecutionException;
30 import java.util.logging.Level;
31 import javax.swing.DefaultComboBoxModel;
32 import javax.swing.JOptionPane;
33 import javax.swing.SwingUtilities;
34 import javax.swing.SwingWorker;
35 import org.openide.util.NbBundle.Messages;
64 final class ResultsPanel
extends javax.swing.JPanel {
66 private static final long serialVersionUID = 1L;
67 private final static Logger logger = Logger.getLogger(ResultsPanel.class.getName());
68 private final VideoThumbnailViewer videoThumbnailViewer;
69 private final ImageThumbnailViewer imageThumbnailViewer;
70 private final DocumentPreviewViewer documentPreviewViewer;
71 private final DomainSummaryViewer domainSummaryViewer;
72 private List<AbstractFilter> searchFilters;
73 private DiscoveryAttributes.AttributeType groupingAttribute;
74 private Group.GroupSortingAlgorithm groupSort;
75 private ResultsSorter.SortingMethod fileSortMethod;
76 private GroupKey selectedGroupKey;
77 private int currentPage = 0;
78 private int previousPageSize = 10;
79 private SearchData.Type resultType;
80 private int groupSize = 0;
81 private PageWorker pageWorker;
82 private final List<SwingWorker<Void, Void>> resultContentWorkers =
new ArrayList<>();
87 @Messages({
"ResultsPanel.viewFileInDir.name=View File in Directory",
88 "ResultsPanel.openInExternalViewer.name=Open in External Viewer"})
89 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
92 imageThumbnailViewer =
new ImageThumbnailViewer();
93 videoThumbnailViewer =
new VideoThumbnailViewer();
94 documentPreviewViewer =
new DocumentPreviewViewer();
95 domainSummaryViewer =
new DomainSummaryViewer();
96 videoThumbnailViewer.addListSelectionListener((e) -> {
97 if (resultType == SearchData.Type.VIDEO) {
98 if (!e.getValueIsAdjusting()) {
100 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
103 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ClearInstanceSelectionEvent());
107 imageThumbnailViewer.addListSelectionListener((e) -> {
108 if (resultType == SearchData.Type.IMAGE) {
109 if (!e.getValueIsAdjusting()) {
111 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
114 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ClearInstanceSelectionEvent());
119 documentPreviewViewer.addListSelectionListener((e) -> {
120 if (resultType == SearchData.Type.DOCUMENT) {
121 if (!e.getValueIsAdjusting()) {
123 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
126 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ClearInstanceSelectionEvent());
130 domainSummaryViewer.addListSelectionListener((e) -> {
131 if (resultType == SearchData.Type.DOMAIN && !e.getValueIsAdjusting()) {
132 domainSummaryViewer.sendPopulateEvent();
137 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
138 SearchData.Type getActiveType() {
149 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
150 private List<AbstractFile> getInstancesForSelected() {
151 if (null != resultType) {
152 switch (resultType) {
154 return videoThumbnailViewer.getInstancesForSelected();
156 return imageThumbnailViewer.getInstancesForSelected();
158 return documentPreviewViewer.getInstancesForSelected();
163 return new ArrayList<>();
172 void handleSearchStartedEvent(DiscoveryEventUtils.SearchStartedEvent searchStartedEvent) {
173 SwingUtilities.invokeLater(() -> {
174 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
184 void handlePageRetrievedEvent(DiscoveryEventUtils.PageRetrievedEvent pageRetrievedEvent) {
186 if (pageRetrievedEvent.getType() != DOMAIN) {
187 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
189 currentPage = pageRetrievedEvent.getPageNumber();
190 SwingUtilities.invokeLater(() -> {
193 if (null != pageRetrievedEvent.getType()) {
194 switch (pageRetrievedEvent.getType()) {
196 populateImageViewer(pageRetrievedEvent.getSearchResults());
197 resultsViewerPanel.add(imageThumbnailViewer);
200 populateVideoViewer(pageRetrievedEvent.getSearchResults());
201 resultsViewerPanel.add(videoThumbnailViewer);
204 populateDocumentViewer(pageRetrievedEvent.getSearchResults());
205 resultsViewerPanel.add(documentPreviewViewer);
208 populateDomainViewer(pageRetrievedEvent.getSearchResults());
209 resultsViewerPanel.add(domainSummaryViewer);
215 resultsViewerPanel.revalidate();
216 resultsViewerPanel.repaint();
221 void handleCancelBackgroundTasksEvent(DiscoveryEventUtils.CancelBackgroundTasksEvent cancelEvent) {
222 for (SwingWorker<Void, Void> thumbWorker : resultContentWorkers) {
223 if (!thumbWorker.isDone()) {
224 thumbWorker.cancel(
true);
227 resultContentWorkers.clear();
234 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
235 void resetResultViewer() {
236 resultsViewerPanel.remove(imageThumbnailViewer);
237 resultsViewerPanel.remove(videoThumbnailViewer);
238 resultsViewerPanel.remove(documentPreviewViewer);
239 resultsViewerPanel.remove(domainSummaryViewer);
241 for (SwingWorker<Void, Void> thumbWorker : resultContentWorkers) {
242 if (!thumbWorker.isDone()) {
243 thumbWorker.cancel(
true);
247 resultContentWorkers.clear();
248 videoThumbnailViewer.clearViewer();
249 imageThumbnailViewer.clearViewer();
250 documentPreviewViewer.clearViewer();
251 domainSummaryViewer.clearViewer();
260 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
261 void populateVideoViewer(List<Result> results) {
262 for (Result result : results) {
263 VideoThumbnailWorker thumbWorker =
new VideoThumbnailWorker((ResultFile) result);
264 thumbWorker.execute();
266 resultContentWorkers.add(thumbWorker);
276 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
277 void populateImageViewer(List<Result> results) {
278 for (Result result : results) {
279 ImageThumbnailWorker thumbWorker =
new ImageThumbnailWorker((ResultFile) result);
280 thumbWorker.execute();
282 resultContentWorkers.add(thumbWorker);
293 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
294 void populateDocumentViewer(List<Result> results) {
295 for (Result result : results) {
296 DocumentPreviewWorker documentWorker =
new DocumentPreviewWorker((ResultFile) result);
297 documentWorker.execute();
299 resultContentWorkers.add(documentWorker);
310 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
311 void populateDomainViewer(List<Result> results) {
312 SleuthkitCase currentCase;
314 currentCase = Case.getCurrentCaseThrows().getSleuthkitCase();
315 }
catch (NoCurrentCaseException ex) {
320 for (Result result : results) {
321 DomainThumbnailWorker domainWorker =
new DomainThumbnailWorker(
322 currentCase, (ResultDomain) result);
323 domainWorker.execute();
325 resultContentWorkers.add(domainWorker);
335 void handleGroupSelectedEvent(DiscoveryEventUtils.GroupSelectedEvent groupSelectedEvent) {
336 searchFilters = groupSelectedEvent.getFilters();
337 groupingAttribute = groupSelectedEvent.getGroupingAttr();
338 groupSort = groupSelectedEvent.getGroupSort();
339 fileSortMethod = groupSelectedEvent.getResultSort();
340 selectedGroupKey = groupSelectedEvent.getGroupKey();
341 resultType = groupSelectedEvent.getResultType();
342 groupSize = groupSelectedEvent.getGroupSize();
343 SwingUtilities.invokeLater(() -> {
356 void handleNoResultsEvent(DiscoveryEventUtils.NoResultsEvent noResultsEvent) {
359 SwingUtilities.invokeLater(() -> {
361 videoThumbnailViewer.clearViewer();
362 imageThumbnailViewer.clearViewer();
363 documentPreviewViewer.clearViewer();
364 domainSummaryViewer.clearViewer();
365 resultsViewerPanel.revalidate();
366 resultsViewerPanel.repaint();
376 void handleSearchCompleteEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompleteEvent) {
377 SwingUtilities.invokeLater(() -> {
378 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
388 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
389 private
void setPage(
int startingEntry) {
390 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
391 if (pageWorker != null && !pageWorker.isDone()) {
392 pageWorker.cancel(
true);
394 CentralRepository centralRepo = null;
395 if (CentralRepository.isEnabled()) {
397 centralRepo = CentralRepository.getInstance();
398 }
catch (CentralRepoException ex) {
400 logger.log(Level.SEVERE,
"Error loading central repository database, no central repository options will be available for Discovery", ex);
403 if (groupSize != 0) {
404 pageWorker =
new PageWorker(searchFilters, groupingAttribute, groupSort, fileSortMethod, selectedGroupKey, startingEntry, pageSize, resultType, centralRepo);
405 pageWorker.execute();
407 pageSizeComboBox.setEnabled(
true);
414 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
415 @Messages({
"# {0} - currentPage",
416 "# {1} - totalPages",
417 "ResultsPanel.currentPage.displayValue=Page: {0} of {1}"})
418 private void updateControls() {
419 previousPageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
420 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
422 double maxPageDouble = groupSize == 0 ? 1 : Math.ceil((
double) groupSize / pageSize);
423 currentPageLabel.setText(Bundle.ResultsPanel_currentPage_displayValue(currentPage + 1, maxPageDouble));
424 previousPageButton.setEnabled(currentPage != 0);
425 nextPageButton.setEnabled(groupSize > ((currentPage + 1) * pageSize));
426 gotoPageField.setEnabled(groupSize > pageSize);
427 pageSizeComboBox.setEnabled(
true);
435 @SuppressWarnings(
"unchecked")
437 private
void initComponents() {
438 java.awt.GridBagConstraints gridBagConstraints;
440 javax.swing.JPanel pagingPanel =
new javax.swing.JPanel();
441 previousPageButton =
new javax.swing.JButton();
442 currentPageLabel =
new javax.swing.JLabel();
443 nextPageButton =
new javax.swing.JButton();
444 javax.swing.JLabel pageControlsLabel =
new javax.swing.JLabel();
445 javax.swing.JLabel gotoPageLabel =
new javax.swing.JLabel();
446 gotoPageField =
new javax.swing.JTextField();
447 javax.swing.JLabel pageSizeLabel =
new javax.swing.JLabel();
448 pageSizeComboBox =
new javax.swing.JComboBox<>();
449 javax.swing.Box.Filler filler1 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 0),
new java.awt.Dimension(0, 0),
new java.awt.Dimension(32767, 0));
450 javax.swing.Box.Filler filler2 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 0),
new java.awt.Dimension(0, 0),
new java.awt.Dimension(32767, 0));
451 javax.swing.Box.Filler filler3 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 0),
new java.awt.Dimension(0, 0),
new java.awt.Dimension(32767, 0));
452 javax.swing.Box.Filler filler4 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 0),
new java.awt.Dimension(0, 0),
new java.awt.Dimension(32767, 0));
453 resultsViewerPanel =
new javax.swing.JPanel();
455 setMinimumSize(
new java.awt.Dimension(300, 60));
456 setPreferredSize(
new java.awt.Dimension(700, 700));
457 setLayout(
new java.awt.BorderLayout());
459 pagingPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
460 pagingPanel.setMinimumSize(
new java.awt.Dimension(400, 39));
461 pagingPanel.setPreferredSize(
new java.awt.Dimension(700, 39));
462 pagingPanel.setLayout(
new java.awt.GridBagLayout());
464 previousPageButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_back.png")));
465 previousPageButton.setBorder(null);
466 previousPageButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png")));
467 previousPageButton.setEnabled(
false);
468 previousPageButton.setFocusable(
false);
469 previousPageButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png")));
470 previousPageButton.addActionListener(
new java.awt.event.ActionListener() {
471 public void actionPerformed(java.awt.event.ActionEvent evt) {
472 previousPageButtonActionPerformed(evt);
475 gridBagConstraints =
new java.awt.GridBagConstraints();
476 gridBagConstraints.gridx = 3;
477 gridBagConstraints.gridy = 0;
478 gridBagConstraints.gridheight = 2;
479 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
480 gridBagConstraints.insets =
new java.awt.Insets(6, 12, 6, 0);
481 pagingPanel.add(previousPageButton, gridBagConstraints);
483 org.openide.awt.Mnemonics.setLocalizedText(currentPageLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.currentPageLabel.text"));
484 currentPageLabel.setMaximumSize(
new java.awt.Dimension(190, 23));
485 currentPageLabel.setMinimumSize(
new java.awt.Dimension(90, 23));
486 currentPageLabel.setPreferredSize(
new java.awt.Dimension(100, 23));
487 gridBagConstraints =
new java.awt.GridBagConstraints();
488 gridBagConstraints.gridx = 0;
489 gridBagConstraints.gridy = 0;
490 gridBagConstraints.gridheight = 2;
491 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
492 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
493 gridBagConstraints.insets =
new java.awt.Insets(6, 14, 6, 0);
494 pagingPanel.add(currentPageLabel, gridBagConstraints);
496 nextPageButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png")));
497 nextPageButton.setBorder(null);
498 nextPageButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_forward_disabled.png")));
499 nextPageButton.setEnabled(
false);
500 nextPageButton.setFocusable(
false);
501 nextPageButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png")));
502 nextPageButton.addActionListener(
new java.awt.event.ActionListener() {
503 public void actionPerformed(java.awt.event.ActionEvent evt) {
504 nextPageButtonActionPerformed(evt);
507 gridBagConstraints =
new java.awt.GridBagConstraints();
508 gridBagConstraints.gridx = 4;
509 gridBagConstraints.gridy = 0;
510 gridBagConstraints.gridheight = 2;
511 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
512 gridBagConstraints.insets =
new java.awt.Insets(6, 0, 6, 0);
513 pagingPanel.add(nextPageButton, gridBagConstraints);
515 pageControlsLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
516 org.openide.awt.Mnemonics.setLocalizedText(pageControlsLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.pageControlsLabel.text"));
517 pageControlsLabel.setMaximumSize(
new java.awt.Dimension(133, 23));
518 pageControlsLabel.setMinimumSize(
new java.awt.Dimension(33, 23));
519 pageControlsLabel.setPreferredSize(
new java.awt.Dimension(60, 23));
520 gridBagConstraints =
new java.awt.GridBagConstraints();
521 gridBagConstraints.gridx = 2;
522 gridBagConstraints.gridy = 0;
523 gridBagConstraints.gridheight = 2;
524 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
525 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
526 gridBagConstraints.insets =
new java.awt.Insets(6, 18, 6, 0);
527 pagingPanel.add(pageControlsLabel, gridBagConstraints);
529 gotoPageLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
530 org.openide.awt.Mnemonics.setLocalizedText(gotoPageLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.gotoPageLabel.text"));
531 gotoPageLabel.setMaximumSize(
new java.awt.Dimension(170, 23));
532 gotoPageLabel.setMinimumSize(
new java.awt.Dimension(70, 23));
533 gotoPageLabel.setPreferredSize(
new java.awt.Dimension(100, 23));
534 gridBagConstraints =
new java.awt.GridBagConstraints();
535 gridBagConstraints.gridx = 6;
536 gridBagConstraints.gridy = 0;
537 gridBagConstraints.gridheight = 2;
538 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
539 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
540 gridBagConstraints.insets =
new java.awt.Insets(6, 18, 6, 0);
541 pagingPanel.add(gotoPageLabel, gridBagConstraints);
543 gotoPageField.setEnabled(
false);
544 gotoPageField.setMinimumSize(
new java.awt.Dimension(30, 22));
545 gotoPageField.setName(
"");
546 gotoPageField.setPreferredSize(
new java.awt.Dimension(26, 22));
547 gotoPageField.addActionListener(
new java.awt.event.ActionListener() {
548 public void actionPerformed(java.awt.event.ActionEvent evt) {
549 gotoPageFieldActionPerformed(evt);
552 gridBagConstraints =
new java.awt.GridBagConstraints();
553 gridBagConstraints.gridx = 7;
554 gridBagConstraints.gridy = 0;
555 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
556 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
557 gridBagConstraints.insets =
new java.awt.Insets(6, 5, 0, 0);
558 pagingPanel.add(gotoPageField, gridBagConstraints);
560 pageSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
561 org.openide.awt.Mnemonics.setLocalizedText(pageSizeLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.pageSizeLabel.text"));
562 pageSizeLabel.setMaximumSize(
new java.awt.Dimension(160, 23));
563 pageSizeLabel.setMinimumSize(
new java.awt.Dimension(60, 23));
564 pageSizeLabel.setPreferredSize(
new java.awt.Dimension(90, 23));
565 gridBagConstraints =
new java.awt.GridBagConstraints();
566 gridBagConstraints.gridx = 9;
567 gridBagConstraints.gridy = 0;
568 gridBagConstraints.gridheight = 2;
569 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
570 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
571 gridBagConstraints.insets =
new java.awt.Insets(6, 18, 6, 0);
572 pagingPanel.add(pageSizeLabel, gridBagConstraints);
574 pageSizeComboBox.setModel(
new DefaultComboBoxModel<Integer>(
new Integer[] {25,50,75,100,125,150,175,200}));
575 pageSizeComboBox.setSelectedIndex(3);
576 pageSizeComboBox.addItemListener(
new java.awt.event.ItemListener() {
577 public void itemStateChanged(java.awt.event.ItemEvent evt) {
578 pageSizeChanged(evt);
581 gridBagConstraints =
new java.awt.GridBagConstraints();
582 gridBagConstraints.gridx = 10;
583 gridBagConstraints.gridy = 0;
584 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
585 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
586 gridBagConstraints.insets =
new java.awt.Insets(6, 5, 0, 277);
587 pagingPanel.add(pageSizeComboBox, gridBagConstraints);
588 gridBagConstraints =
new java.awt.GridBagConstraints();
589 gridBagConstraints.gridx = 11;
590 gridBagConstraints.gridy = 0;
591 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
592 gridBagConstraints.weightx = 0.1;
593 pagingPanel.add(filler1, gridBagConstraints);
594 gridBagConstraints =
new java.awt.GridBagConstraints();
595 gridBagConstraints.gridx = 1;
596 gridBagConstraints.gridy = 0;
597 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
598 pagingPanel.add(filler2, gridBagConstraints);
599 gridBagConstraints =
new java.awt.GridBagConstraints();
600 gridBagConstraints.gridx = 5;
601 gridBagConstraints.gridy = 0;
602 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
603 pagingPanel.add(filler3, gridBagConstraints);
604 gridBagConstraints =
new java.awt.GridBagConstraints();
605 gridBagConstraints.gridx = 8;
606 gridBagConstraints.gridy = 0;
607 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
608 pagingPanel.add(filler4, gridBagConstraints);
610 add(pagingPanel, java.awt.BorderLayout.PAGE_START);
612 resultsViewerPanel.setMinimumSize(
new java.awt.Dimension(0, 60));
613 resultsViewerPanel.setPreferredSize(
new java.awt.Dimension(700, 700));
614 resultsViewerPanel.setLayout(
new java.awt.BorderLayout());
615 add(resultsViewerPanel, java.awt.BorderLayout.CENTER);
623 private void previousPageButtonActionPerformed(java.awt.event.ActionEvent evt) {
624 if (currentPage > 0) {
625 disablePagingControls();
626 int previousPage = currentPage - 1;
627 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
628 setPage(previousPage * pageSize);
637 private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {
638 disablePagingControls();
639 int nextPage = currentPage + 1;
640 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
641 setPage(nextPage * pageSize);
649 @Messages({
"# {0} - selectedPage",
651 "ResultsPanel.invalidPageNumber.message=The selected page number {0} does not exist. Please select a value from 1 to {1}.",
652 "ResultsPanel.invalidPageNumber.title=Invalid Page Number"})
653 private void gotoPageFieldActionPerformed(java.awt.event.ActionEvent evt) {
656 newPage = Integer.parseInt(gotoPageField.getText());
657 }
catch (NumberFormatException e) {
661 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
662 if ((newPage - 1) < 0 || groupSize <= ((newPage - 1) * pageSize)) {
663 JOptionPane.showMessageDialog(
this,
664 Bundle.ResultsPanel_invalidPageNumber_message(newPage, Math.ceil((
double) groupSize / pageSize)),
665 Bundle.ResultsPanel_invalidPageNumber_title(),
666 JOptionPane.WARNING_MESSAGE);
669 disablePagingControls();
670 setPage((newPage - 1) * pageSize);
673 private void pageSizeChanged(java.awt.event.ItemEvent evt) {
674 if (evt.getStateChange() == ItemEvent.SELECTED) {
675 disablePagingControls();
676 int previousPage = currentPage - 1;
677 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
678 if (previousPageSize != pageSize) {
681 setPage(previousPage * pageSize);
688 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
689 private
void disablePagingControls() {
690 nextPageButton.setEnabled(
false);
691 previousPageButton.setEnabled(
false);
692 gotoPageField.setEnabled(
false);
693 pageSizeComboBox.setEnabled(
false);
697 private javax.swing.JLabel currentPageLabel;
698 private javax.swing.JTextField gotoPageField;
699 private javax.swing.JButton nextPageButton;
700 private javax.swing.JComboBox<Integer> pageSizeComboBox;
701 private javax.swing.JButton previousPageButton;
702 private javax.swing.JPanel resultsViewerPanel;
721 thumbnailWrapper =
new VideoThumbnailsWrapper(file);
722 videoThumbnailViewer.addVideo(thumbnailWrapper);
727 DiscoveryUiUtils.getVideoThumbnails(thumbnailWrapper);
735 }
catch (InterruptedException | ExecutionException ex) {
736 logger.log(Level.WARNING,
"Video Worker Exception for file: " + thumbnailWrapper.getResultFile().getFirstInstance().getId(), ex);
737 }
catch (CancellationException ignored) {
740 videoThumbnailViewer.repaint();
760 thumbnailWrapper =
new ImageThumbnailWrapper(file);
761 imageThumbnailViewer.addImage(thumbnailWrapper);
767 if (thumbnail != null) {
768 thumbnailWrapper.setImageThumbnail(thumbnail);
777 }
catch (InterruptedException | ExecutionException ex) {
778 logger.log(Level.WARNING,
"Image Worker Exception for file: " + thumbnailWrapper.getResultFile().getFirstInstance().getId(), ex);
779 }
catch (CancellationException ignored) {
782 imageThumbnailViewer.repaint();
803 documentWrapper =
new DocumentWrapper(file);
804 documentPreviewViewer.addDocument(documentWrapper);
807 @Messages({
"ResultsPanel.unableToCreate.text=Unable to create summary."})
811 if (preview == null) {
812 preview =
new TextSummary(Bundle.ResultsPanel_unableToCreate_text(), null, 0);
814 documentWrapper.setSummary(preview);
818 @Messages({
"ResultsPanel.documentPreview.text=Document preview creation cancelled."})
823 }
catch (InterruptedException | ExecutionException ex) {
824 documentWrapper.setSummary(
new TextSummary(ex.getMessage(), null, 0));
825 logger.log(Level.WARNING,
"Document Worker Exception", ex);
826 }
catch (CancellationException ignored) {
827 documentWrapper.setSummary(
new TextSummary(Bundle.ResultsPanel_documentPreview_text(), null, 0));
830 documentPreviewViewer.repaint();
852 this.caseDb = caseDb;
854 domainSummaryViewer.addDomain(domainWrapper);
862 domainWrapper.getResultDomain().
getDomain(),
867 domainWrapper.setThumbnail(thumbnail);
875 }
catch (ExecutionException ex) {
876 domainWrapper.setThumbnail(null);
877 logger.log(Level.WARNING,
"Fatal error getting thumbnail for domain.", ex);
878 }
catch (InterruptedException | CancellationException ignored) {
879 domainWrapper.setThumbnail(null);
882 domainSummaryViewer.repaint();
final ImageThumbnailWrapper thumbnailWrapper
static TextSummary summarize(AbstractFile file)
final DocumentWrapper documentWrapper
final SleuthkitCase caseDb
static final int ICON_SIZE_MEDIUM
final DomainWrapper domainWrapper
final VideoThumbnailsWrapper thumbnailWrapper
static BufferedImage getThumbnail(Content content, int iconSize)
static final int ICON_SIZE_LARGE
Image getThumbnail(DomainSearchThumbnailRequest thumbnailRequest)