Merge remote-tracking branch 'upstream/develop' into timeline_hash_set_filter

Conflicts:
	ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
	branding/core/core.jar/org/netbeans/core/startup/Bundle.properties
	branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
This commit is contained in:
jmillman 2015-07-30 16:21:22 -04:00
commit 8b9032bca8
6 changed files with 136 additions and 112 deletions

View File

@ -41,9 +41,9 @@
<!-- timeline -->
<dependency conf="autopsy_core->*" org="joda-time" name="joda-time" rev="2.4" />
<dependency conf="autopsy_core->*" org="org.jfxtras" name="jfxtras-fxml" rev="8.0-r1" />
<dependency conf="autopsy_core->*" org="org.jfxtras" name="jfxtras-controls" rev="8.0-r1" />
<dependency conf="autopsy_core->*" org="org.jfxtras" name="jfxtras-common" rev="8.0-r1" />
<dependency conf="autopsy_core->*" org="org.jfxtras" name="jfxtras-fxml" rev="8.0-r3" />
<dependency conf="autopsy_core->*" org="org.jfxtras" name="jfxtras-controls" rev="8.0-r3" />
<dependency conf="autopsy_core->*" org="org.jfxtras" name="jfxtras-common" rev="8.0-r3" />
<!-- image support for autopsy and image gallery -->
<dependency conf="autopsy_core->*" org="com.twelvemonkeys.imageio" name="imageio-jpeg" rev="3.1.1" />

View File

@ -41,15 +41,15 @@ file.reference.imgscalr-lib-4.2.jar=release/modules/ext/imgscalr-lib-4.2.jar
file.reference.javaee-api-5.0-2.jar=release/modules/ext/javaee-api-5.0-2.jar
file.reference.javassist-3.12.1.GA.jar=release/modules/ext/javassist-3.12.1.GA.jar
file.reference.jcalendarbutton-1.4.6.jar=release/modules/ext/jcalendarbutton-1.4.6.jar
file.reference.jfxtras-common-8.0-r1-javadoc.jar=release/modules/ext/jfxtras-common-8.0-r1-javadoc.jar
file.reference.jfxtras-common-8.0-r1-sources.jar=release/modules/ext/jfxtras-common-8.0-r1-sources.jar
file.reference.jfxtras-common-8.0-r1.jar=release/modules/ext/jfxtras-common-8.0-r1.jar
file.reference.jfxtras-controls-8.0-r1-javadoc.jar=release/modules/ext/jfxtras-controls-8.0-r1-javadoc.jar
file.reference.jfxtras-controls-8.0-r1-sources.jar=release/modules/ext/jfxtras-controls-8.0-r1-sources.jar
file.reference.jfxtras-controls-8.0-r1.jar=release/modules/ext/jfxtras-controls-8.0-r1.jar
file.reference.jfxtras-fxml-8.0-r1-javadoc.jar=release/modules/ext/jfxtras-fxml-8.0-r1-javadoc.jar
file.reference.jfxtras-fxml-8.0-r1-sources.jar=release/modules/ext/jfxtras-fxml-8.0-r1-sources.jar
file.reference.jfxtras-fxml-8.0-r1.jar=release/modules/ext/jfxtras-fxml-8.0-r1.jar
file.reference.jfxtras-common-8.0-r3-javadoc.jar=release/modules/ext/jfxtras-common-8.0-r3-javadoc.jar
file.reference.jfxtras-common-8.0-r3-sources.jar=release/modules/ext/jfxtras-common-8.0-r3-sources.jar
file.reference.jfxtras-common-8.0-r3.jar=release/modules/ext/jfxtras-common-8.0-r3.jar
file.reference.jfxtras-controls-8.0-r3-javadoc.jar=release/modules/ext/jfxtras-controls-8.0-r3-javadoc.jar
file.reference.jfxtras-controls-8.0-r3-sources.jar=release/modules/ext/jfxtras-controls-8.0-r3-sources.jar
file.reference.jfxtras-controls-8.0-r3.jar=release/modules/ext/jfxtras-controls-8.0-r3.jar
file.reference.jfxtras-fxml-8.0-r3-javadoc.jar=release/modules/ext/jfxtras-fxml-8.0-r3-javadoc.jar
file.reference.jfxtras-fxml-8.0-r3-sources.jar=release/modules/ext/jfxtras-fxml-8.0-r3-sources.jar
file.reference.jfxtras-fxml-8.0-r3.jar=release/modules/ext/jfxtras-fxml-8.0-r3.jar
file.reference.jna-3.4.0.jar=release/modules/ext/jna-3.4.0.jar
file.reference.joda-time-2.4-javadoc.jar=release/modules/ext/joda-time-2.4-javadoc.jar
file.reference.joda-time-2.4-sources.jar=release/modules/ext/joda-time-2.4-sources.jar

