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<EventType, BaseTypeTreeItem> childMap =
new HashMap<>();
46 RootItem(Comparator<TreeItem<TimeLineEvent>> comparator) {
55 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
56 public
void insert(TimeLineEvent event) {
57 insert(getTreePath(event));
65 void remove(TimeLineEvent event) {
66 remove(getTreePath(event));
70 void sort(Comparator<TreeItem<TimeLineEvent>> comp, Boolean recursive) {
72 childMap.values().forEach(ti -> ti.sort(comp,
true));
76 String getDisplayText() {
81 EventType getEventType() {
86 void remove(List<TimeLineEvent> path) {
87 TimeLineEvent
event = path.get(0);
88 BaseTypeTreeItem typeTreeItem = childMap.get(event.getEventType().getBaseType());
91 if (typeTreeItem != null) {
92 typeTreeItem.remove(path);
95 if (typeTreeItem.getChildren().isEmpty()) {
96 childMap.remove(event.getEventType().getBaseType());
97 getChildren().remove(typeTreeItem);
103 void insert(List<TimeLineEvent> path) {
104 TimeLineEvent
event = path.get(0);
105 BaseTypeTreeItem treeItem = childMap.computeIfAbsent(event.getEventType().getBaseType(),
106 baseType -> configureNewTreeItem(
new BaseTypeTreeItem(event, getComparator()))
108 treeItem.insert(path);