19 package org.sleuthkit.autopsy.discovery.ui;
21 import java.util.ArrayList;
22 import java.util.List;
23 import javax.swing.DefaultListModel;
24 import javax.swing.event.ListSelectionListener;
32 final class VideoThumbnailViewer
extends javax.swing.JPanel {
34 private static final long serialVersionUID = 1L;
35 private final DefaultListModel<VideoThumbnailsWrapper> thumbnailListModel =
new DefaultListModel<>();
40 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
41 VideoThumbnailViewer() {
50 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
51 void addListSelectionListener(ListSelectionListener listener) {
52 thumbnailList.getSelectionModel().addListSelectionListener(listener);
62 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
63 List<AbstractFile> getInstancesForSelected() {
64 if (thumbnailList.getSelectedIndex() == -1) {
65 return new ArrayList<>();
67 return thumbnailListModel.getElementAt(thumbnailList.getSelectedIndex()).getResultFile().getAllInstances();
74 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
76 thumbnailListModel.removeAllElements();
77 thumbnailListScrollPane.getVerticalScrollBar().setValue(0);
86 @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
87 void addVideo(VideoThumbnailsWrapper thumbnailWrapper) {
88 thumbnailListModel.addElement(thumbnailWrapper);
96 @SuppressWarnings(
"unchecked")
98 private
void initComponents() {
100 thumbnailListScrollPane =
new javax.swing.JScrollPane();
101 thumbnailList =
new javax.swing.JList<>();
103 setLayout(
new java.awt.BorderLayout());
105 thumbnailList.setModel(thumbnailListModel);
106 thumbnailList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
108 thumbnailListScrollPane.setViewportView(thumbnailList);
110 add(thumbnailListScrollPane, java.awt.BorderLayout.CENTER);
116 private javax.swing.JScrollPane thumbnailListScrollPane;