View File

@ -686,8 +686,8 @@
<binary-origin>release/modules/ext/poi-ooxml-schemas-3.8.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-controls-8.0-r1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-controls-8.0-r1.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-controls-8.0-r3.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-controls-8.0-r3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/gson-1.4.jar</runtime-relative-path>
@ -714,8 +714,8 @@
<binary-origin>release/modules/ext/guava-11.0.2.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-common-8.0-r1-sources.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-common-8.0-r1-sources.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-common-8.0-r3-sources.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-common-8.0-r3-sources.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/mail-1.4.3.jar</runtime-relative-path>
@ -746,8 +746,8 @@
<binary-origin>release/modules/ext/joda-time-2.4-javadoc.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-fxml-8.0-r1-sources.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-fxml-8.0-r1-sources.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-fxml-8.0-r3-sources.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-fxml-8.0-r3-sources.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jcalendarbutton-1.4.6.jar</runtime-relative-path>
@ -802,28 +802,28 @@
<binary-origin>release/modules/ext/joda-time-2.4.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-fxml-8.0-r1-javadoc.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-fxml-8.0-r1-javadoc.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-fxml-8.0-r3-javadoc.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-fxml-8.0-r3-javadoc.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-fxml-8.0-r3.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-fxml-8.0-r3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/common-io-3.1.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/common-io-3.1.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-fxml-8.0-r1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-fxml-8.0-r1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-common-8.0-r1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-common-8.0-r1.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-common-8.0-r3.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-common-8.0-r3.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/commons-logging-1.1.2-javadoc.jar</runtime-relative-path>
<binary-origin>release/modules/ext/commons-logging-1.1.2-javadoc.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-controls-8.0-r1-javadoc.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-controls-8.0-r1-javadoc.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-controls-8.0-r3-javadoc.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-controls-8.0-r3-javadoc.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/slf4j-simple-1.6.1.jar</runtime-relative-path>
@ -894,8 +894,8 @@
<binary-origin>release/modules/ext/commons-lang3-3.0.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-common-8.0-r1-javadoc.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-common-8.0-r1-javadoc.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-common-8.0-r3-javadoc.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-common-8.0-r3-javadoc.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/imageio-iff-3.1.1.jar</runtime-relative-path>
@ -918,12 +918,12 @@
<binary-origin>release/modules/ext/gstreamer-java-1.5.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/imageio-metadata-3.1.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/imageio-metadata-3.1.1.jar</binary-origin>
<runtime-relative-path>ext/jfxtras-controls-8.0-r3-sources.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-controls-8.0-r3-sources.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/jfxtras-controls-8.0-r1-sources.jar</runtime-relative-path>
<binary-origin>release/modules/ext/jfxtras-controls-8.0-r1-sources.jar</binary-origin>
<runtime-relative-path>ext/imageio-metadata-3.1.1.jar</runtime-relative-path>
<binary-origin>release/modules/ext/imageio-metadata-3.1.1.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/imageio-pict-3.1.1.jar</runtime-relative-path>

View File

