19 package org.sleuthkit.autopsy.timeline.ui;
21 import javafx.collections.ObservableList;
22 import javafx.event.EventHandler;
23 import javafx.event.EventType;
24 import javafx.scene.Cursor;
25 import javafx.scene.Node;
26 import javafx.scene.chart.Axis;
27 import javafx.scene.control.ContextMenu;
28 import javafx.scene.input.MouseButton;
29 import javafx.scene.input.MouseEvent;
30 import javafx.scene.layout.Region;
31 import org.controlsfx.control.action.ActionGroup;
32 import org.openide.util.NbBundle;
88 public void handle(MouseEvent mouseEvent) {
90 if (mouseEventType == MouseEvent.MOUSE_PRESSED) {
92 startX = mouseEvent.getX();
93 chart.setCursor(Cursor.H_RESIZE);
94 }
else if (mouseEventType == MouseEvent.MOUSE_DRAGGED) {
95 if (chart.getIntervalSelector() == null) {
97 chart.setIntervalSelector(chart.newIntervalSelector());
98 chart.getIntervalSelector().prefHeightProperty().bind(chart.heightProperty());
99 startX = mouseEvent.getX();
100 chart.getIntervalSelector().relocate(startX, 0);
101 }
else if (mouseEvent.getX() >
startX) {
103 chart.getIntervalSelector().relocate(startX, 0);
104 chart.getIntervalSelector().setPrefWidth(mouseEvent.getX() -
startX);
106 chart.getIntervalSelector().relocate(mouseEvent.getX(), 0);
107 chart.getIntervalSelector().setPrefWidth(startX - mouseEvent.getX());
109 chart.getIntervalSelector().autosize();
110 }
else if (mouseEventType == MouseEvent.MOUSE_RELEASED) {
111 chart.setCursor(Cursor.DEFAULT);
112 }
else if (mouseEventType == MouseEvent.MOUSE_CLICKED) {
113 chart.setCursor(Cursor.DEFAULT);
127 public void handle(MouseEvent mouseEvent) {
128 if (MouseEvent.MOUSE_CLICKED == mouseEvent.getEventType() && mouseEvent.isPopupTrigger() && mouseEvent.isStillSincePress()) {
129 ContextMenu chartContextMenu = chart.getContextMenu(mouseEvent);
130 chartContextMenu.show(chart, mouseEvent.getScreenX(), mouseEvent.getScreenY());
131 chart.clearContextMenu();
132 }
else if (mouseEvent.getButton() == MouseButton.PRIMARY && mouseEvent.isStillSincePress()) {
133 chart.getSelectedNodes().clear();
135 mouseEvent.consume();
139 @NbBundle.Messages({
"TimeLineChart.zoomHistoryActionGroup.name=Zoom History"})
141 return new ActionGroup(Bundle.TimeLineChart_zoomHistoryActionGroup_name(),
142 new Back(controller),
void clearIntervalSelector()
ChartDragHandler(Y chart)
TimeLineController getController()
MouseClickedHandler(C chart)
static ActionGroup newZoomHistoyActionGroup(TimeLineController controller)
ObservableList<?extends Node > getSelectedNodes()
IntervalSelector< X > newIntervalSelector()
void handle(MouseEvent mouseEvent)
void handle(MouseEvent mouseEvent)
void setIntervalSelector(IntervalSelector<?extends X > newIntervalSelector)
IntervalSelector<?extends X > getIntervalSelector()