mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
minor cleanup
This commit is contained in:
parent
7e042b3abc
commit
332d90222d
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-15 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -60,4 +60,7 @@ public class FXMLConstructor {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private FXMLConstructor() {
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-15 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -23,7 +23,6 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
@ -90,7 +89,7 @@ public abstract class DrawableFile<T extends AbstractFile> extends AbstractFile
|
||||
|
||||
private String drawablePath;
|
||||
|
||||
protected T file;
|
||||
private final T file;
|
||||
|
||||
private final SimpleBooleanProperty analyzed;
|
||||
|
||||
@ -143,14 +142,14 @@ public abstract class DrawableFile<T extends AbstractFile> extends AbstractFile
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<Pair<DrawableAttribute<?>, ?>> getAttributesList() {
|
||||
return DrawableAttribute.getValues().stream().map(new Function<DrawableAttribute<?>, Pair<DrawableAttribute<?>, ?>>() {
|
||||
@Override
|
||||
public Pair<DrawableAttribute<?>, ?> apply(DrawableAttribute<?> t) {
|
||||
return new Pair<>(t, t.getValue(DrawableFile.this));
|
||||
}
|
||||
public List<Pair<DrawableAttribute<?>, Collection<?>>> getAttributesList() {
|
||||
return DrawableAttribute.getValues().stream()
|
||||
.map(this::makeAttributeValuePair)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
private Pair<DrawableAttribute<?>, Collection<?>> makeAttributeValuePair(DrawableAttribute<?> t) {
|
||||
return new Pair<>(t, t.getValue(DrawableFile.this));
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
@ -181,47 +180,6 @@ public abstract class DrawableFile<T extends AbstractFile> extends AbstractFile
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected final List<? extends Object> getValuesOfBBAttribute(BlackboardArtifact.ARTIFACT_TYPE artType, BlackboardAttribute.ATTRIBUTE_TYPE attrType) {
|
||||
ArrayList<Object> vals = new ArrayList<>();
|
||||
try {
|
||||
//why doesn't file.getArtifacts() work?
|
||||
//TODO: this seams like overkill, use a more targeted query
|
||||
ArrayList<BlackboardArtifact> artifacts = getAllArtifacts();
|
||||
|
||||
for (BlackboardArtifact artf : artifacts) {
|
||||
if (artf.getArtifactTypeID() == artType.getTypeID()) {
|
||||
for (BlackboardAttribute attr : artf.getAttributes()) {
|
||||
if (attr.getAttributeTypeID() == attrType.getTypeID()) {
|
||||
|
||||
switch (attr.getValueType()) {
|
||||
case BYTE:
|
||||
vals.add(attr.getValueBytes());
|
||||
break;
|
||||
case DOUBLE:
|
||||
vals.add(attr.getValueDouble());
|
||||
break;
|
||||
case INTEGER:
|
||||
vals.add(attr.getValueInt());
|
||||
break;
|
||||
case LONG:
|
||||
vals.add(attr.getValueLong());
|
||||
break;
|
||||
case STRING:
|
||||
vals.add(attr.getValueString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
Logger.getAnonymousLogger().log(Level.WARNING, "problem looking up {0}/{1}" + " " + " for {2}", new Object[]{artType.getDisplayName(), attrType.getDisplayName(), getName()});
|
||||
}
|
||||
|
||||
return vals;
|
||||
}
|
||||
|
||||
protected Object getValueOfBBAttribute(BlackboardArtifact.ARTIFACT_TYPE artType, BlackboardAttribute.ATTRIBUTE_TYPE attrType) {
|
||||
try {
|
||||
|
||||
|
@ -25,6 +25,8 @@ import javafx.scene.control.SplitMenuButton;
|
||||
import javafx.scene.image.ImageView;
|
||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||
import org.sleuthkit.autopsy.imagegallery.actions.AddDrawableTagAction;
|
||||
import org.sleuthkit.autopsy.imagegallery.actions.CategorizeAction;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
||||
import org.sleuthkit.datamodel.TagName;
|
||||
|
||||
@ -56,6 +58,19 @@ public class GuiUtils {
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
public static MenuItem createSelCatMenuItem(Category cat, final SplitMenuButton catSelectedMenuButton, ImageGalleryController controller) {
|
||||
final MenuItem menuItem = new MenuItem(cat.getDisplayName(), new ImageView(DrawableAttribute.CATEGORY.getIcon()));
|
||||
menuItem.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
new CategorizeAction(controller).addTag(controller.getTagsManager().getTagName(cat), "");
|
||||
catSelectedMenuButton.setText(cat.getDisplayName());
|
||||
catSelectedMenuButton.setOnAction(this);
|
||||
}
|
||||
});
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
private GuiUtils() {
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-15 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -18,7 +18,11 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.imagegallery.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.InvalidationListener;
|
||||
import javafx.beans.Observable;
|
||||
@ -27,7 +31,6 @@ import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
@ -40,16 +43,13 @@ import javafx.scene.control.ToolBar;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javax.swing.SortOrder;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
||||
import org.sleuthkit.autopsy.imagegallery.FileIDSelectionModel;
|
||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||
import org.sleuthkit.autopsy.imagegallery.ThumbnailCache;
|
||||
import org.sleuthkit.autopsy.imagegallery.actions.CategorizeAction;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy;
|
||||
import org.sleuthkit.datamodel.TagName;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
@ -57,6 +57,8 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
*/
|
||||
public class Toolbar extends ToolBar {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(Toolbar.class.getName());
|
||||
|
||||
private static final int SIZE_SLIDER_DEFAULT = 100;
|
||||
|
||||
@FXML
|
||||
@ -80,8 +82,6 @@ public class Toolbar extends ToolBar {
|
||||
@FXML
|
||||
private ToggleGroup orderGroup;
|
||||
|
||||
// @FXML
|
||||
// private ToggleButton metaDataToggle;
|
||||
@FXML
|
||||
private HBox sortControlGroup;
|
||||
|
||||
@ -110,9 +110,6 @@ public class Toolbar extends ToolBar {
|
||||
return orderProperty.get();
|
||||
}
|
||||
|
||||
// public ReadOnlyBooleanProperty showMetaDataProperty() {
|
||||
// return metaDataToggle.selectedProperty();
|
||||
// }
|
||||
public DoubleProperty sizeSliderValue() {
|
||||
return sizeSlider.valueProperty();
|
||||
}
|
||||
@ -153,32 +150,28 @@ public class Toolbar extends ToolBar {
|
||||
try {
|
||||
GuiUtils.createSelTagMenuItem(getController().getTagsManager().getFollowUpTagName(), tagSelectedMenuButton, getController()).getOnAction().handle(t);
|
||||
} catch (TskCoreException ex) {
|
||||
Exceptions.printStackTrace(ex);
|
||||
LOGGER.log(Level.SEVERE, "Could create follow up tag menu item", ex);
|
||||
}
|
||||
});
|
||||
|
||||
tagSelectedMenuButton.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon()));
|
||||
tagSelectedMenuButton.showingProperty().addListener((ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) -> {
|
||||
if (t1) {
|
||||
ArrayList<MenuItem> selTagMenues = new ArrayList<>();
|
||||
for (final TagName tn : getController().getTagsManager().getNonCategoryTagNames()) {
|
||||
MenuItem menuItem = GuiUtils.createSelTagMenuItem(tn, tagSelectedMenuButton, getController());
|
||||
selTagMenues.add(menuItem);
|
||||
}
|
||||
List<MenuItem> selTagMenues = getController().getTagsManager().getNonCategoryTagNames().stream()
|
||||
.map(tn -> GuiUtils.createSelTagMenuItem(tn, tagSelectedMenuButton, getController()))
|
||||
.collect(Collectors.toList());
|
||||
tagSelectedMenuButton.getItems().setAll(selTagMenues);
|
||||
}
|
||||
});
|
||||
|
||||
catSelectedMenuButton.setOnAction(createSelCatMenuItem(Category.FIVE, catSelectedMenuButton, getController()).getOnAction());
|
||||
catSelectedMenuButton.setOnAction(GuiUtils.createSelCatMenuItem(Category.FIVE, catSelectedMenuButton, getController()).getOnAction());
|
||||
catSelectedMenuButton.setText(Category.FIVE.getDisplayName());
|
||||
catSelectedMenuButton.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon()));
|
||||
catSelectedMenuButton.showingProperty().addListener((ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) -> {
|
||||
if (t1) {
|
||||
ArrayList<MenuItem> categoryMenues = new ArrayList<>();
|
||||
for (final Category cat : Category.values()) {
|
||||
MenuItem menuItem = createSelCatMenuItem(cat, catSelectedMenuButton, getController());
|
||||
categoryMenues.add(menuItem);
|
||||
}
|
||||
List<MenuItem> categoryMenues = Stream.of(Category.values())
|
||||
.map((cat) -> GuiUtils.createSelCatMenuItem(cat, catSelectedMenuButton, getController()))
|
||||
.collect(Collectors.toList());
|
||||
catSelectedMenuButton.getItems().setAll(categoryMenues);
|
||||
}
|
||||
});
|
||||
@ -226,19 +219,6 @@ public class Toolbar extends ToolBar {
|
||||
FXMLConstructor.construct(this, "Toolbar.fxml");
|
||||
}
|
||||
|
||||
private static MenuItem createSelCatMenuItem(Category cat, final SplitMenuButton catSelectedMenuButton, ImageGalleryController controller) {
|
||||
final MenuItem menuItem = new MenuItem(cat.getDisplayName(), new ImageView(DrawableAttribute.CATEGORY.getIcon()));
|
||||
menuItem.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
new CategorizeAction(controller).addTag(controller.getTagsManager().getTagName(cat), "");
|
||||
catSelectedMenuButton.setText(cat.getDisplayName());
|
||||
catSelectedMenuButton.setOnAction(this);
|
||||
}
|
||||
});
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
private ImageGalleryController getController() {
|
||||
return controller;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-15 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,7 +19,6 @@
|
||||
package org.sleuthkit.autopsy.imagegallery.gui.drawableviews;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -31,7 +30,6 @@ import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
@ -46,6 +44,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.sleuthkit.autopsy.events.ContentTagAddedEvent;
|
||||
import org.sleuthkit.autopsy.events.ContentTagDeletedEvent;
|
||||
import org.sleuthkit.autopsy.events.TagEvent;
|
||||
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
|
||||
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
||||
@ -77,16 +76,7 @@ public class MetaDataPane extends DrawableUIBase {
|
||||
|
||||
public MetaDataPane(ImageGalleryController controller) {
|
||||
super(controller);
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MetaDataPane.fxml"));
|
||||
fxmlLoader.setRoot(this);
|
||||
fxmlLoader.setController(this);
|
||||
|
||||
try {
|
||||
fxmlLoader.load();
|
||||
} catch (IOException exception) {
|
||||
throw new RuntimeException(exception);
|
||||
}
|
||||
FXMLConstructor.construct(this, "MetaDataPane.fxml");
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -167,7 +157,7 @@ public class MetaDataPane extends DrawableUIBase {
|
||||
public void updateUI() {
|
||||
getFile().ifPresent(file -> {
|
||||
final Image icon = file.getThumbnail();
|
||||
final List<Pair<DrawableAttribute<?>, ?>> attributesList = file.getAttributesList();
|
||||
final List<Pair<DrawableAttribute<?>, Collection<?>>> attributesList = file.getAttributesList();
|
||||
|
||||
Platform.runLater(() -> {
|
||||
imageView.setImage(icon);
|
||||
|
Loading…
x
Reference in New Issue
Block a user