Merge pull request #852 from millmanorama/fix_tree_population_existing_case

populate tree view when opening an existing case, tweak fxml
This commit is contained in:
Richard Cordovano 2014-08-11 15:10:29 -04:00
commit 12c6618b76
4 changed files with 26 additions and 12 deletions

View File

@ -17,6 +17,6 @@ public @interface ThreadConfined {
public enum ThreadType {
ANY, UI, NOT_UI
ANY, UI, JFX, AWT, NOT_UI
}
}

View File

@ -44,6 +44,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imageanalyzer.EurekaController;
import org.sleuthkit.autopsy.imageanalyzer.EurekaModule;
import org.sleuthkit.autopsy.imageanalyzer.LoggedTask;
import org.sleuthkit.autopsy.imageanalyzer.ThreadConfined;
import org.sleuthkit.autopsy.imageanalyzer.ThreadConfined.ThreadType;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.Category;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imageanalyzer.datamodel.DrawableDB;
@ -74,12 +76,15 @@ public class GroupManager {
private final Map<GroupKey, Grouping> groupMap = new HashMap<>();
/** list of all analyzed groups */
@ThreadConfined(type = ThreadType.JFX)
private final ObservableList<Grouping> analyzedGroups = FXCollections.observableArrayList();
/** list of unseen groups */
@ThreadConfined(type = ThreadType.JFX)
private final ObservableList<Grouping> unSeenGroups = FXCollections.observableArrayList();
/** sorted list of unseen groups */
@ThreadConfined(type = ThreadType.JFX)
private final SortedList<Grouping> sortedUnSeenGroups = unSeenGroups.sorted();
private ReGroupTask groupByTask;
@ -100,6 +105,7 @@ public class GroupManager {
return analyzedGroups;
}
@ThreadConfined(type = ThreadType.JFX)
public SortedList<Grouping> getUnSeenGroups() {
return sortedUnSeenGroups;
}
@ -542,14 +548,19 @@ public class GroupManager {
if (groupByTask != null) {
groupByTask.cancel(true);
}
Platform.runLater(() -> {
sortedUnSeenGroups.setComparator(sortBy.getGrpComparator(groupBy, sortOrder));
});
groupByTask = new ReGroupTask(groupBy, sortBy, sortOrder);
controller.submitBGTask(groupByTask);
} else {
// just resort the list of groups
setSortBy(sortBy);
setSortOrder(sortOrder);
Platform.runLater(() -> {
sortedUnSeenGroups.setComparator(sortBy.getGrpComparator(groupBy, sortOrder));
});
}
}

View File

@ -6,9 +6,8 @@
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<fx:root id="BorderPane" maxHeight="-1.0" maxWidth="-1.0" minHeight="-1.0" minWidth="200.0" prefHeight="-1.0" prefWidth="-1.0" type="javafx.scene.layout.BorderPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<center>
<TabPane fx:id="navTabPane" prefHeight="-1.0" prefWidth="-1.0" tabClosingPolicy="UNAVAILABLE">
<fx:root fx:id="navTabPane" maxHeight="1.7976931348623157E308" prefHeight="-1.0" prefWidth="-1.0" tabClosingPolicy="UNAVAILABLE" type="TabPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<tabs>
<Tab fx:id="navTab" text="Contents">
<content>
@ -63,6 +62,4 @@
</graphic>
</Tab>
</tabs>
</TabPane>
</center>
</fx:root>
</fx:root>

View File

@ -39,7 +39,6 @@ import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import org.apache.commons.lang3.StringUtils;
@ -62,7 +61,7 @@ import org.sleuthkit.datamodel.TskCoreException;
* with images. the user can select folders with images to see them in the
* main GroupPane The other shows folders with hash set hits.
*/
public class NavPanel extends BorderPane {
public class NavPanel extends TabPane {
@FXML
private ResourceBundle resources;
@ -113,7 +112,7 @@ public class NavPanel extends BorderPane {
assert navTree != null : "fx:id=\"navTree\" was not injected: check your FXML file 'NavPanel.fxml'.";
assert sortByBox != null : "fx:id=\"sortByBox\" was not injected: check your FXML file 'NavPanel.fxml'.";
VBox.setVgrow(this, Priority.SOMETIMES);
VBox.setVgrow(this, Priority.ALWAYS);
navTree.setShowRoot(false);
hashTree.setShowRoot(false);
@ -169,6 +168,13 @@ public class NavPanel extends BorderPane {
}
});
for (Grouping g : controller.getGroupManager().getAnalyzedGroups()) {
insertIntoNavTree(g);
if (g.getFilesWithHashSetHitsCount() > 0) {
insertIntoHashTree(g);
}
}
controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable, GroupViewState oldValue, GroupViewState newValue) -> {
if (newValue != null && newValue.getGroup() != null) {
setFocusedGroup(newValue.getGroup());