Autopsy  4.1
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-16 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.ImmutableSet;
22 import com.google.common.collect.Iterables;
23 import java.util.Arrays;
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;
36 import static org.sleuthkit.autopsy.timeline.ui.detailview.EventNodeBase.configureActionButton;
37 
41 final public class EventStripeNode extends MultiEventNodeBase<EventStripe, EventCluster, EventClusterNode> {
42 
43  private static final Logger LOGGER = Logger.getLogger(EventStripeNode.class.getName());
44 
48  private Button hideButton;
49 
57  EventStripeNode(DetailsChartLane<?> chartLane, EventStripe eventStripe, EventClusterNode parentNode) {
58  super(chartLane, eventStripe, parentNode);
59 
60  //setup description label
61  descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
62  descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
63 
64  setMinHeight(24);
65  setAlignment(subNodePane, Pos.BOTTOM_LEFT);
66 
67  if (eventStripe.getClusters().size() > 1) {
68  for (EventCluster cluster : eventStripe.getClusters()) {
69  subNodes.add(createChildNode(cluster.withParent(eventStripe)));
70  }
71  //stack componenets vertically
72  getChildren().addAll(new VBox(infoHBox, subNodePane));
73  } else {
74  //if the stripe only has one cluster, use alternate simpler layout
75  EventNodeBase<?> childNode;
76  EventCluster cluster = Iterables.getOnlyElement(eventStripe.getClusters()).withParent(eventStripe);
77  if (cluster.getEventIDs().size() == 1) {
78  childNode = createChildNode(cluster);
79  } else {
80  //if the cluster has more than one event, add the clusters controls to this stripe node directly.
81  EventClusterNode eventClusterNode = (EventClusterNode) createChildNode(cluster);
82  eventClusterNode.installActionButtons();
83  controlsHBox.getChildren().addAll(eventClusterNode.getNewCollapseButton(), eventClusterNode.getNewExpandButton());
84  eventClusterNode.infoHBox.getChildren().remove(eventClusterNode.countLabel);
85  childNode = eventClusterNode;
86  }
87 
88  //hide the cluster description
89  childNode.setDescriptionVisibility(DescriptionVisibility.HIDDEN);
90 
91  subNodes.add(childNode);
92  //stack componenet in z rather than vertically
93  getChildren().addAll(infoHBox, subNodePane);
94  }
95  }
96 
104  private Action newHideAction() {
105  return new HideDescriptionAction(getDescription(), getEvent().getDescriptionLoD(), chartLane.getParentChart());
106  }
107 
108  @Override
109  void installActionButtons() {
110  super.installActionButtons();
111  if (chartLane.quickHideFiltersEnabled() && hideButton == null) {
112  hideButton = ActionUtils.createButton(newHideAction(), ActionUtils.ActionTextBehavior.HIDE);
113  configureActionButton(hideButton);
114 
115  controlsHBox.getChildren().add(hideButton);
116  }
117  }
118 
119  @Override
120  EventNodeBase<?> createChildNode(EventCluster cluster) {
121  ImmutableSet<Long> eventIDs = cluster.getEventIDs();
122  if (eventIDs.size() == 1) {
123  SingleEvent singleEvent = getController().getEventsModel().getEventById(Iterables.getOnlyElement(eventIDs)).withParent(cluster);
124  return new SingleEventNode(getChartLane(), singleEvent, 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 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:161
ImmutableSortedSet< EventCluster > getClusters()

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