Autopsy  4.13.0
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.filequery;
20 
21 import java.util.ArrayList;
22 import java.util.List;
23 import javax.swing.DefaultListModel;
24 import javax.swing.event.ListSelectionListener;
25 import org.sleuthkit.datamodel.AbstractFile;
26 
31 public class VideoThumbnailViewer extends javax.swing.JPanel {
32 
33  private static final long serialVersionUID = 1L;
34  private final DefaultListModel<VideoThumbnailsWrapper> thumbnailListModel = new DefaultListModel<>();
35 
41  }
42 
48  void addListSelectionListener(ListSelectionListener listener) {
49  thumbnailList.getSelectionModel().addListSelectionListener(listener);
50  }
51 
59  List<AbstractFile> getInstancesForSelected() {
60  synchronized (this) {
61  if (thumbnailList.getSelectedIndex() == -1) {
62  return new ArrayList<>();
63  } else {
64  return thumbnailListModel.getElementAt(thumbnailList.getSelectedIndex()).getResultFile().getAllInstances();
65  }
66  }
67  }
68 
72  void clearViewer() {
73  synchronized (this) {
74  thumbnailListModel.removeAllElements();
75  thumbnailListScrollPane.getVerticalScrollBar().setValue(0);
76  }
77  }
78 
85  void addVideo(VideoThumbnailsWrapper thumbnailWrapper) {
86  synchronized (this) {
87  thumbnailListModel.addElement(thumbnailWrapper);
88  }
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 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<VideoThumbnailsWrapper> thumbnailList;
116  private javax.swing.JScrollPane thumbnailListScrollPane;
117  // End of variables declaration//GEN-END:variables
118 
119 }
javax.swing.JList< VideoThumbnailsWrapper > thumbnailList
final DefaultListModel< VideoThumbnailsWrapper > thumbnailListModel

Copyright © 2012-2019 Basis Technology. Generated on: Tue Jan 7 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.