mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Merge pull request #1848 from millmanorama/IG-group-sort-bug-fix
maintain proper sorting in tree / list
This commit is contained in:
commit
7600d56ad7
@ -72,16 +72,19 @@ final public class GroupTree extends NavPanel<TreeItem<GroupTreeNode>> {
|
||||
|
||||
groupTree.setCellFactory(treeView -> new GroupTreeCell(getSortByBox().getSelectionModel().selectedItemProperty()));
|
||||
groupTree.setShowRoot(false);
|
||||
|
||||
getGroupManager().getAnalyzedGroups().addListener((ListChangeListener.Change<? extends DrawableGroup> change) -> {
|
||||
while (change.next()) {
|
||||
change.getAddedSubList().stream().forEach(this::insertGroup);
|
||||
change.getRemoved().stream().forEach(this::removeFromTree);
|
||||
}
|
||||
sortGroups();
|
||||
});
|
||||
|
||||
for (DrawableGroup g : getGroupManager().getAnalyzedGroups()) {
|
||||
insertGroup(g);
|
||||
}
|
||||
sortGroups();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,6 +105,7 @@ class GroupTreeItem extends TreeItem<GroupTreeNode> {
|
||||
|
||||
Platform.runLater(() -> {
|
||||
getChildren().add(newTreeItem);
|
||||
getChildren().sort(Comparator.comparing(treeItem -> treeItem.getValue().getGroup(), Comparator.nullsLast(comp)));
|
||||
});
|
||||
return newTreeItem;
|
||||
});
|
||||
@ -122,7 +123,7 @@ class GroupTreeItem extends TreeItem<GroupTreeNode> {
|
||||
final GroupTreeItem newTreeItem = new GroupTreeItem(t, g, true);
|
||||
Platform.runLater(() -> {
|
||||
getChildren().add(newTreeItem);
|
||||
getChildren().sort(Comparator.comparing(treeItem -> treeItem.getValue().getGroup(), comp));
|
||||
getChildren().sort(Comparator.comparing(treeItem -> treeItem.getValue().getGroup(), Comparator.nullsLast(comp)));
|
||||
});
|
||||
return newTreeItem;
|
||||
});
|
||||
@ -171,7 +172,7 @@ class GroupTreeItem extends TreeItem<GroupTreeNode> {
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
synchronized void resortChildren(Comparator<DrawableGroup> newComp) {
|
||||
this.comp = newComp;
|
||||
getChildren().sort(Comparator.comparing(treeItem -> treeItem.getValue().getGroup(), comp));
|
||||
getChildren().sort(Comparator.comparing(treeItem -> treeItem.getValue().getGroup(), Comparator.nullsLast(comp)));
|
||||
for (GroupTreeItem ti : childMap.values()) {
|
||||
ti.resortChildren(comp);
|
||||
}
|
||||
|
@ -75,12 +75,11 @@ final public class HashHitGroupList extends NavPanel<DrawableGroup> {
|
||||
setGraphic(new ImageView("org/sleuthkit/autopsy/imagegallery/images/hashset_hits.png"));
|
||||
|
||||
getBorderPane().setCenter(groupList);
|
||||
sorted = getController().getGroupManager().getAnalyzedGroups().filtered((DrawableGroup t) -> t.getHashSetHitsCount() > 0).sorted();
|
||||
sorted = getController().getGroupManager().getAnalyzedGroups().filtered((DrawableGroup t) -> t.getHashSetHitsCount() > 0).sorted(getDefaultComparator());
|
||||
|
||||
groupList.setCellFactory(treeView -> new GroupListCell(getSortByBox().getSelectionModel().selectedItemProperty()));
|
||||
|
||||
groupList.setItems(sorted);
|
||||
|
||||
}
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
|
||||
|
@ -90,7 +90,6 @@ abstract class NavPanel<X> extends Tab {
|
||||
} else {
|
||||
categoryManager.unregisterListener(NavPanel.this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//keep selection in sync with controller
|
||||
|
Loading…
x
Reference in New Issue
Block a user