@ -34,7 +34,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static java.util.Objects.isNull;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
@ -50,6 +50,7 @@ import org.sleuthkit.autopsy.coreutils.HashHitUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.FileTypeUtils;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupKey;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy;
@ -1123,8 +1124,6 @@ public final class DrawableDB {
*/
@Nonnull
public Set<String> getHashSetsForFileFromAutopsy(long fileID) {
// return hashh
return HashHitUtils.getHashSetNamesForFile(tskCase, fileID);
}
@ -1193,12 +1192,9 @@ public final class DrawableDB {
* returns false if passed a null AbstractFile
*/
public boolean isVideoFile(AbstractFile f) {
if (Objects.isNull(f)) {
return false;
} else {
return videoFileMap.computeIfAbsent(f.getId(), (id) -> FileTypeUtils.isVideoFile(f));
}
return isNull(f) ? false
: videoFileMap.computeIfAbsent(f.getId(), id -> FileTypeUtils.isVideoFile(f));
}
/**

View File

@ -58,32 +58,20 @@ import org.sleuthkit.datamodel.TskCoreException;
public abstract class DrawableFile<T extends AbstractFile> extends AbstractFile {
public static DrawableFile<?> create(AbstractFile abstractFileById, boolean analyzed) {
if (FileTypeUtils.isVideoFile(abstractFileById)) {
return new VideoFile<>(abstractFileById, analyzed);
} else {
return new ImageFile<>(abstractFileById, analyzed);
}
return create(abstractFileById, analyzed, FileTypeUtils.isVideoFile(abstractFileById));
}
/**
* Skip the database query if we have already determined the file type.
*/
public static DrawableFile<?> create(AbstractFile abstractFileById, boolean analyzed, boolean isVideo) {
if (isVideo) {
return new VideoFile<>(abstractFileById, analyzed);
} else {
return new ImageFile<>(abstractFileById, analyzed);
}
return isVideo
? new VideoFile<>(abstractFileById, analyzed)
: new ImageFile<>(abstractFileById, analyzed);
}
public static DrawableFile<?> create(Long id, boolean analyzed) throws TskCoreException, IllegalStateException {
AbstractFile abstractFileById = Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(id);
if (FileTypeUtils.isVideoFile(abstractFileById)) {
return new VideoFile<>(abstractFileById, analyzed);
} else {
return new ImageFile<>(abstractFileById, analyzed);
}
return create(Case.getCurrentCase().getSleuthkitCase().getAbstractFileById(id), analyzed);
}
SoftReference<Image> imageRef;
@ -124,7 +112,6 @@ public abstract class DrawableFile<T extends AbstractFile> extends AbstractFile
@Override
public <T> T accept(SleuthkitItemVisitor<T> v) {
return file.accept(v);
}

View File

@ -21,8 +21,11 @@ package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
import com.google.common.eventbus.Subscribe;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import java.util.Optional;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@ -30,16 +33,23 @@ import javafx.application.Platform;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.fxml.FXML;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.Clipboard;
import javafx.scene.input.DataFormat;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.Region;
import javafx.scene.text.Text;
import javafx.util.Pair;
import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.autopsy.events.ContentTagAddedEvent;
import org.sleuthkit.autopsy.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.events.TagEvent;
@ -59,14 +69,19 @@ public class MetaDataPane extends DrawableUIBase {
private static final Logger LOGGER = Logger.getLogger(MetaDataPane.class.getName());
@FXML
private TableColumn<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>> attributeColumn;
private static final KeyCodeCombination COPY_KEY_COMBINATION = new KeyCodeCombination(KeyCode.C, KeyCombination.CONTROL_DOWN);
@FXML
private TableView<Pair<DrawableAttribute<?>, ? extends Object>> tableView;
private TableColumn<Pair<DrawableAttribute<?>, Collection<?>>, DrawableAttribute<?>> attributeColumn;
@FXML
private TableColumn<Pair<DrawableAttribute<?>, ? extends Object>, String> valueColumn;
private TableView<Pair<DrawableAttribute<?>, Collection<?>>> tableView;
@FXML
private TableColumn<Pair<DrawableAttribute<?>, Collection<?>>, String> valueColumn;
private final MenuItem copyMenuItem = new MenuItem("Copy");
private final ContextMenu contextMenu = new ContextMenu(copyMenuItem);
public MetaDataPane(ImageGalleryController controller) {
super(controller);
@ -74,7 +89,6 @@ public class MetaDataPane extends DrawableUIBase {
}
@FXML
@SuppressWarnings("unchecked")
void initialize() {
assert attributeColumn != null : "fx:id=\"attributeColumn\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
assert imageView != null : "fx:id=\"imageView\" was not injected: check your FXML file 'MetaDataPane.fxml'.";
@ -83,54 +97,74 @@ public class MetaDataPane extends DrawableUIBase {
getController().getTagsManager().registerListener(this);
getController().getCategoryManager().registerListener(this);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("Select a file to show its details here."));
attributeColumn.setCellValueFactory((param) -> new SimpleObjectProperty<>(param.getValue().getKey()));
attributeColumn.setCellFactory((param) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, DrawableAttribute<?>>() {
@Override
protected void updateItem(DrawableAttribute<?> item, boolean empty) {
super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates.
if (item != null) {
setText(item.getDisplayName());
setGraphic(new ImageView(item.getIcon()));
} else {
setGraphic(null);
setText(null);
}
}
});
attributeColumn.setPrefWidth(USE_COMPUTED_SIZE);
valueColumn.setCellValueFactory((p) -> {
return (p.getValue().getKey() == DrawableAttribute.TAGS)
? new SimpleStringProperty(((Collection<TagName>) p.getValue().getValue()).stream()
.map(TagName::getDisplayName)
.filter(Category::isNotCategoryName)
.collect(Collectors.joining(" ; ")))
: new SimpleStringProperty(StringUtils.join((Iterable<?>) p.getValue().getValue(), " ; "));
});
valueColumn.setPrefWidth(USE_COMPUTED_SIZE);
valueColumn.setCellFactory((p) -> new TableCell<Pair<DrawableAttribute<?>, ? extends Object>, String>() {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (!isEmpty()) {
Text text = new Text(item);
text.wrappingWidthProperty().bind(getTableColumn().widthProperty());
setGraphic(text);
} else {
setGraphic(null);
}
}
});
tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn));
//listen for selection change
getController().getSelectionModel().lastSelectedProperty().addListener((observable, oldFileID, newFileID) -> {
setFile(newFileID);
});
copyMenuItem.setAccelerator(COPY_KEY_COMBINATION);
copyMenuItem.setOnAction(actionEvent -> {
copyValueToClipBoard();
});
tableView.setContextMenu(contextMenu);
tableView.setOnKeyPressed((KeyEvent event) -> {
if (COPY_KEY_COMBINATION.match(event)) {
contextMenu.hide();
copyMenuItem.fire();
event.consume();
}
});
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("Select a file to show its details here."));
tableView.getColumns().setAll(Arrays.asList(attributeColumn, valueColumn));
attributeColumn.setPrefWidth(USE_COMPUTED_SIZE);
attributeColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getKey()));
attributeColumn.setCellFactory(param -> new TableCell<Pair<DrawableAttribute<?>, Collection<?>>, DrawableAttribute<?>>() {
@Override
protected void updateItem(DrawableAttribute<?> item, boolean empty) {
super.updateItem(item, empty);
if (isNull(item) || empty) {
setGraphic(null);
setText(null);
} else {
setText(item.getDisplayName());
setGraphic(new ImageView(item.getIcon()));
}
}
});
valueColumn.setPrefWidth(USE_COMPUTED_SIZE);
valueColumn.setCellValueFactory(p -> new SimpleStringProperty(getValueDisplayString(p.getValue())));
valueColumn.setCellFactory(p -> new TableCell<Pair<DrawableAttribute<?>, Collection<?>>, String>() {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (isNull(item) || empty) {
setGraphic(null);
} else {
Text text = new Text(item);
text.wrappingWidthProperty().bind(getTableColumn().widthProperty());
setGraphic(text);
}
}
});
}
@SuppressWarnings("unchecked")
static private String getValueDisplayString(Pair<DrawableAttribute<?>, Collection<?>> p) {
if (p.getKey() == DrawableAttribute.TAGS) {
return ((Collection<TagName>) p.getValue()).stream()
.map(TagName::getDisplayName)
.filter(Category::isNotCategoryName)
.collect(Collectors.joining(" ; "));
} else {
return p.getValue().stream()
.map(value -> Objects.toString(value, ""))
.collect(Collectors.joining(" ; "));
}
}
@Override
@ -158,7 +192,6 @@ public class MetaDataPane extends DrawableUIBase {
public void updateUI() {
getFile().ifPresent(file -> {
final List<Pair<DrawableAttribute<?>, Collection<?>>> attributesList = file.getAttributesList();
Platform.runLater(() -> {
tableView.getItems().clear();
tableView.getItems().setAll(attributesList);
@ -207,4 +240,12 @@ public class MetaDataPane extends DrawableUIBase {
}
});
}
private void copyValueToClipBoard() {
Pair<DrawableAttribute<?>, Collection<?>> selectedItem = tableView.getSelectionModel().getSelectedItem();
if (nonNull(selectedItem)) {
Clipboard.getSystemClipboard().setContent(Collections.singletonMap(DataFormat.PLAIN_TEXT,
getValueDisplayString(selectedItem)));
}
}
}