Autopsy  4.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
EventStripeNode.java
Go to the documentation of this file.
1 /*
2 
3  * Autopsy Forensic Browser
4  *
5  * Copyright 2015 Basis Technology Corp.
6  * Contact: carrier <at> sleuthkit <dot> org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 package org.sleuthkit.autopsy.timeline.ui.detailview;
21 
22 import java.util.Arrays;
23 import java.util.Collection;
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.image.ImageView;
29 import javafx.scene.input.MouseEvent;
30 import javafx.scene.layout.VBox;
31 import org.apache.commons.lang3.StringUtils;
32 import org.controlsfx.control.action.Action;
33 import org.controlsfx.control.action.ActionUtils;
37 import static org.sleuthkit.autopsy.timeline.ui.detailview.EventBundleNodeBase.configureLoDButton;
38 
42 final public class EventStripeNode extends EventBundleNodeBase<EventStripe, EventCluster, EventClusterNode> {
43 
44  private static final Logger LOGGER = Logger.getLogger(EventStripeNode.class.getName());
45  private Button hideButton;
53 // private final HBox clustersHBox = new HBox();
54  private final ImageView eventTypeImageView = new ImageView();
55 
56  @Override
57  void installActionButtons() {
58  if (hideButton == null) {
59  hideButton = ActionUtils.createButton(chart.new HideDescriptionAction(getDescription(), eventBundle.getDescriptionLoD()),
60  ActionUtils.ActionTextBehavior.HIDE);
61  configureLoDButton(hideButton);
62 
63  infoHBox.getChildren().add(hideButton);
64  }
65  }
66 
68  super(chart, eventStripe, parentNode);
69 
70  setMinHeight(48);
71  //setup description label
72  eventTypeImageView.setImage(getEventType().getFXImage());
73  descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
74  descrLabel.setGraphic(eventTypeImageView);
75  descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
76  setAlignment(subNodePane, Pos.BOTTOM_LEFT);
77 
78  for (EventCluster cluster : eventStripe.getClusters()) {
79  subNodes.add(createChildNode(cluster));
80  }
81 
82  getChildren().addAll(new VBox(infoHBox, subNodePane));
83  }
84 
85  @Override
86  EventClusterNode createChildNode(EventCluster cluster) {
87  return new EventClusterNode(chart, cluster, this);
88  }
89 
90  @Override
91  void showHoverControls(final boolean showControls) {
92  super.showHoverControls(showControls);
93  installActionButtons();
94  show(hideButton, showControls);
95  }
96 
98  return getEventBundle();
99  }
100 
104  @Override
105  public void setMaxDescriptionWidth(double w) {
106  descrLabel.setMaxWidth(w);
107  }
108 
114  @Override
115  public synchronized void applyHighlightEffect(boolean applied) {
116  if (applied) {
117  descrLabel.setStyle("-fx-font-weight: bold;"); // NON-NLS
118  setBackground(highlightedBackground);
119  } else {
120  descrLabel.setStyle("-fx-font-weight: normal;"); // NON-NLS
121  setBackground(defaultBackground);
122  }
123  }
124 
125  @Override
126  void setDescriptionVisibiltiyImpl(DescriptionVisibility descrVis) {
127  final int size = getEventStripe().getCount();
128 
129  switch (descrVis) {
130  case HIDDEN:
131  countLabel.setText("");
132  descrLabel.setText("");
133  break;
134  case COUNT_ONLY:
135  descrLabel.setText("");
136  countLabel.setText(String.valueOf(size));
137  break;
138  default:
139  case SHOWN:
140  String description = getEventStripe().getDescription();
141  description = parentNode != null
142  ? " ..." + StringUtils.substringAfter(description, parentNode.getDescription())
143  : description;
144  descrLabel.setText(description);
145  countLabel.setText(((size == 1) ? "" : " (" + size + ")")); // NON-NLS
146  break;
147  }
148  }
149 
150  @Override
151  EventHandler<MouseEvent> getDoubleClickHandler() {
152  return mouseEvent -> {
153  };
154  }
155 
156  @Override
157  Collection<? extends Action> getActions() {
158  return Arrays.asList(chart.new HideDescriptionAction(getDescription(), eventBundle.getDescriptionLoD()));
159  }
160 }
EventStripeNode(EventDetailsChart chart, EventStripe eventStripe, EventClusterNode parentNode)
synchronized static Logger getLogger(String name)
Definition: Logger.java:166
ImmutableSortedSet< EventCluster > getClusters()

Copyright © 2012-2015 Basis Technology. Generated on: Wed Apr 6 2016
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.