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;
89 public void handle(MouseEvent mouseEvent) {
90 EventType<? extends MouseEvent> mouseEventType = mouseEvent.getEventType();
91 if (mouseEventType == MouseEvent.MOUSE_PRESSED) {
93 startX = mouseEvent.getX();
94 chart.setCursor(Cursor.H_RESIZE);
95 }
else if (mouseEventType == MouseEvent.MOUSE_DRAGGED) {
96 if (chart.getIntervalSelector() == null) {
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) {
104 chart.getIntervalSelector().relocate(startX, 0);
105 chart.getIntervalSelector().setPrefWidth(mouseEvent.getX() -
startX);
107 chart.getIntervalSelector().relocate(mouseEvent.getX(), 0);
108 chart.getIntervalSelector().setPrefWidth(startX - mouseEvent.getX());
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);
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();
136 mouseEvent.consume();
140 @NbBundle.Messages({
"TimeLineChart.zoomHistoryActionGroup.name=Zoom History"})
142 return new ActionGroup(Bundle.TimeLineChart_zoomHistoryActionGroup_name(),
143 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()