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;
63 final class ResultsPanel
extends javax.swing.JPanel {
65 private static final long serialVersionUID = 1L;
66 private final static Logger logger = Logger.getLogger(ResultsPanel.class.getName());
67 private final VideoThumbnailViewer videoThumbnailViewer;
68 private final ImageThumbnailViewer imageThumbnailViewer;
69 private final DocumentPreviewViewer documentPreviewViewer;
70 private final DomainSummaryViewer domainSummaryViewer;
71 private List<AbstractFilter> searchFilters;
72 private DiscoveryAttributes.AttributeType groupingAttribute;
73 private Group.GroupSortingAlgorithm groupSort;
74 private ResultsSorter.SortingMethod fileSortMethod;
75 private GroupKey selectedGroupKey;
76 private int currentPage = 0;
77 private int previousPageSize = 10;
78 private SearchData.Type resultType;
79 private int groupSize = 0;
80 private PageWorker pageWorker;
81 private final List<SwingWorker<Void, Void>> resultContentWorkers =
new ArrayList<>();
86 @Messages({
"ResultsPanel.viewFileInDir.name=View File in Directory",
87 "ResultsPanel.openInExternalViewer.name=Open in External Viewer"})
90 imageThumbnailViewer =
new ImageThumbnailViewer();
91 videoThumbnailViewer =
new VideoThumbnailViewer();
92 documentPreviewViewer =
new DocumentPreviewViewer();
93 domainSummaryViewer =
new DomainSummaryViewer();
94 videoThumbnailViewer.addListSelectionListener((e) -> {
95 if (resultType == SearchData.Type.VIDEO) {
96 if (!e.getValueIsAdjusting()) {
98 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
101 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ClearInstanceSelectionEvent());
105 imageThumbnailViewer.addListSelectionListener((e) -> {
106 if (resultType == SearchData.Type.IMAGE) {
107 if (!e.getValueIsAdjusting()) {
109 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
112 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ClearInstanceSelectionEvent());
117 documentPreviewViewer.addListSelectionListener((e) -> {
118 if (resultType == SearchData.Type.DOCUMENT) {
119 if (!e.getValueIsAdjusting()) {
121 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
124 DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ClearInstanceSelectionEvent());
131 SearchData.Type getActiveType() {
142 private List<AbstractFile> getInstancesForSelected() {
143 if (null != resultType) {
144 switch (resultType) {
146 return videoThumbnailViewer.getInstancesForSelected();
148 return imageThumbnailViewer.getInstancesForSelected();
150 return documentPreviewViewer.getInstancesForSelected();
155 return new ArrayList<>();
164 void handleSearchStartedEvent(DiscoveryEventUtils.SearchStartedEvent searchStartedEvent) {
165 SwingUtilities.invokeLater(() -> {
166 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
176 void handlePageRetrievedEvent(DiscoveryEventUtils.PageRetrievedEvent pageRetrievedEvent) {
177 SwingUtilities.invokeLater(() -> {
179 if (pageRetrievedEvent.getType() != DOMAIN) {
180 DiscoveryEventUtils.getDiscoveryEventBus().post(
new DiscoveryEventUtils.PopulateInstancesListEvent(getInstancesForSelected()));
182 currentPage = pageRetrievedEvent.getPageNumber();
185 if (null != pageRetrievedEvent.getType()) {
186 switch (pageRetrievedEvent.getType()) {
188 populateImageViewer(pageRetrievedEvent.getSearchResults());
189 resultsViewerPanel.add(imageThumbnailViewer);
192 populateVideoViewer(pageRetrievedEvent.getSearchResults());
193 resultsViewerPanel.add(videoThumbnailViewer);
196 populateDocumentViewer(pageRetrievedEvent.getSearchResults());
197 resultsViewerPanel.add(documentPreviewViewer);
200 populateDomainViewer(pageRetrievedEvent.getSearchResults());
201 resultsViewerPanel.add(domainSummaryViewer);
207 resultsViewerPanel.revalidate();
208 resultsViewerPanel.repaint();
217 synchronized void resetResultViewer() {
218 resultsViewerPanel.remove(imageThumbnailViewer);
219 resultsViewerPanel.remove(videoThumbnailViewer);
220 resultsViewerPanel.remove(documentPreviewViewer);
221 resultsViewerPanel.remove(domainSummaryViewer);
223 for (SwingWorker<Void, Void> thumbWorker : resultContentWorkers) {
224 if (!thumbWorker.isDone()) {
225 thumbWorker.cancel(
true);
229 resultContentWorkers.clear();
230 videoThumbnailViewer.clearViewer();
231 imageThumbnailViewer.clearViewer();
232 documentPreviewViewer.clearViewer();
233 domainSummaryViewer.clearViewer();
242 synchronized void populateVideoViewer(List<Result> results) {
243 for (Result result : results) {
244 VideoThumbnailWorker thumbWorker =
new VideoThumbnailWorker((ResultFile) result);
245 thumbWorker.execute();
247 resultContentWorkers.add(thumbWorker);
257 synchronized void populateImageViewer(List<Result> results) {
258 for (Result result : results) {
259 ImageThumbnailWorker thumbWorker =
new ImageThumbnailWorker((ResultFile) result);
260 thumbWorker.execute();
262 resultContentWorkers.add(thumbWorker);
273 synchronized void populateDocumentViewer(List<Result> results) {
274 for (Result result : results) {
275 DocumentPreviewWorker documentWorker =
new DocumentPreviewWorker((ResultFile) result);
276 documentWorker.execute();
278 resultContentWorkers.add(documentWorker);
289 synchronized void populateDomainViewer(List<Result> results) {
290 SleuthkitCase currentCase;
292 currentCase = Case.getCurrentCaseThrows().getSleuthkitCase();
293 }
catch (NoCurrentCaseException ex) {
298 for (Result result : results) {
299 DomainThumbnailWorker domainWorker =
new DomainThumbnailWorker(
300 currentCase, (ResultDomain) result);
301 domainWorker.execute();
303 resultContentWorkers.add(domainWorker);
313 void handleGroupSelectedEvent(DiscoveryEventUtils.GroupSelectedEvent groupSelectedEvent) {
314 SwingUtilities.invokeLater(() -> {
315 searchFilters = groupSelectedEvent.getFilters();
316 groupingAttribute = groupSelectedEvent.getGroupingAttr();
317 groupSort = groupSelectedEvent.getGroupSort();
318 fileSortMethod = groupSelectedEvent.getResultSort();
319 selectedGroupKey = groupSelectedEvent.getGroupKey();
320 resultType = groupSelectedEvent.getResultType();
321 groupSize = groupSelectedEvent.getGroupSize();
334 void handleNoResultsEvent(DiscoveryEventUtils.NoResultsEvent noResultsEvent) {
335 SwingUtilities.invokeLater(() -> {
339 videoThumbnailViewer.clearViewer();
340 imageThumbnailViewer.clearViewer();
341 documentPreviewViewer.clearViewer();
342 domainSummaryViewer.clearViewer();
343 resultsViewerPanel.revalidate();
344 resultsViewerPanel.repaint();
354 void handleSearchCompleteEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompleteEvent) {
355 SwingUtilities.invokeLater(() -> {
356 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
367 private synchronized void setPage(
int startingEntry
369 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
370 synchronized (
this) {
371 if (pageWorker != null && !pageWorker.isDone()) {
372 pageWorker.cancel(
true);
374 CentralRepository centralRepo = null;
375 if (CentralRepository.isEnabled()) {
377 centralRepo = CentralRepository.getInstance();
378 }
catch (CentralRepoException ex) {
380 logger.log(Level.SEVERE,
"Error loading central repository database, no central repository options will be available for Discovery", ex);
383 if (groupSize != 0) {
384 pageWorker =
new PageWorker(searchFilters, groupingAttribute, groupSort, fileSortMethod, selectedGroupKey, startingEntry, pageSize, resultType, centralRepo);
385 pageWorker.execute();
387 SwingUtilities.invokeLater(() -> {
388 pageSizeComboBox.setEnabled(
true);
397 @Messages({
"# {0} - currentPage",
398 "# {1} - totalPages",
399 "ResultsPanel.currentPage.displayValue=Page: {0} of {1}"})
400 private void updateControls() {
401 previousPageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
402 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
404 double maxPageDouble = groupSize == 0 ? 1 : Math.ceil((
double) groupSize / pageSize);
405 currentPageLabel.setText(Bundle.ResultsPanel_currentPage_displayValue(currentPage + 1, maxPageDouble));
406 previousPageButton.setEnabled(currentPage != 0);
407 nextPageButton.setEnabled(groupSize > ((currentPage + 1) * pageSize));
408 gotoPageField.setEnabled(groupSize > pageSize);
409 pageSizeComboBox.setEnabled(
true);
417 @SuppressWarnings(
"unchecked")
419 private
void initComponents() {
420 java.awt.GridBagConstraints gridBagConstraints;
422 javax.swing.JPanel pagingPanel =
new javax.swing.JPanel();
423 previousPageButton =
new javax.swing.JButton();
424 currentPageLabel =
new javax.swing.JLabel();
425 nextPageButton =
new javax.swing.JButton();
426 javax.swing.JLabel pageControlsLabel =
new javax.swing.JLabel();
427 javax.swing.JLabel gotoPageLabel =
new javax.swing.JLabel();
428 gotoPageField =
new javax.swing.JTextField();
429 javax.swing.JLabel pageSizeLabel =
new javax.swing.JLabel();
430 pageSizeComboBox =
new javax.swing.JComboBox<>();
431 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));
432 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));
433 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));
434 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));
435 resultsViewerPanel =
new javax.swing.JPanel();
437 setMinimumSize(
new java.awt.Dimension(300, 60));
438 setPreferredSize(
new java.awt.Dimension(700, 700));
439 setLayout(
new java.awt.BorderLayout());
441 pagingPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
442 pagingPanel.setMinimumSize(
new java.awt.Dimension(400, 39));
443 pagingPanel.setPreferredSize(
new java.awt.Dimension(700, 39));
444 pagingPanel.setLayout(
new java.awt.GridBagLayout());
446 previousPageButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_back.png")));
447 previousPageButton.setBorder(null);
448 previousPageButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_back_disabled.png")));
449 previousPageButton.setEnabled(
false);
450 previousPageButton.setFocusable(
false);
451 previousPageButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_back_hover.png")));
452 previousPageButton.addActionListener(
new java.awt.event.ActionListener() {
453 public void actionPerformed(java.awt.event.ActionEvent evt) {
454 previousPageButtonActionPerformed(evt);
457 gridBagConstraints =
new java.awt.GridBagConstraints();
458 gridBagConstraints.gridx = 3;
459 gridBagConstraints.gridy = 0;
460 gridBagConstraints.gridheight = 2;
461 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
462 gridBagConstraints.insets =
new java.awt.Insets(6, 12, 6, 0);
463 pagingPanel.add(previousPageButton, gridBagConstraints);
465 org.openide.awt.Mnemonics.setLocalizedText(currentPageLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.currentPageLabel.text"));
466 currentPageLabel.setMaximumSize(
new java.awt.Dimension(190, 23));
467 currentPageLabel.setMinimumSize(
new java.awt.Dimension(90, 23));
468 currentPageLabel.setPreferredSize(
new java.awt.Dimension(100, 23));
469 gridBagConstraints =
new java.awt.GridBagConstraints();
470 gridBagConstraints.gridx = 0;
471 gridBagConstraints.gridy = 0;
472 gridBagConstraints.gridheight = 2;
473 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
474 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
475 gridBagConstraints.insets =
new java.awt.Insets(6, 14, 6, 0);
476 pagingPanel.add(currentPageLabel, gridBagConstraints);
478 nextPageButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_forward.png")));
479 nextPageButton.setBorder(null);
480 nextPageButton.setDisabledIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_forward_disabled.png")));
481 nextPageButton.setEnabled(
false);
482 nextPageButton.setFocusable(
false);
483 nextPageButton.setRolloverIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/btn_step_forward_hover.png")));
484 nextPageButton.addActionListener(
new java.awt.event.ActionListener() {
485 public void actionPerformed(java.awt.event.ActionEvent evt) {
486 nextPageButtonActionPerformed(evt);
489 gridBagConstraints =
new java.awt.GridBagConstraints();
490 gridBagConstraints.gridx = 4;
491 gridBagConstraints.gridy = 0;
492 gridBagConstraints.gridheight = 2;
493 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
494 gridBagConstraints.insets =
new java.awt.Insets(6, 0, 6, 0);
495 pagingPanel.add(nextPageButton, gridBagConstraints);
497 pageControlsLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
498 org.openide.awt.Mnemonics.setLocalizedText(pageControlsLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.pageControlsLabel.text"));
499 pageControlsLabel.setMaximumSize(
new java.awt.Dimension(133, 23));
500 pageControlsLabel.setMinimumSize(
new java.awt.Dimension(33, 23));
501 pageControlsLabel.setPreferredSize(
new java.awt.Dimension(60, 23));
502 gridBagConstraints =
new java.awt.GridBagConstraints();
503 gridBagConstraints.gridx = 2;
504 gridBagConstraints.gridy = 0;
505 gridBagConstraints.gridheight = 2;
506 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
507 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
508 gridBagConstraints.insets =
new java.awt.Insets(6, 18, 6, 0);
509 pagingPanel.add(pageControlsLabel, gridBagConstraints);
511 gotoPageLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
512 org.openide.awt.Mnemonics.setLocalizedText(gotoPageLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.gotoPageLabel.text"));
513 gotoPageLabel.setMaximumSize(
new java.awt.Dimension(170, 23));
514 gotoPageLabel.setMinimumSize(
new java.awt.Dimension(70, 23));
515 gotoPageLabel.setPreferredSize(
new java.awt.Dimension(100, 23));
516 gridBagConstraints =
new java.awt.GridBagConstraints();
517 gridBagConstraints.gridx = 6;
518 gridBagConstraints.gridy = 0;
519 gridBagConstraints.gridheight = 2;
520 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
521 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
522 gridBagConstraints.insets =
new java.awt.Insets(6, 18, 6, 0);
523 pagingPanel.add(gotoPageLabel, gridBagConstraints);
525 gotoPageField.setEnabled(
false);
526 gotoPageField.setMinimumSize(
new java.awt.Dimension(30, 22));
527 gotoPageField.setName(
"");
528 gotoPageField.setPreferredSize(
new java.awt.Dimension(26, 22));
529 gotoPageField.addActionListener(
new java.awt.event.ActionListener() {
530 public void actionPerformed(java.awt.event.ActionEvent evt) {
531 gotoPageFieldActionPerformed(evt);
534 gridBagConstraints =
new java.awt.GridBagConstraints();
535 gridBagConstraints.gridx = 7;
536 gridBagConstraints.gridy = 0;
537 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
538 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
539 gridBagConstraints.insets =
new java.awt.Insets(6, 5, 0, 0);
540 pagingPanel.add(gotoPageField, gridBagConstraints);
542 pageSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
543 org.openide.awt.Mnemonics.setLocalizedText(pageSizeLabel,
org.openide.util.NbBundle.getMessage(ResultsPanel.class,
"ResultsPanel.pageSizeLabel.text"));
544 pageSizeLabel.setMaximumSize(
new java.awt.Dimension(160, 23));
545 pageSizeLabel.setMinimumSize(
new java.awt.Dimension(60, 23));
546 pageSizeLabel.setPreferredSize(
new java.awt.Dimension(90, 23));
547 gridBagConstraints =
new java.awt.GridBagConstraints();
548 gridBagConstraints.gridx = 9;
549 gridBagConstraints.gridy = 0;
550 gridBagConstraints.gridheight = 2;
551 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
552 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
553 gridBagConstraints.insets =
new java.awt.Insets(6, 18, 6, 0);
554 pagingPanel.add(pageSizeLabel, gridBagConstraints);
556 pageSizeComboBox.setModel(
new DefaultComboBoxModel<Integer>(
new Integer[] {25,50,75,100,125,150,175,200}));
557 pageSizeComboBox.setSelectedIndex(3);
558 pageSizeComboBox.addItemListener(
new java.awt.event.ItemListener() {
559 public void itemStateChanged(java.awt.event.ItemEvent evt) {
560 pageSizeChanged(evt);
563 gridBagConstraints =
new java.awt.GridBagConstraints();
564 gridBagConstraints.gridx = 10;
565 gridBagConstraints.gridy = 0;
566 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
567 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
568 gridBagConstraints.insets =
new java.awt.Insets(6, 5, 0, 277);
569 pagingPanel.add(pageSizeComboBox, gridBagConstraints);
570 gridBagConstraints =
new java.awt.GridBagConstraints();
571 gridBagConstraints.gridx = 11;
572 gridBagConstraints.gridy = 0;
573 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
574 gridBagConstraints.weightx = 0.1;
575 pagingPanel.add(filler1, gridBagConstraints);
576 gridBagConstraints =
new java.awt.GridBagConstraints();
577 gridBagConstraints.gridx = 1;
578 gridBagConstraints.gridy = 0;
579 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
580 pagingPanel.add(filler2, gridBagConstraints);
581 gridBagConstraints =
new java.awt.GridBagConstraints();
582 gridBagConstraints.gridx = 5;
583 gridBagConstraints.gridy = 0;
584 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
585 pagingPanel.add(filler3, gridBagConstraints);
586 gridBagConstraints =
new java.awt.GridBagConstraints();
587 gridBagConstraints.gridx = 8;
588 gridBagConstraints.gridy = 0;
589 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
590 pagingPanel.add(filler4, gridBagConstraints);
592 add(pagingPanel, java.awt.BorderLayout.PAGE_START);
594 resultsViewerPanel.setMinimumSize(
new java.awt.Dimension(0, 60));
595 resultsViewerPanel.setPreferredSize(
new java.awt.Dimension(700, 700));
596 resultsViewerPanel.setLayout(
new java.awt.BorderLayout());
597 add(resultsViewerPanel, java.awt.BorderLayout.CENTER);
605 private void previousPageButtonActionPerformed(java.awt.event.ActionEvent evt) {
606 if (currentPage > 0) {
607 disablePagingControls();
608 int previousPage = currentPage - 1;
609 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
610 setPage(previousPage * pageSize);
619 private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {
620 disablePagingControls();
621 int nextPage = currentPage + 1;
622 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
623 setPage(nextPage * pageSize);
631 @Messages({
"# {0} - selectedPage",
633 "ResultsPanel.invalidPageNumber.message=The selected page number {0} does not exist. Please select a value from 1 to {1}.",
634 "ResultsPanel.invalidPageNumber.title=Invalid Page Number"})
635 private void gotoPageFieldActionPerformed(java.awt.event.ActionEvent evt) {
638 newPage = Integer.parseInt(gotoPageField.getText());
639 }
catch (NumberFormatException e) {
643 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
644 if ((newPage - 1) < 0 || groupSize <= ((newPage - 1) * pageSize)) {
645 JOptionPane.showMessageDialog(
this,
646 Bundle.ResultsPanel_invalidPageNumber_message(newPage, Math.ceil((
double) groupSize / pageSize)),
647 Bundle.ResultsPanel_invalidPageNumber_title(),
648 JOptionPane.WARNING_MESSAGE);
651 disablePagingControls();
652 setPage((newPage - 1) * pageSize);
655 private void pageSizeChanged(java.awt.event.ItemEvent evt) {
656 if (evt.getStateChange() == ItemEvent.SELECTED) {
657 disablePagingControls();
658 int previousPage = currentPage - 1;
659 int pageSize = pageSizeComboBox.getItemAt(pageSizeComboBox.getSelectedIndex());
660 if (previousPageSize != pageSize) {
663 setPage(previousPage * pageSize);
670 private void disablePagingControls() {
671 nextPageButton.setEnabled(
false);
672 previousPageButton.setEnabled(
false);
673 gotoPageField.setEnabled(
false);
674 pageSizeComboBox.setEnabled(
false);
678 private javax.swing.JLabel currentPageLabel;
679 private javax.swing.JTextField gotoPageField;
680 private javax.swing.JButton nextPageButton;
681 private javax.swing.JComboBox<Integer> pageSizeComboBox;
682 private javax.swing.JButton previousPageButton;
683 private javax.swing.JPanel resultsViewerPanel;
701 thumbnailWrapper =
new VideoThumbnailsWrapper(file);
702 videoThumbnailViewer.addVideo(thumbnailWrapper);
707 DiscoveryUiUtils.getVideoThumbnails(thumbnailWrapper);
715 }
catch (InterruptedException | ExecutionException ex) {
716 logger.log(Level.WARNING,
"Video Worker Exception for file: " + thumbnailWrapper.getResultFile().getFirstInstance().getId(), ex);
717 }
catch (CancellationException ignored) {
720 videoThumbnailViewer.repaint();
739 thumbnailWrapper =
new ImageThumbnailWrapper(file);
740 imageThumbnailViewer.addImage(thumbnailWrapper);
746 if (thumbnail != null) {
747 thumbnailWrapper.setImageThumbnail(thumbnail);
756 }
catch (InterruptedException | ExecutionException ex) {
757 logger.log(Level.WARNING,
"Image Worker Exception for file: " + thumbnailWrapper.getResultFile().getFirstInstance().getId(), ex);
758 }
catch (CancellationException ignored) {
761 imageThumbnailViewer.repaint();
781 documentWrapper =
new DocumentWrapper(file);
782 documentPreviewViewer.addDocument(documentWrapper);
785 @Messages({
"ResultsPanel.unableToCreate.text=Unable to create summary."})
789 if (preview == null) {
790 preview =
new TextSummary(Bundle.ResultsPanel_unableToCreate_text(), null, 0);
792 documentWrapper.setSummary(preview);
796 @Messages({
"ResultsPanel.documentPreview.text=Document preview creation cancelled."})
801 }
catch (InterruptedException | ExecutionException ex) {
802 documentWrapper.setSummary(
new TextSummary(ex.getMessage(), null, 0));
803 logger.log(Level.WARNING,
"Document Worker Exception", ex);
804 }
catch (CancellationException ignored) {
805 documentWrapper.setSummary(
new TextSummary(Bundle.ResultsPanel_documentPreview_text(), null, 0));
808 documentPreviewViewer.repaint();
829 this.caseDb = caseDb;
831 domainSummaryViewer.addDomain(domainWrapper);
839 domainWrapper.getResultDomain().
getDomain(),
844 domainWrapper.setThumbnail(thumbnail);
852 }
catch (ExecutionException ex) {
853 domainWrapper.setThumbnail(null);
854 logger.log(Level.WARNING,
"Fatal error getting thumbnail for domain.", ex);
855 }
catch (InterruptedException | CancellationException ignored) {
856 domainWrapper.setThumbnail(null);
859 domainSummaryViewer.repaint();
final ImageThumbnailWrapper thumbnailWrapper
static TextSummary summarize(AbstractFile file)
final DocumentWrapper documentWrapper
final SleuthkitCase caseDb
final DomainWrapper domainWrapper
final VideoThumbnailsWrapper thumbnailWrapper
static BufferedImage getThumbnail(Content content, int iconSize)
static final int ICON_SIZE_LARGE
Image getThumbnail(DomainSearchThumbnailRequest thumbnailRequest)