5423 preserve ordering of image thumbnails

This commit is contained in:
William Schaefer 2019-09-04 13:45:09 -04:00
parent 55449875af
commit 8722f847b3
2 changed files with 36 additions and 25 deletions

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.filequery;
import java.awt.Image;
import org.sleuthkit.autopsy.coreutils.ImageUtils;
/**
*
@ -26,14 +27,19 @@ import java.awt.Image;
*/
public class ImageThumbnailWrapper {
private final Image thumbnail;
private Image thumbnail;
private final ResultFile resultFile;
ImageThumbnailWrapper(Image thumbnail, ResultFile file) {
this.thumbnail = thumbnail;
ImageThumbnailWrapper(ResultFile file) {
this.thumbnail = ImageUtils.getDefaultThumbnail();
this.resultFile = file;
}
void setImageThumbnail(Image thumbnail){
this.thumbnail = thumbnail;
}
/**
* Get the ResultFile which represents the image file which the thumbnail
* was created for.

View File

@ -529,34 +529,39 @@ public class ResultsPanel extends javax.swing.JPanel {
@Override
protected Void doInBackground() throws Exception {
FileSearch.getVideoThumbnails(thumbnailWrapper);
videoThumbnailViewer.repaint();
return null;
}
}
private class ImageThumbnailWorker extends SwingWorker<Void, Void> {
private final ResultFile file;
private ImageThumbnailWrapper thumbnailWrapper;
ImageThumbnailWorker(ResultFile file) {
this.file = file;
}
@Override
protected Void doInBackground() throws Exception {
Image thumbnail = ImageUtils.getThumbnail(file.getFirstInstance(), ImageUtils.ICON_SIZE_LARGE);
if (thumbnail == null) {
thumbnail = ImageUtils.getDefaultThumbnail();
}
thumbnailWrapper = new ImageThumbnailWrapper(thumbnail, file);
return null;
}
@Override
protected void done() {
if (!isCancelled()) {
imageThumbnailViewer.addFile(thumbnailWrapper);
videoThumbnailViewer.repaint();
}
}
}
private class ImageThumbnailWorker extends SwingWorker<Void, Void> {
private ImageThumbnailWrapper thumbnailWrapper;
ImageThumbnailWorker(ResultFile file) {
thumbnailWrapper = new ImageThumbnailWrapper(file);
imageThumbnailViewer.addFile(thumbnailWrapper);
}
@Override
protected Void doInBackground() throws Exception {
Image thumbnail = ImageUtils.getThumbnail(thumbnailWrapper.getResultFile().getFirstInstance(), ImageUtils.ICON_SIZE_LARGE);
if (thumbnail != null) {
thumbnailWrapper.setImageThumbnail(thumbnail);
}
return null;
}
@Override
protected void done() {
if (!isCancelled()) {
imageThumbnailViewer.repaint();
}
}