Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
VideoThumbnailViewer.java
Go to the documentation of this file.
1 /*
2  * Autopsy
3  *
4  * Copyright 2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.discovery.ui;
20 
21 import java.util.ArrayList;
22 import java.util.List;
23 import javax.swing.DefaultListModel;
24 import javax.swing.event.ListSelectionListener;
26 import org.sleuthkit.datamodel.AbstractFile;
27 
32 final class VideoThumbnailViewer extends javax.swing.JPanel {
33 
34  private static final long serialVersionUID = 1L;
35  private final DefaultListModel<VideoThumbnailsWrapper> thumbnailListModel = new DefaultListModel<>();
36 
40  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
41  VideoThumbnailViewer() {
42  initComponents();
43  }
44 
50  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
51  void addListSelectionListener(ListSelectionListener listener) {
52  thumbnailList.getSelectionModel().addListSelectionListener(listener);
53  }
54 
62  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
63  List<AbstractFile> getInstancesForSelected() {
64  if (thumbnailList.getSelectedIndex() == -1) {
65  return new ArrayList<>();
66  } else {
67  return thumbnailListModel.getElementAt(thumbnailList.getSelectedIndex()).getResultFile().getAllInstances();
68  }
69  }
70 
74  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
75  void clearViewer() {
76  thumbnailListModel.removeAllElements();
77  thumbnailListScrollPane.getVerticalScrollBar().setValue(0);
78  }
79 
86  @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
87  void addVideo(VideoThumbnailsWrapper thumbnailWrapper) {
88  thumbnailListModel.addElement(thumbnailWrapper);
89  }
90 
96  @SuppressWarnings("unchecked")
97  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
98  private void initComponents() {
99 
100  thumbnailListScrollPane = new javax.swing.JScrollPane();
101  thumbnailList = new javax.swing.JList<>();
102 
103  setLayout(new java.awt.BorderLayout());
104 
105  thumbnailList.setModel(thumbnailListModel);
106  thumbnailList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
107  thumbnailList.setCellRenderer(new org.sleuthkit.autopsy.discovery.ui.VideoThumbnailPanel());
108  thumbnailListScrollPane.setViewportView(thumbnailList);
109 
110  add(thumbnailListScrollPane, java.awt.BorderLayout.CENTER);
111  }// </editor-fold>//GEN-END:initComponents
112 
113 
114  // Variables declaration - do not modify//GEN-BEGIN:variables
115  private javax.swing.JList<org.sleuthkit.autopsy.discovery.ui.VideoThumbnailsWrapper> thumbnailList;
116  private javax.swing.JScrollPane thumbnailListScrollPane;
117  // End of variables declaration//GEN-END:variables
118 
119 }

Copyright © 2012-2022 Basis Technology. Generated on: Fri Oct 7 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.