mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Merge pull request #1407 from millmanorama/manually_sort_unseengroups
replace buggy JavaFX SortedLists with explicit sorting
This commit is contained in:
commit
a07802d73c
@ -25,7 +25,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -44,7 +43,6 @@ import javafx.beans.property.ReadOnlyDoubleProperty;
|
|||||||
import javafx.beans.property.ReadOnlyDoubleWrapper;
|
import javafx.beans.property.ReadOnlyDoubleWrapper;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.collections.transformation.SortedList;
|
|
||||||
import static javafx.concurrent.Worker.State.CANCELLED;
|
import static javafx.concurrent.Worker.State.CANCELLED;
|
||||||
import static javafx.concurrent.Worker.State.FAILED;
|
import static javafx.concurrent.Worker.State.FAILED;
|
||||||
import static javafx.concurrent.Worker.State.READY;
|
import static javafx.concurrent.Worker.State.READY;
|
||||||
@ -108,12 +106,12 @@ public class GroupManager {
|
|||||||
*/
|
*/
|
||||||
@ThreadConfined(type = ThreadType.JFX)
|
@ThreadConfined(type = ThreadType.JFX)
|
||||||
private final ObservableList<DrawableGroup> analyzedGroups = FXCollections.observableArrayList();
|
private final ObservableList<DrawableGroup> analyzedGroups = FXCollections.observableArrayList();
|
||||||
private final SortedList<DrawableGroup> unmodifiableAnalyzedGroups = new SortedList<>(analyzedGroups);
|
private final ObservableList<DrawableGroup> unmodifiableAnalyzedGroups = FXCollections.unmodifiableObservableList(analyzedGroups);
|
||||||
|
|
||||||
/** list of unseen groups */
|
/** list of unseen groups */
|
||||||
@ThreadConfined(type = ThreadType.JFX)
|
@ThreadConfined(type = ThreadType.JFX)
|
||||||
private final ObservableList<DrawableGroup> unSeenGroups = FXCollections.observableArrayList();
|
private final ObservableList<DrawableGroup> unSeenGroups = FXCollections.observableArrayList();
|
||||||
private final SortedList<DrawableGroup> unmodifiableUnSeenGroups = new SortedList<>(unSeenGroups);
|
private final ObservableList<DrawableGroup> unmodifiableUnSeenGroups = FXCollections.unmodifiableObservableList(unSeenGroups);
|
||||||
|
|
||||||
private ReGroupTask<?> groupByTask;
|
private ReGroupTask<?> groupByTask;
|
||||||
|
|
||||||
@ -262,6 +260,7 @@ public class GroupManager {
|
|||||||
} else if (unSeenGroups.contains(group) == false) {
|
} else if (unSeenGroups.contains(group) == false) {
|
||||||
unSeenGroups.add(group);
|
unSeenGroups.add(group);
|
||||||
}
|
}
|
||||||
|
FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,11 +285,12 @@ public class GroupManager {
|
|||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
if (analyzedGroups.contains(group)) {
|
if (analyzedGroups.contains(group)) {
|
||||||
analyzedGroups.remove(group);
|
analyzedGroups.remove(group);
|
||||||
|
FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
|
||||||
}
|
}
|
||||||
if (unSeenGroups.contains(group)) {
|
if (unSeenGroups.contains(group)) {
|
||||||
unSeenGroups.remove(group);
|
unSeenGroups.remove(group);
|
||||||
|
FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else { //group == null
|
} else { //group == null
|
||||||
@ -527,8 +527,8 @@ public class GroupManager {
|
|||||||
setSortBy(sortBy);
|
setSortBy(sortBy);
|
||||||
setSortOrder(sortOrder);
|
setSortOrder(sortOrder);
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
unmodifiableAnalyzedGroups.setComparator(sortBy.getGrpComparator(sortOrder));
|
FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
|
||||||
unmodifiableUnSeenGroups.setComparator(sortBy.getGrpComparator(sortOrder));
|
FXCollections.sort(unSeenGroups, sortBy.getGrpComparator(sortOrder));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -671,6 +671,9 @@ public class GroupManager {
|
|||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
if (analyzedGroups.contains(group) == false) {
|
if (analyzedGroups.contains(group) == false) {
|
||||||
analyzedGroups.add(group);
|
analyzedGroups.add(group);
|
||||||
|
if (Objects.isNull(task)) {
|
||||||
|
FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
markGroupSeen(group, groupSeen);
|
markGroupSeen(group, groupSeen);
|
||||||
});
|
});
|
||||||
@ -723,10 +726,6 @@ public class GroupManager {
|
|||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
analyzedGroups.clear();
|
analyzedGroups.clear();
|
||||||
unSeenGroups.clear();
|
unSeenGroups.clear();
|
||||||
|
|
||||||
final Comparator<DrawableGroup> grpComparator = sortBy.getGrpComparator(sortOrder);
|
|
||||||
unmodifiableAnalyzedGroups.setComparator(grpComparator);
|
|
||||||
unmodifiableUnSeenGroups.setComparator(grpComparator);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get the list of group keys
|
// Get the list of group keys
|
||||||
@ -746,7 +745,7 @@ public class GroupManager {
|
|||||||
groupProgress.progress("regrouping files by " + groupBy.attrName.toString() + " : " + val, p);
|
groupProgress.progress("regrouping files by " + groupBy.attrName.toString() + " : " + val, p);
|
||||||
popuplateIfAnalyzed(new GroupKey<A>(groupBy, val), this);
|
popuplateIfAnalyzed(new GroupKey<A>(groupBy, val), this);
|
||||||
}
|
}
|
||||||
|
FXCollections.sort(analyzedGroups, sortBy.getGrpComparator(sortOrder));
|
||||||
updateProgress(1, 1);
|
updateProgress(1, 1);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ import javafx.scene.image.ImageView;
|
|||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javax.swing.SortOrder;
|
import javax.swing.SortOrder;
|
||||||
import org.openide.util.Exceptions;
|
import org.openide.util.Exceptions;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableTagsManager;
|
|
||||||
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
||||||
import org.sleuthkit.autopsy.imagegallery.FileIDSelectionModel;
|
import org.sleuthkit.autopsy.imagegallery.FileIDSelectionModel;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user