mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
tweaks and comments
This commit is contained in:
@@ -76,7 +76,7 @@ import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableFile;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupKey;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupManager;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupViewState;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.Grouping;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.DrawableGroup;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.gui.NoGroupsDialog;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.gui.SummaryTablePane;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.gui.Toolbar;
|
||||
@@ -437,7 +437,7 @@ public final class ImageAnalyzerController implements FileUpdateEvent.FileUpdate
|
||||
Set<GroupKey<?>> groupsForFile = groupManager.getGroupKeysForFileID(fileId);
|
||||
|
||||
for (GroupKey<?> gk : groupsForFile) {
|
||||
Grouping g = groupManager.getGroupForKey(gk);
|
||||
DrawableGroup g = groupManager.getGroupForKey(gk);
|
||||
|
||||
if (g != null) {
|
||||
//if there is aleady a group that was previously deemed fully analyzed, then add this newly analyzed file to it.
|
||||
|
||||
@@ -29,16 +29,16 @@ import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Represents a set of files in a group. The UI listens to changes to the group
|
||||
* and updates itself accordingly.
|
||||
*
|
||||
* This class is named Grouping and not Group to avoid confusion with
|
||||
* {@link javafx.scene.Group} and others.
|
||||
* Represents a set of image/video files in a group. The UI listens to changes
|
||||
* to the group membership and updates itself accordingly.
|
||||
*/
|
||||
public class Grouping {
|
||||
public class DrawableGroup {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(Grouping.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(DrawableGroup.class.getName());
|
||||
|
||||
/**
|
||||
* the string to use when the groupkey is 'empty'
|
||||
*/
|
||||
public static final String UNKNOWN = "unknown";
|
||||
|
||||
private final ObservableList<Long> fileIDs = FXCollections.observableArrayList();
|
||||
@@ -52,7 +52,7 @@ public class Grouping {
|
||||
|
||||
final public GroupKey<?> groupKey;
|
||||
|
||||
public Grouping(GroupKey<?> groupKey, List<Long> filesInGroup) {
|
||||
DrawableGroup(GroupKey<?> groupKey, List<Long> filesInGroup) {
|
||||
this.groupKey = groupKey;
|
||||
fileIDs.setAll(filesInGroup);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class Grouping {
|
||||
}
|
||||
|
||||
synchronized public int getFilesWithHashSetHitsCount() {
|
||||
|
||||
//TODO: use the drawable db for this ? -jm
|
||||
if (filesWithHashSetHitsCount < 0) {
|
||||
filesWithHashSetHitsCount = 0;
|
||||
for (Long fileID : fileIds()) {
|
||||
@@ -105,7 +105,7 @@ public class Grouping {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(this.groupKey,
|
||||
((Grouping) obj).groupKey);
|
||||
((DrawableGroup) obj).groupKey);
|
||||
}
|
||||
|
||||
synchronized public void addFile(Long f) {
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013 Basis Technology Corp.
|
||||
* Copyright 2013-4 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -61,7 +61,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
/**
|
||||
* Provides an abstraction layer on top of {@link DrawableDB} ( and to some
|
||||
* extent {@link SleuthkitCase} ) to facilitate creation, retrieval, updating,
|
||||
* and sorting of {@link Grouping}s.
|
||||
* and sorting of {@link DrawableGroup}s.
|
||||
*/
|
||||
public class GroupManager {
|
||||
|
||||
@@ -72,27 +72,26 @@ public class GroupManager {
|
||||
private final ImageAnalyzerController controller;
|
||||
|
||||
/**
|
||||
* map from {@link GroupKey}s to {@link Grouping}s. All groups (even not
|
||||
* map from {@link GroupKey}s to {@link DrawableGroup}s. All groups (even not
|
||||
* fully analyzed or not visible groups could be in this map
|
||||
*/
|
||||
private final Map<GroupKey<?>, Grouping> groupMap = new HashMap<>();
|
||||
private final Map<GroupKey<?>, DrawableGroup> groupMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* list of all analyzed groups
|
||||
*/
|
||||
@ThreadConfined(type = ThreadType.JFX)
|
||||
private final ObservableList<Grouping> analyzedGroups = FXCollections.observableArrayList();
|
||||
private final ObservableList<DrawableGroup> analyzedGroups = FXCollections.observableArrayList();
|
||||
|
||||
private final ObservableList<Grouping> publicAnalyzedGroupsWrapper = FXCollections.unmodifiableObservableList(analyzedGroups);
|
||||
private final ObservableList<DrawableGroup> publicAnalyzedGroupsWrapper = FXCollections.unmodifiableObservableList(analyzedGroups);
|
||||
/**
|
||||
* list of unseen groups
|
||||
*/
|
||||
@ThreadConfined(type = ThreadType.JFX)
|
||||
private final ObservableList<Grouping> unSeenGroups = FXCollections.observableArrayList();
|
||||
private final ObservableList<DrawableGroup> unSeenGroups = FXCollections.observableArrayList();
|
||||
|
||||
// private final SortedList<Grouping> sortedUnSeenGroups = new SortedList<>(unSeenGroups);
|
||||
|
||||
private final ObservableList<Grouping> publicSortedUnseenGroupsWrapper = FXCollections.unmodifiableObservableList(unSeenGroups);
|
||||
private final ObservableList<DrawableGroup> publicSortedUnseenGroupsWrapper = FXCollections.unmodifiableObservableList(unSeenGroups);
|
||||
|
||||
private ReGroupTask<?> groupByTask;
|
||||
|
||||
@@ -108,12 +107,12 @@ public class GroupManager {
|
||||
regroup(groupBy, sortBy, sortOrder, Boolean.TRUE);
|
||||
}
|
||||
|
||||
public ObservableList<Grouping> getAnalyzedGroups() {
|
||||
public ObservableList<DrawableGroup> getAnalyzedGroups() {
|
||||
return publicAnalyzedGroupsWrapper;
|
||||
}
|
||||
|
||||
@ThreadConfined(type = ThreadType.JFX)
|
||||
public ObservableList<Grouping> getUnSeenGroups() {
|
||||
public ObservableList<DrawableGroup> getUnSeenGroups() {
|
||||
return publicSortedUnseenGroupsWrapper;
|
||||
}
|
||||
|
||||
@@ -173,10 +172,10 @@ public class GroupManager {
|
||||
/**
|
||||
* @param groupKey
|
||||
*
|
||||
* @return return the Grouping (if it exists) for the given GroupKey, or
|
||||
* null if no group exists for that key.
|
||||
* @return return the DrawableGroup (if it exists) for the given GroupKey, or
|
||||
null if no group exists for that key.
|
||||
*/
|
||||
public Grouping getGroupForKey(GroupKey<?> groupKey) {
|
||||
public DrawableGroup getGroupForKey(GroupKey<?> groupKey) {
|
||||
synchronized (groupMap) {
|
||||
return groupMap.get(groupKey);
|
||||
}
|
||||
@@ -222,28 +221,34 @@ public class GroupManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* make and return a group with the given key and files. If a group already
|
||||
* existed for that key, it will be replaced.
|
||||
* make and return a new group with the given key and files. If a group
|
||||
* already existed for that key, it will be replaced.
|
||||
*
|
||||
* @param groupKey
|
||||
* @param files
|
||||
* NOTE: this is the only API for making a new group.
|
||||
*
|
||||
* @return
|
||||
* @param groupKey the groupKey that uniquely identifies this group
|
||||
* @param files a list of fileids that are members of this group
|
||||
*
|
||||
* TODO: check if a group already exists for that key and ... (do what?add
|
||||
* files to it?) -jm
|
||||
* @return the new DrawableGroup for the given key
|
||||
*/
|
||||
public Grouping makeGroup(GroupKey<?> groupKey, List<Long> files) {
|
||||
public DrawableGroup makeGroup(GroupKey<?> groupKey, List<Long> files) {
|
||||
List<Long> newFiles = files == null ? new ArrayList<>() : files;
|
||||
|
||||
Grouping g = new Grouping(groupKey, newFiles);
|
||||
DrawableGroup g = new DrawableGroup(groupKey, newFiles);
|
||||
synchronized (groupMap) {
|
||||
groupMap.put(groupKey, g);
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
public void markGroupSeen(Grouping group) {
|
||||
/**
|
||||
* 'mark' the given group as seen. This removes it from the queue of groups
|
||||
* to review, and is persisted in the drawable db.
|
||||
*
|
||||
*
|
||||
* @param group the {@link DrawableGroup} to mark as seen
|
||||
*/
|
||||
public void markGroupSeen(DrawableGroup group) {
|
||||
synchronized (unSeenGroups) {
|
||||
unSeenGroups.remove(group);
|
||||
}
|
||||
@@ -260,7 +265,7 @@ public class GroupManager {
|
||||
*/
|
||||
public synchronized void removeFromGroup(GroupKey<?> groupKey, final Long fileID) {
|
||||
//get grouping this file would be in
|
||||
final Grouping group = getGroupForKey(groupKey);
|
||||
final DrawableGroup group = getGroupForKey(groupKey);
|
||||
if (group != null) {
|
||||
group.removeFile(fileID);
|
||||
if (group.fileIds().isEmpty()) {
|
||||
@@ -298,7 +303,7 @@ public class GroupManager {
|
||||
* user picked a different group by attribute, while the current task
|
||||
* was still running) */
|
||||
if (task == null || (task.isCancelled() == false)) {
|
||||
Grouping g = makeGroup(groupKey, filesInGroup);
|
||||
DrawableGroup g = makeGroup(groupKey, filesInGroup);
|
||||
|
||||
final boolean groupSeen = db.isGroupSeen(groupKey);
|
||||
Platform.runLater(() -> {
|
||||
|
||||
@@ -43,15 +43,15 @@ public enum GroupSortBy implements ComparatorProvider {
|
||||
*/
|
||||
FILE_COUNT("Group Size", true, "folder-open-image.png") {
|
||||
@Override
|
||||
public Comparator<Grouping> getGrpComparator(final SortOrder sortOrder) {
|
||||
return applySortOrder(sortOrder, Comparator.comparingInt(Grouping::getSize));
|
||||
public Comparator<DrawableGroup> getGrpComparator(final SortOrder sortOrder) {
|
||||
return applySortOrder(sortOrder, Comparator.comparingInt(DrawableGroup::getSize));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A extends Comparable<A>> Comparator<A> getValueComparator(final DrawableAttribute<A> attr, final SortOrder sortOrder) {
|
||||
return (A v1, A v2) -> {
|
||||
Grouping g1 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v1));
|
||||
Grouping g2 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v2));
|
||||
DrawableGroup g1 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v1));
|
||||
DrawableGroup g2 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v2));
|
||||
return getGrpComparator(sortOrder).compare(g1, g2);
|
||||
};
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public enum GroupSortBy implements ComparatorProvider {
|
||||
*/
|
||||
GROUP_BY_VALUE("Group Name", true, "folder-rename.png") {
|
||||
@Override
|
||||
public Comparator<Grouping> getGrpComparator(final SortOrder sortOrder) {
|
||||
public Comparator<DrawableGroup> getGrpComparator(final SortOrder sortOrder) {
|
||||
return applySortOrder(sortOrder, Comparator.comparing(t -> t.groupKey.getValueDisplayName()));
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public enum GroupSortBy implements ComparatorProvider {
|
||||
*/
|
||||
NONE("None", false, "prohibition.png") {
|
||||
@Override
|
||||
public Comparator<Grouping> getGrpComparator(SortOrder sortOrder) {
|
||||
public Comparator<DrawableGroup> getGrpComparator(SortOrder sortOrder) {
|
||||
return new NoOpComparator<>();
|
||||
}
|
||||
|
||||
@@ -95,15 +95,15 @@ public enum GroupSortBy implements ComparatorProvider {
|
||||
*/
|
||||
PRIORITY("Priority", false, "hashset_hits.png") {
|
||||
@Override
|
||||
public Comparator<Grouping> getGrpComparator(SortOrder sortOrder) {
|
||||
return Comparator.nullsLast(Comparator.comparingDouble(Grouping::getHashHitDensity).thenComparingInt(Grouping::getSize).reversed());
|
||||
public Comparator<DrawableGroup> getGrpComparator(SortOrder sortOrder) {
|
||||
return Comparator.nullsLast(Comparator.comparingDouble(DrawableGroup::getHashHitDensity).thenComparingInt(DrawableGroup::getSize).reversed());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A extends Comparable<A>> Comparator<A> getValueComparator(DrawableAttribute<A> attr, SortOrder sortOrder) {
|
||||
return (A v1, A v2) -> {
|
||||
Grouping g1 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v1));
|
||||
Grouping g2 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v2));
|
||||
DrawableGroup g1 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v1));
|
||||
DrawableGroup g2 = ImageAnalyzerController.getDefault().getGroupManager().getGroupForKey(new GroupKey<A>(attr, v2));
|
||||
|
||||
return getGrpComparator(sortOrder).compare(g1, g2);
|
||||
};
|
||||
@@ -181,5 +181,5 @@ interface ComparatorProvider {
|
||||
|
||||
<A extends Comparable<A>> Comparator<A> getValueComparator(DrawableAttribute<A> attr, SortOrder sortOrder);
|
||||
|
||||
Comparator<Grouping> getGrpComparator(SortOrder sortOrder);
|
||||
Comparator<DrawableGroup> getGrpComparator(SortOrder sortOrder);
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ import java.util.Optional;
|
||||
*/
|
||||
public class GroupViewState {
|
||||
|
||||
private final Grouping group;
|
||||
private final DrawableGroup group;
|
||||
|
||||
private final GroupViewMode mode;
|
||||
|
||||
private final Optional<Long> slideShowfileID;
|
||||
|
||||
public Grouping getGroup() {
|
||||
public DrawableGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
@@ -44,17 +44,17 @@ public class GroupViewState {
|
||||
return slideShowfileID;
|
||||
}
|
||||
|
||||
private GroupViewState(Grouping g, GroupViewMode mode, Long slideShowfileID) {
|
||||
private GroupViewState(DrawableGroup g, GroupViewMode mode, Long slideShowfileID) {
|
||||
this.group = g;
|
||||
this.mode = mode;
|
||||
this.slideShowfileID = Optional.ofNullable(slideShowfileID);
|
||||
}
|
||||
|
||||
public static GroupViewState tile(Grouping g) {
|
||||
public static GroupViewState tile(DrawableGroup g) {
|
||||
return new GroupViewState(g, GroupViewMode.TILE, null);
|
||||
}
|
||||
|
||||
public static GroupViewState slideShow(Grouping g, Long fileID) {
|
||||
public static GroupViewState slideShow(DrawableGroup g, Long fileID) {
|
||||
return new GroupViewState(g, GroupViewMode.SLIDE_SHOW, fileID);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,12 +114,12 @@ import org.sleuthkit.autopsy.imageanalyzer.datamodel.Category;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupViewMode;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupViewState;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.Grouping;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.DrawableGroup;
|
||||
import org.sleuthkit.datamodel.TagName;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* A GroupPane displays the contents of a {@link Grouping}. It support both a
|
||||
* A GroupPane displays the contents of a {@link DrawableGroup}. It support both a
|
||||
* {@link TilePane} based view and a {@link SlideShowView} view by swapping out
|
||||
* its internal components.
|
||||
*
|
||||
@@ -204,7 +204,7 @@ public class GroupPane extends BorderPane implements GroupView {
|
||||
/**
|
||||
* the grouping this pane is currently the view for
|
||||
*/
|
||||
private final ReadOnlyObjectWrapper<Grouping> grouping = new ReadOnlyObjectWrapper<>();
|
||||
private final ReadOnlyObjectWrapper<DrawableGroup> grouping = new ReadOnlyObjectWrapper<>();
|
||||
|
||||
/**
|
||||
* map from fileIDs to their assigned cells in the tile view. This is used
|
||||
@@ -252,7 +252,7 @@ public class GroupPane extends BorderPane implements GroupView {
|
||||
this.scrollToFileID(globalSelectionModel.lastSelectedProperty().get());
|
||||
}
|
||||
|
||||
public Grouping getGrouping() {
|
||||
public DrawableGroup getGrouping() {
|
||||
return grouping.get();
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class GroupPane extends BorderPane implements GroupView {
|
||||
} else {
|
||||
groupName = grouping.get().groupKey.getValue().toString();
|
||||
}
|
||||
return StringUtils.defaultIfBlank(groupName, Grouping.UNKNOWN) + " -- " + hashHitCount + " hash set hits / " + size + " files";
|
||||
return StringUtils.defaultIfBlank(groupName, DrawableGroup.UNKNOWN) + " -- " + hashHitCount + " hash set hits / " + size + " files";
|
||||
}
|
||||
|
||||
private MenuItem createGrpCatMenuItem(final Category cat) {
|
||||
@@ -322,7 +322,7 @@ public class GroupPane extends BorderPane implements GroupView {
|
||||
} else {
|
||||
groupName = grouping.get().groupKey.getValue().toString();
|
||||
}
|
||||
final String headerString = StringUtils.defaultIfBlank(groupName, Grouping.UNKNOWN) + " -- " + hashHitCount + " hash set hits / " + size + " files";
|
||||
final String headerString = StringUtils.defaultIfBlank(groupName, DrawableGroup.UNKNOWN) + " -- " + hashHitCount + " hash set hits / " + size + " files";
|
||||
Platform.runLater(() -> {
|
||||
groupLabel.setText(headerString);
|
||||
});
|
||||
@@ -333,7 +333,7 @@ public class GroupPane extends BorderPane implements GroupView {
|
||||
return contextMenu;
|
||||
}
|
||||
|
||||
ReadOnlyObjectProperty<Grouping> grouping() {
|
||||
ReadOnlyObjectProperty<DrawableGroup> grouping() {
|
||||
return grouping.getReadOnlyProperty();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.Grouping;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.DrawableGroup;
|
||||
|
||||
/**
|
||||
* A {@link Node} in the tree that listens to its associated group. Manages
|
||||
@@ -44,7 +44,7 @@ class GroupTreeCell extends TreeCell<TreeNode> {
|
||||
setGraphic(null);
|
||||
});
|
||||
} else {
|
||||
final String name = StringUtils.defaultIfBlank(tNode.getPath(), Grouping.UNKNOWN);
|
||||
final String name = StringUtils.defaultIfBlank(tNode.getPath(), DrawableGroup.UNKNOWN);
|
||||
Platform.runLater(() -> {
|
||||
setTooltip(new Tooltip(name));
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.Grouping;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.DrawableGroup;
|
||||
|
||||
/**
|
||||
* A node in the nav/hash tree. Manages inserts and removals. Has parents and
|
||||
@@ -46,7 +46,7 @@ class GroupTreeItem extends TreeItem<TreeNode> implements Comparable<GroupTreeIt
|
||||
*/
|
||||
private TreeNodeComparators comp;
|
||||
|
||||
public GroupTreeItem(String t, Grouping g, TreeNodeComparators comp) {
|
||||
public GroupTreeItem(String t, DrawableGroup g, TreeNodeComparators comp) {
|
||||
super(new TreeNode(t, g));
|
||||
this.comp = comp;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class GroupTreeItem extends TreeItem<TreeNode> implements Comparable<GroupTreeIt
|
||||
* @param g Group to add
|
||||
* @param tree True if it is part of a tree (versus a list)
|
||||
*/
|
||||
void insert(String path, Grouping g, Boolean tree) {
|
||||
void insert(String path, DrawableGroup g, Boolean tree) {
|
||||
if (tree) {
|
||||
String cleanPath = StringUtils.stripStart(path, "/");
|
||||
|
||||
@@ -132,7 +132,7 @@ class GroupTreeItem extends TreeItem<TreeNode> implements Comparable<GroupTreeIt
|
||||
* @param g Group to add
|
||||
* @param tree True if it is part of a tree (versus a list)
|
||||
*/
|
||||
void insert(List<String> path, Grouping g, Boolean tree) {
|
||||
void insert(List<String> path, DrawableGroup g, Boolean tree) {
|
||||
if (tree) {
|
||||
// Are we at the end of the recursion?
|
||||
if (path.isEmpty()) {
|
||||
@@ -189,7 +189,7 @@ class GroupTreeItem extends TreeItem<TreeNode> implements Comparable<GroupTreeIt
|
||||
return comp.compare(this, o);
|
||||
}
|
||||
|
||||
static GroupTreeItem getTreeItemForGroup(GroupTreeItem root, Grouping grouping) {
|
||||
static GroupTreeItem getTreeItemForGroup(GroupTreeItem root, DrawableGroup grouping) {
|
||||
if (Objects.equals(root.getValue().getGroup(), grouping)) {
|
||||
return root;
|
||||
} else {
|
||||
|
||||
@@ -46,10 +46,10 @@ import org.sleuthkit.autopsy.imageanalyzer.FXMLConstructor;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.ImageAnalyzerController;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableFile;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.DrawableGroup;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupKey;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupSortBy;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.GroupViewState;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.Grouping;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
@@ -155,22 +155,22 @@ public class NavPanel extends TabPane {
|
||||
initHashTree();
|
||||
initNavTree();
|
||||
|
||||
controller.getGroupManager().getAnalyzedGroups().addListener((ListChangeListener.Change<? extends Grouping> change) -> {
|
||||
controller.getGroupManager().getAnalyzedGroups().addListener((ListChangeListener.Change<? extends DrawableGroup> change) -> {
|
||||
while (change.next()) {
|
||||
for (Grouping g : change.getAddedSubList()) {
|
||||
for (DrawableGroup g : change.getAddedSubList()) {
|
||||
insertIntoNavTree(g);
|
||||
if (g.getFilesWithHashSetHitsCount() > 0) {
|
||||
insertIntoHashTree(g);
|
||||
}
|
||||
}
|
||||
for (Grouping g : change.getRemoved()) {
|
||||
for (DrawableGroup g : change.getRemoved()) {
|
||||
removeFromNavTree(g);
|
||||
removeFromHashTree(g);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (Grouping g : controller.getGroupManager().getAnalyzedGroups()) {
|
||||
for (DrawableGroup g : controller.getGroupManager().getAnalyzedGroups()) {
|
||||
insertIntoNavTree(g);
|
||||
if (g.getFilesWithHashSetHitsCount() > 0) {
|
||||
insertIntoHashTree(g);
|
||||
@@ -195,7 +195,7 @@ public class NavPanel extends TabPane {
|
||||
hashTreeRoot.resortChildren(sortByBox.getSelectionModel().getSelectedItem());
|
||||
}
|
||||
|
||||
private void insertIntoHashTree(Grouping g) {
|
||||
private void insertIntoHashTree(DrawableGroup g) {
|
||||
initHashTree();
|
||||
hashTreeRoot.insert(g.groupKey.getValueDisplayName(), g, false);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public class NavPanel extends TabPane {
|
||||
*
|
||||
* @param grouping
|
||||
*/
|
||||
public void setFocusedGroup(Grouping grouping) {
|
||||
public void setFocusedGroup(DrawableGroup grouping) {
|
||||
|
||||
List<String> path = groupingToPath(grouping);
|
||||
|
||||
@@ -228,7 +228,7 @@ public class NavPanel extends TabPane {
|
||||
}
|
||||
|
||||
@SuppressWarnings("fallthrough")
|
||||
private static List<String> groupingToPath(Grouping g) {
|
||||
private static List<String> groupingToPath(DrawableGroup g) {
|
||||
|
||||
if (g.groupKey.getAttribute() == DrawableAttribute.PATH) {
|
||||
String path = g.groupKey.getValueDisplayName();
|
||||
@@ -242,14 +242,14 @@ public class NavPanel extends TabPane {
|
||||
}
|
||||
}
|
||||
|
||||
private void insertIntoNavTree(Grouping g) {
|
||||
private void insertIntoNavTree(DrawableGroup g) {
|
||||
initNavTree();
|
||||
List<String> path = groupingToPath(g);
|
||||
|
||||
navTreeRoot.insert(path, g, true);
|
||||
}
|
||||
|
||||
private void removeFromNavTree(Grouping g) {
|
||||
private void removeFromNavTree(DrawableGroup g) {
|
||||
initNavTree();
|
||||
final GroupTreeItem treeItemForGroup = GroupTreeItem.getTreeItemForGroup(navTreeRoot, g);
|
||||
if (treeItemForGroup != null) {
|
||||
@@ -257,7 +257,7 @@ public class NavPanel extends TabPane {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFromHashTree(Grouping g) {
|
||||
private void removeFromHashTree(DrawableGroup g) {
|
||||
initHashTree();
|
||||
final GroupTreeItem treeItemForGroup = GroupTreeItem.getTreeItemForGroup(hashTreeRoot, g);
|
||||
if (treeItemForGroup != null) {
|
||||
@@ -293,9 +293,9 @@ public class NavPanel extends TabPane {
|
||||
private void rebuildNavTree() {
|
||||
navTreeRoot = new GroupTreeItem("", null, sortByBox.getSelectionModel().selectedItemProperty().get());
|
||||
|
||||
ObservableList<Grouping> groups = controller.getGroupManager().getAnalyzedGroups();
|
||||
ObservableList<DrawableGroup> groups = controller.getGroupManager().getAnalyzedGroups();
|
||||
|
||||
for (Grouping g : groups) {
|
||||
for (DrawableGroup g : groups) {
|
||||
insertIntoNavTree(g);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ public class NavPanel extends TabPane {
|
||||
Collection<GroupKey<?>> groupKeysForFile = controller.getGroupManager().getGroupKeysForFile(file);
|
||||
|
||||
for (GroupKey<?> k : groupKeysForFile) {
|
||||
final Grouping groupForKey = controller.getGroupManager().getGroupForKey(k);
|
||||
final DrawableGroup groupForKey = controller.getGroupManager().getGroupForKey(k);
|
||||
if (groupForKey != null) {
|
||||
insertIntoHashTree(groupForKey);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.imageanalyzer.gui.navpanel;
|
||||
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.Grouping;
|
||||
import org.sleuthkit.autopsy.imageanalyzer.grouping.DrawableGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,22 +26,22 @@ import org.sleuthkit.autopsy.imageanalyzer.grouping.Grouping;
|
||||
class TreeNode {
|
||||
|
||||
private String path;
|
||||
private Grouping group;
|
||||
private DrawableGroup group;
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public Grouping getGroup() {
|
||||
public DrawableGroup getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public TreeNode(String path, Grouping group) {
|
||||
public TreeNode(String path, DrawableGroup group) {
|
||||
this.path = path;
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
void setGroup(Grouping g) {
|
||||
void setGroup(DrawableGroup g) {
|
||||
group = g;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user