Autopsy  4.15.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-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 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;
39 import org.sleuthkit.datamodel.TimelineLevelOfDetail;
40 import org.sleuthkit.datamodel.TskCoreException;
41 
45 @NbBundle.Messages({"EventBundleNodeBase.toolTip.loading=loading..."})
46 abstract class MultiEventNodeBase< BundleType extends MultiEvent<ParentType>, ParentType extends MultiEvent<BundleType>, ParentNodeType extends MultiEventNodeBase<
47  ParentType, BundleType, ?>> extends EventNodeBase<BundleType> {
48 
49  static final CornerRadii CORNER_RADII_3 = new CornerRadii(3);
50  static final CornerRadii CORNER_RADII_1 = new CornerRadii(1);
51 
52  final ObservableList<EventNodeBase<?>> subNodes = FXCollections.observableArrayList();
53  final Pane subNodePane = new Pane();
54 
55  private final ReadOnlyObjectWrapper<TimelineLevelOfDetail> descLOD = new ReadOnlyObjectWrapper<>();
56 
57  MultiEventNodeBase(DetailsChartLane<?> chartLane, BundleType event, ParentNodeType parentNode) {
58  super(event, parentNode, chartLane);
59  setDescriptionLOD(event.getDescriptionLevel());
60 
61  setAlignment(Pos.TOP_LEFT);
62  setMaxWidth(USE_PREF_SIZE);
63  infoHBox.setMaxWidth(USE_PREF_SIZE);
64  subNodePane.setPrefWidth(USE_COMPUTED_SIZE);
65  subNodePane.setMinWidth(USE_PREF_SIZE);
66  subNodePane.setMaxWidth(USE_PREF_SIZE);
67  /*
68  * This triggers the layout when a mousover causes the action buttons to
69  * interesect with another node, forcing it down.
70  */
71  heightProperty().addListener(heightProp -> chartLane.requestLayout());
72  Platform.runLater(()
73  -> setLayoutX(chartLane.getXAxis().getDisplayPosition(new DateTime(event.getStartMillis())) - getLayoutXCompensation())
74  );
75 
76  //initialize info hbox
77  infoHBox.setPadding(new Insets(2, 3, 2, 3));
78  infoHBox.setAlignment(Pos.TOP_LEFT);
79 
80  Bindings.bindContent(subNodePane.getChildren(), subNodes);
81  }
82 
83  public ReadOnlyObjectProperty<TimelineLevelOfDetail> descriptionLoDProperty() {
84  return descLOD.getReadOnlyProperty();
85  }
86 
87  final TimelineLevelOfDetail getDescriptionLevel() {
88  return descLOD.get();
89  }
90 
94  final void setDescriptionLOD(final TimelineLevelOfDetail descriptionLoD) {
95  descLOD.set(descriptionLoD);
96  }
97 
98  @Override
99  public List<EventNodeBase<?>> getSubNodes() {
100  return subNodes;
101  }
102 
103  @Override
104  final String getDescription() {
105  return getEvent().getDescription();
106  }
107 
108  @Override
109  final Set<Long> getEventIDs() {
110  return getEvent().getEventIDs();
111  }
112 
113  @Override
114  public Orientation getContentBias() {
115  return Orientation.HORIZONTAL;
116  }
117 
118  @Override
119  protected void layoutChildren() {
120  chartLane.layoutEventBundleNodes(subNodes, 0);
121  super.layoutChildren();
122  }
123 
124  abstract EventNodeBase<?> createChildNode(ParentType rawChild) throws TskCoreException;
125 
126  @Override
127  abstract EventHandler<MouseEvent> getDoubleClickHandler();
128 }

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