Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
RootItem.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2014 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.timeline.ui.detailview.tree;
20 
21 import java.util.Comparator;
22 import java.util.HashMap;
23 import java.util.Map;
24 import javafx.application.Platform;
25 import javafx.collections.FXCollections;
26 import javafx.scene.control.TreeItem;
29 
33 class RootItem extends NavTreeItem {
34 
36  private final Map<EventType, EventTypeTreeItem> childMap = new HashMap<>();
37 
39 // private TreeNodeComparators comp;
40  RootItem() {
41 
42  }
43 
44  @Override
45  public int getCount() {
46  return getValue().getCount();
47  }
48 
53  @Override
54  public void insert(AggregateEvent g) {
55 
56  EventTypeTreeItem treeItem = childMap.get(g.getType().getBaseType());
57  if (treeItem == null) {
58  final EventTypeTreeItem newTreeItem = new EventTypeTreeItem(g);
59  newTreeItem.setExpanded(true);
60  childMap.put(g.getType().getBaseType(), newTreeItem);
61  newTreeItem.insert(g);
62 
63  Platform.runLater(() -> {
64  synchronized (getChildren()) {
65  getChildren().add(newTreeItem);
66 
67  FXCollections.sort(getChildren(), TreeComparator.Type);
68  }
69  });
70  } else {
71  treeItem.insert(g);
72  }
73  }
74 
75  @Override
76  public void resort(Comparator<TreeItem<NavTreeNode>> comp) {
77  childMap.values().forEach((ti) -> {
78  ti.resort(comp);
79  });
80  }
81 
82  @Override
83  public TreeItem<NavTreeNode> findTreeItemForEvent(AggregateEvent t) {
84  for (TreeItem<NavTreeNode> child : getChildren()) {
85  final TreeItem<NavTreeNode> findTreeItemForEvent = ((NavTreeItem) child).findTreeItemForEvent(t);
86  if (findTreeItemForEvent != null) {
87  return findTreeItemForEvent;
88  }
89  }
90  return null;
91  }
92 }

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.