19 package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
21 import java.util.ArrayDeque;
22 import java.util.Comparator;
23 import java.util.Deque;
24 import java.util.HashMap;
26 import java.util.Optional;
27 import javafx.scene.control.TreeItem;
35 class RootItem
extends NavTreeItem {
40 private final Map<EventType, EventTypeTreeItem> childMap =
new HashMap<>();
45 private Comparator<TreeItem<EventBundle<?>>> comparator = TreeComparator.Type.reversed();
52 public long getCount() {
53 return getValue().getCount();
61 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
62 public
void insert(EventBundle<?> bundle) {
64 EventTypeTreeItem treeItem = childMap.computeIfAbsent(bundle.getEventType().getBaseType(),
66 EventTypeTreeItem newTreeItem =
new EventTypeTreeItem(bundle, comparator);
67 newTreeItem.setExpanded(
true);
68 getChildren().add(newTreeItem);
71 treeItem.insert(getTreePath(bundle));
76 EventTypeTreeItem typeTreeItem = childMap.get(bundle.getEventType().getBaseType());
77 if (typeTreeItem != null) {
78 typeTreeItem.remove(getTreePath(bundle));
80 if (typeTreeItem.getChildren().isEmpty()) {
81 childMap.remove(bundle.getEventType().getBaseType());
82 getChildren().remove(typeTreeItem);
88 Deque<EventBundle<?>> path =
new ArrayDeque<>();
89 Optional<? extends EventBundle<?>> p = Optional.of(g);
91 while (p.isPresent()) {
93 path.addFirst(parent);
101 void resort(Comparator<TreeItem<
EventBundle<?>>> comp, Boolean recursive) {
103 childMap.values().forEach(ti -> ti.resort(comp,
true));
108 for (EventTypeTreeItem child : childMap.values()) {
109 final NavTreeItem findTreeItemForEvent = child.findTreeItemForEvent(t);
110 if (findTreeItemForEvent != null) {
111 return findTreeItemForEvent;
Optional< ParentType > getParentBundle()