19 package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
21 import java.util.Comparator;
22 import java.util.HashMap;
23 import java.util.List;
25 import javafx.scene.control.TreeItem;
33 class RootItem
extends EventsTreeItem {
38 private final Map<TimelineEventType, CategoryTypeTreeItem> childMap =
new HashMap<>();
46 RootItem(Comparator<TreeItem<DetailViewEvent>> comparator) {
55 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
56 public
void insert(DetailViewEvent event) {
57 insert(getTreePath(event));
65 void remove(DetailViewEvent event) {
66 remove(getTreePath(event));
70 void sort(Comparator<TreeItem<DetailViewEvent>> comp, Boolean recursive) {
72 childMap.values().forEach(treeItem -> treeItem.sort(comp,
true));
76 String getDisplayText() {
81 TimelineEventType getEventType() {
86 void remove(List<DetailViewEvent> path) {
87 DetailViewEvent
event = path.get(0);
88 CategoryTypeTreeItem typeTreeItem = childMap.get(event.getEventType().getCategory());
91 if (typeTreeItem != null) {
92 typeTreeItem.remove(path);
95 if (typeTreeItem.getChildren().isEmpty()) {
96 childMap.remove(event.getEventType().getCategory());
97 getChildren().remove(typeTreeItem);
103 void insert(List<DetailViewEvent> path) {
104 DetailViewEvent
event = path.get(0);
105 CategoryTypeTreeItem treeItem = childMap.computeIfAbsent(event.getEventType().getCategory(),
106 baseType -> configureNewTreeItem(
new CategoryTypeTreeItem(event, getComparator()))
108 treeItem.insert(path);