diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java index be2b6d886a..963324fc51 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -44,7 +43,6 @@ import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.beans.property.ReadOnlyDoubleWrapper; import javafx.collections.FXCollections; import javafx.collections.ObservableList; -import javafx.collections.transformation.SortedList; import static javafx.concurrent.Worker.State.CANCELLED; import static javafx.concurrent.Worker.State.FAILED; import static javafx.concurrent.Worker.State.READY; @@ -108,12 +106,12 @@ public class GroupManager { */ @ThreadConfined(type = ThreadType.JFX) private final ObservableList analyzedGroups = FXCollections.observableArrayList(); - private final SortedList unmodifiableAnalyzedGroups = new SortedList<>(analyzedGroups); + private final ObservableList unmodifiableAnalyzedGroups = FXCollections.unmodifiableObservableList(analyzedGroups); /** list of unseen groups */ @ThreadConfined(type = ThreadType.JFX) private final ObservableList unSeenGroups = FXCollections.observableArrayList(); - private final SortedList unmodifiableUnSeenGroups = new SortedList<>(unSeenGroups); + private final ObservableList unmodifiableUnSeenGroups = FXCollections.unmodifiableObservableList(unSeenGroups); private ReGroupTask groupByTask; @@ -262,6 +260,7 @@ public class GroupManager { } else if (unSeenGroups.contains(group) == false) { unSeenGroups.add(group); } + FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder)); } /** @@ -286,11 +285,12 @@ public class GroupManager { Platform.runLater(() -> { if (analyzedGroups.contains(group)) { analyzedGroups.remove(group); + FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder)); } if (unSeenGroups.contains(group)) { unSeenGroups.remove(group); + FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder)); } - }); } } else { //group == null @@ -527,8 +527,8 @@ public class GroupManager { setSortBy(sortBy); setSortOrder(sortOrder); Platform.runLater(() -> { - unmodifiableAnalyzedGroups.setComparator(sortBy.getGrpComparator(sortOrder)); - unmodifiableUnSeenGroups.setComparator(sortBy.getGrpComparator(sortOrder)); + FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder)); + FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder)); }); } } @@ -671,6 +671,9 @@ public class GroupManager { Platform.runLater(() -> { if (analyzedGroups.contains(group) == false) { analyzedGroups.add(group); + if (Objects.isNull(task)) { + FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder)); + } } markGroupSeen(group, groupSeen); }); @@ -723,10 +726,6 @@ public class GroupManager { Platform.runLater(() -> { analyzedGroups.clear(); unSeenGroups.clear(); - - final Comparator grpComparator = sortBy.getGrpComparator(sortOrder); - unmodifiableAnalyzedGroups.setComparator(grpComparator); - unmodifiableUnSeenGroups.setComparator(grpComparator); }); // Get the list of group keys @@ -746,7 +745,7 @@ public class GroupManager { groupProgress.progress("regrouping files by " + groupBy.attrName.toString() + " : " + val, p); popuplateIfAnalyzed(new GroupKey(groupBy, val), this); } - + FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder)); updateProgress(1, 1); return null; } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java index 33083c45b4..ea8cb26b00 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java @@ -41,7 +41,6 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javax.swing.SortOrder; import org.openide.util.Exceptions; -import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager; import org.sleuthkit.autopsy.imagegallery.FXMLConstructor; import org.sleuthkit.autopsy.imagegallery.FileIDSelectionModel; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;