19 package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
21 import java.util.Comparator;
22 import java.util.Deque;
23 import java.util.HashMap;
25 import javafx.collections.FXCollections;
26 import javafx.scene.control.TreeItem;
33 class EventDescriptionTreeItem
extends NavTreeItem {
38 private final Map<String, EventDescriptionTreeItem> childMap =
new HashMap<>();
40 private Comparator<TreeItem<EventBundle<?>>> comparator = TreeComparator.Description;
53 public long getCount() {
54 return getValue().getCount();
60 EventDescriptionTreeItem treeItem = childMap.computeIfAbsent(head.
getDescription(), description -> {
61 EventDescriptionTreeItem newTreeItem =
new EventDescriptionTreeItem(head, comparator);
62 newTreeItem.setExpanded(
true);
63 childMap.put(description, newTreeItem);
64 getChildren().add(newTreeItem);
65 resort(comparator,
false);
69 if (path.isEmpty() ==
false) {
70 treeItem.insert(path);
74 void remove(Deque<EventBundle<?>> path) {
76 EventDescriptionTreeItem descTreeItem = childMap.get(head.
getDescription());
77 if (path.isEmpty() ==
false) {
78 descTreeItem.remove(path);
80 if (descTreeItem.getChildren().isEmpty()) {
82 getChildren().remove(descTreeItem);
87 void resort(Comparator<TreeItem<
EventBundle<?>>> comp, Boolean recursive) {
88 this.comparator = comp;
89 FXCollections.sort(getChildren(), comp);
91 childMap.values().forEach(ti -> ti.resort(comp,
true));
102 for (EventDescriptionTreeItem child : childMap.values()) {
103 final NavTreeItem findTreeItemForEvent = child.findTreeItemForEvent(t);
104 if (findTreeItemForEvent != null) {
105 return findTreeItemForEvent;