Autopsy  4.17.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
EventStripeNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2015-18 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;
20 
21 import com.google.common.collect.Iterables;
22 import java.util.Arrays;
23 import java.util.Set;
24 import javafx.event.EventHandler;
25 import javafx.geometry.Pos;
26 import javafx.scene.control.Button;
27 import javafx.scene.control.OverrunStyle;
28 import javafx.scene.input.MouseEvent;
29 import javafx.scene.layout.VBox;
30 import org.controlsfx.control.action.Action;
31 import org.controlsfx.control.action.ActionUtils;
32 import static org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.configureActionButton;
36 import org.sleuthkit.datamodel.TskCoreException;
37 import org.sleuthkit.datamodel.TimelineEvent;
38 
42 final public class EventStripeNode extends MultiEventNodeBase<EventStripe, EventCluster, EventClusterNode> {
43 
47  private Button hideButton;
48 
56  EventStripeNode(DetailsChartLane<?> chartLane, EventStripe eventStripe, EventClusterNode parentNode) throws TskCoreException {
57  super(chartLane, eventStripe, parentNode);
58 
59  //setup description label
60  descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
61  descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
62 
63  setMinHeight(24);
64  setAlignment(subNodePane, Pos.BOTTOM_LEFT);
65 
66  if (eventStripe.getClusters().size() > 1) {
67  for (EventCluster cluster : eventStripe.getClusters()) {
68  subNodes.add(createChildNode(cluster.withParent(eventStripe)));
69  }
70  //stack componenets vertically
71  getChildren().addAll(new VBox(infoHBox, subNodePane));
72  } else {
73  //if the stripe only has one cluster, use alternate simpler layout
74  EventNodeBase<?> childNode;
75  EventCluster cluster = Iterables.getOnlyElement(eventStripe.getClusters()).withParent(eventStripe);
76  if (cluster.getEventIDs().size() == 1) {
77  childNode = createChildNode(cluster);
78  } else {
79  //if the cluster has more than one event, add the clusters controls to this stripe node directly.
80  EventClusterNode eventClusterNode = (EventClusterNode) createChildNode(cluster);
81  eventClusterNode.installActionButtons();
82  controlsHBox.getChildren().addAll(eventClusterNode.getNewCollapseButton(), eventClusterNode.getNewExpandButton());
83  eventClusterNode.infoHBox.getChildren().remove(eventClusterNode.countLabel);
84  childNode = eventClusterNode;
85  }
86 
87  //hide the cluster description
88  childNode.setDescriptionVisibility(DescriptionVisibility.HIDDEN);
89 
90  subNodes.add(childNode);
91  //stack componenet in z rather than vertically
92  getChildren().addAll(infoHBox, subNodePane);
93  }
94  }
95 
103  private Action newHideAction() {
104  return new HideDescriptionAction(getDescription(), getEvent().getDescriptionLevel(), chartLane.getParentChart());
105  }
106 
107  @Override
108  protected void installActionButtons() {
109  super.installActionButtons();
110  if (chartLane.quickHideFiltersEnabled() && hideButton == null) {
111  hideButton = ActionUtils.createButton(newHideAction(), ActionUtils.ActionTextBehavior.HIDE);
112  configureActionButton(hideButton);
113 
114  controlsHBox.getChildren().add(hideButton);
115  }
116  }
117 
118  @Override
119  protected EventNodeBase<?> createChildNode(EventCluster cluster) throws TskCoreException {
120  Set<Long> eventIDs = cluster.getEventIDs();
121  if (eventIDs.size() == 1) {
122  TimelineEvent singleEvent = getController().getEventsModel().getEventById(Iterables.getOnlyElement(eventIDs));
123  SingleDetailsViewEvent singleDetailEvent = new SingleDetailsViewEvent(singleEvent).withParent(cluster);
124  return new SingleEventNode(getChartLane(), singleDetailEvent, this);
125  } else {
126  return new EventClusterNode(getChartLane(), cluster, this);
127  }
128  }
129 
130  @Override
131  EventHandler<MouseEvent> getDoubleClickHandler() {
132  return mouseEvent -> {
133  //no-op
134  };
135  }
136 
137  @Override
138  Iterable<? extends Action> getActions() {
139  return Iterables.concat(
140  super.getActions(),
141  Arrays.asList(newHideAction())
142  );
143  }
144 }
TimelineEvent getEventById(Long eventID)

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