Autopsy  4.6.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
MultiEventNodeBase.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 java.util.List;
22 import java.util.Set;
23 import javafx.application.Platform;
24 import javafx.beans.binding.Bindings;
25 import javafx.beans.property.ReadOnlyObjectProperty;
26 import javafx.beans.property.ReadOnlyObjectWrapper;
27 import javafx.collections.FXCollections;
28 import javafx.collections.ObservableList;
29 import javafx.event.EventHandler;
30 import javafx.geometry.Insets;
31 import javafx.geometry.Orientation;
32 import javafx.geometry.Pos;
33 import javafx.scene.input.MouseEvent;
34 import javafx.scene.layout.CornerRadii;
35 import javafx.scene.layout.Pane;
36 import org.joda.time.DateTime;
37 import org.openide.util.NbBundle;
41 
45 @NbBundle.Messages({"EventBundleNodeBase.toolTip.loading=loading..."})
46 public abstract class MultiEventNodeBase< BundleType extends MultiEvent<ParentType>, ParentType extends MultiEvent<BundleType>, ParentNodeType extends MultiEventNodeBase<
47  ParentType, BundleType, ?>> extends EventNodeBase<BundleType> {
48 
49  private static final Logger LOGGER = Logger.getLogger(MultiEventNodeBase.class.getName());
50 
51  static final CornerRadii CORNER_RADII_3 = new CornerRadii(3);
52  static final CornerRadii CORNER_RADII_1 = new CornerRadii(1);
53 
54  final ObservableList<EventNodeBase<?>> subNodes = FXCollections.observableArrayList();
55  final Pane subNodePane = new Pane();
56 
57  private final ReadOnlyObjectWrapper<DescriptionLoD> descLOD = new ReadOnlyObjectWrapper<>();
58 
59  MultiEventNodeBase(DetailsChartLane<?> chartLane, BundleType event, ParentNodeType parentNode) {
60  super(event, parentNode, chartLane);
61  setDescriptionLOD(event.getDescriptionLoD());
62 
63 
64 
65  setAlignment(Pos.TOP_LEFT);
66  setMaxWidth(USE_PREF_SIZE);
67  infoHBox.setMaxWidth(USE_PREF_SIZE);
68  subNodePane.setPrefWidth(USE_COMPUTED_SIZE);
69  subNodePane.setMinWidth(USE_PREF_SIZE);
70  subNodePane.setMaxWidth(USE_PREF_SIZE);
71  /*
72  * This triggers the layout when a mousover causes the action buttons to
73  * interesect with another node, forcing it down.
74  */
75  heightProperty().addListener(heightProp -> chartLane.requestLayout());
76  Platform.runLater(() ->
77  setLayoutX(chartLane.getXAxis().getDisplayPosition(new DateTime(event.getStartMillis())) - getLayoutXCompensation())
78  );
79 
80  //initialize info hbox
81  infoHBox.setPadding(new Insets(2, 3, 2, 3));
82  infoHBox.setAlignment(Pos.TOP_LEFT);
83 
84  Bindings.bindContent(subNodePane.getChildren(), subNodes);
85  }
86 
87  public ReadOnlyObjectProperty<DescriptionLoD> descriptionLoDProperty() {
88  return descLOD.getReadOnlyProperty();
89  }
90 
91  final DescriptionLoD getDescriptionLoD() {
92  return descLOD.get();
93  }
94 
98  final void setDescriptionLOD(final DescriptionLoD descriptionLoD) {
99  descLOD.set(descriptionLoD);
100  }
101 
102  @SuppressWarnings("unchecked")
103  public List<EventNodeBase<?>> getSubNodes() {
104  return subNodes;
105  }
106 
107  final String getDescription() {
108  return getEvent().getDescription();
109  }
110 
111  final Set<Long> getEventIDs() {
112  return getEvent().getEventIDs();
113  }
114 
115  @Override
116  public Orientation getContentBias() {
117  return Orientation.HORIZONTAL;
118  }
119 
120  @Override
121  protected void layoutChildren() {
122  chartLane.layoutEventBundleNodes(subNodes, 0);
123  super.layoutChildren();
124  }
125 
126  abstract EventNodeBase<?> createChildNode(ParentType rawChild);
127 
128  abstract EventHandler<MouseEvent> getDoubleClickHandler();
129 }
ReadOnlyObjectProperty< DescriptionLoD > descriptionLoDProperty()
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2016 Basis Technology. Generated on: Mon May 7 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.