Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
TimeLineChart.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2014-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 */
19package org.sleuthkit.autopsy.timeline.ui;
20
21import javafx.collections.ObservableList;
22import javafx.event.EventHandler;
23import javafx.event.EventType;
24import javafx.scene.Cursor;
25import javafx.scene.Node;
26import javafx.scene.chart.Axis;
27import javafx.scene.control.ContextMenu;
28import javafx.scene.input.MouseButton;
29import javafx.scene.input.MouseEvent;
30import javafx.scene.layout.Region;
31import org.controlsfx.control.action.ActionGroup;
32import org.openide.util.NbBundle;
33import org.sleuthkit.autopsy.timeline.TimeLineController;
34import org.sleuthkit.autopsy.timeline.actions.Back;
35import org.sleuthkit.autopsy.timeline.actions.Forward;
36import org.sleuthkit.autopsy.timeline.ui.IntervalSelector.IntervalSelectorProvider;
37
44
45 ObservableList<? extends Node> getSelectedNodes();
46
47 @Override
49
50 @Override
52
59 @Override
61
62 @Override
64
65 @Override
66 public Axis<X> getXAxis();
67
68 @Override
70
71
78 public static class ChartDragHandler<X, Y extends Region & IntervalSelectorProvider<X>> implements EventHandler<MouseEvent> {
79
80 private final Y chart;
81
82 private double startX; //hanlder maintains position of drag start
83
85 this.chart = chart;
86 }
87
88 @Override
89 public void handle(MouseEvent mouseEvent) {
90 EventType<? extends MouseEvent> mouseEventType = mouseEvent.getEventType();
91 if (mouseEventType == MouseEvent.MOUSE_PRESSED) {
92 //caputure x-position, incase we are repositioning existing selector
93 startX = mouseEvent.getX();
94 chart.setCursor(Cursor.H_RESIZE);
95 } else if (mouseEventType == MouseEvent.MOUSE_DRAGGED) {
96 if (chart.getIntervalSelector() == null) {
97 //make new interval selector
98 chart.setIntervalSelector(chart.newIntervalSelector());
99 chart.getIntervalSelector().prefHeightProperty().bind(chart.heightProperty());
100 startX = mouseEvent.getX();
101 chart.getIntervalSelector().relocate(startX, 0);
102 } else if (mouseEvent.getX() > startX) {
103 //resize/position existing selector
104 chart.getIntervalSelector().relocate(startX, 0);
105 chart.getIntervalSelector().setPrefWidth(mouseEvent.getX() - startX);
106 } else {
107 chart.getIntervalSelector().relocate(mouseEvent.getX(), 0);
108 chart.getIntervalSelector().setPrefWidth(startX - mouseEvent.getX());
109 }
110 chart.getIntervalSelector().autosize();
111 } else if (mouseEventType == MouseEvent.MOUSE_RELEASED) {
112 chart.setCursor(Cursor.DEFAULT);
113 } else if (mouseEventType == MouseEvent.MOUSE_CLICKED) {
114 chart.setCursor(Cursor.DEFAULT);
115 }
116 }
117 }
118
119 static class MouseClickedHandler<X, C extends Region & TimeLineChart<X>> implements EventHandler<MouseEvent> {
120
121 private final C chart;
122
124 this.chart = chart;
125 }
126
127 @Override
128 public void handle(MouseEvent mouseEvent) {
129 if (MouseEvent.MOUSE_CLICKED == mouseEvent.getEventType() && mouseEvent.isPopupTrigger() && mouseEvent.isStillSincePress()) {
130 ContextMenu chartContextMenu = chart.getContextMenu(mouseEvent);
131 chartContextMenu.show(chart, mouseEvent.getScreenX(), mouseEvent.getScreenY());
132 chart.clearContextMenu();
133 } else if (mouseEvent.getButton() == MouseButton.PRIMARY && mouseEvent.isStillSincePress()) {
134 chart.getSelectedNodes().clear();
135 }
136 mouseEvent.consume();
137 }
138 }
139
140 @NbBundle.Messages({"TimeLineChart.zoomHistoryActionGroup.name=Zoom History"})
141 static ActionGroup newZoomHistoyActionGroup(TimeLineController controller) {
142 return new ActionGroup(Bundle.TimeLineChart_zoomHistoryActionGroup_name(),
143 new Back(controller),
144 new Forward(controller));
145 }
146}
ObservableList<? extends Node > getSelectedNodes()
static ActionGroup newZoomHistoyActionGroup(TimeLineController controller)
void setIntervalSelector(IntervalSelector<? extends X > newIntervalSelector)
IntervalSelector<? extends X > getIntervalSelector()

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.