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;
31 final class ImageThumbnailViewer
extends javax.swing.JPanel {
33 private static final long serialVersionUID = 1L;
35 private final DefaultListModel<ImageThumbnailWrapper> thumbnailListModel =
new DefaultListModel<>();
40 ImageThumbnailViewer() {
50 @SuppressWarnings(
"unchecked")
52 private
void initComponents() {
54 thumbnailListScrollPane =
new javax.swing.JScrollPane();
55 thumbnailList =
new javax.swing.JList<>();
57 setLayout(
new java.awt.BorderLayout());
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);
66 add(thumbnailListScrollPane, java.awt.BorderLayout.CENTER);
71 private javax.swing.JList<ImageThumbnailWrapper> thumbnailList;
72 private javax.swing.JScrollPane thumbnailListScrollPane;
80 void addListSelectionListener(ListSelectionListener listener) {
81 thumbnailList.getSelectionModel().addListSelectionListener(listener);
91 List<AbstractFile> getInstancesForSelected() {
93 if (thumbnailList.getSelectedIndex() == -1) {
94 return new ArrayList<>();
96 return thumbnailListModel.getElementAt(thumbnailList.getSelectedIndex()).getResultFile().getAllInstances();
105 synchronized (
this) {
106 thumbnailListModel.removeAllElements();
107 thumbnailListScrollPane.getVerticalScrollBar().setValue(0);
117 void addImage(ImageThumbnailWrapper thumbnailWrapper) {
118 synchronized (
this) {
119 thumbnailListModel.addElement(thumbnailWrapper);