Autopsy  4.14.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
ImageThumbnailViewer.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 ImageThumbnailViewer extends javax.swing.JPanel {
32 
33  private static final long serialVersionUID = 1L;
34 
35  private final DefaultListModel<ImageThumbnailWrapper> thumbnailListModel = new DefaultListModel<>();
36 
42 
43  }
44 
50  @SuppressWarnings("unchecked")
51  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
52  private void initComponents() {
53 
54  thumbnailListScrollPane = new javax.swing.JScrollPane();
55  thumbnailList = new javax.swing.JList<>();
56 
57  setLayout(new java.awt.BorderLayout());
58 
59  thumbnailList.setModel(thumbnailListModel);
60  thumbnailList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
61  thumbnailList.setCellRenderer(new ImageThumbnailPanel());
62  thumbnailList.setLayoutOrientation(javax.swing.JList.HORIZONTAL_WRAP);
63  thumbnailList.setVisibleRowCount(0);
64  thumbnailListScrollPane.setViewportView(thumbnailList);
65 
66  add(thumbnailListScrollPane, java.awt.BorderLayout.CENTER);
67  }// </editor-fold>//GEN-END:initComponents
68 
69 
70  // Variables declaration - do not modify//GEN-BEGIN:variables
71  private javax.swing.JList<ImageThumbnailWrapper> thumbnailList;
72  private javax.swing.JScrollPane thumbnailListScrollPane;
73  // End of variables declaration//GEN-END:variables
74 
80  void addListSelectionListener(ListSelectionListener listener) {
81  thumbnailList.getSelectionModel().addListSelectionListener(listener);
82  }
83 
91  List<AbstractFile> getInstancesForSelected() {
92  synchronized (this) {
93  if (thumbnailList.getSelectedIndex() == -1) {
94  return new ArrayList<>();
95  } else {
96  return thumbnailListModel.getElementAt(thumbnailList.getSelectedIndex()).getResultFile().getAllInstances();
97  }
98  }
99  }
100 
104  void clearViewer() {
105  synchronized (this) {
106  thumbnailListModel.removeAllElements();
107  thumbnailListScrollPane.getVerticalScrollBar().setValue(0);
108  }
109  }
110 
117  void addImage(ImageThumbnailWrapper thumbnailWrapper) {
118  synchronized (this) {
119  thumbnailListModel.addElement(thumbnailWrapper);
120  }
121  }
122 }
final DefaultListModel< ImageThumbnailWrapper > thumbnailListModel
javax.swing.JList< ImageThumbnailWrapper > thumbnailList

Copyright © 2012-2020 Basis Technology. Generated on: Wed Apr 8 2020
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.