19 package org.sleuthkit.autopsy.timeline.ui;
21 import javafx.event.EventHandler;
22 import javafx.event.EventType;
23 import javafx.scene.Cursor;
24 import javafx.scene.chart.Axis;
25 import javafx.scene.chart.Chart;
26 import javafx.scene.control.ContextMenu;
27 import javafx.scene.input.MouseButton;
28 import javafx.scene.input.MouseEvent;
29 import org.controlsfx.control.action.ActionGroup;
30 import org.openide.util.NbBundle;
87 public void handle(MouseEvent mouseEvent) {
89 if (mouseEventType == MouseEvent.MOUSE_PRESSED) {
91 startX = mouseEvent.getX();
92 chart.setCursor(Cursor.H_RESIZE);
93 }
else if (mouseEventType == MouseEvent.MOUSE_DRAGGED) {
94 if (chart.getIntervalSelector() == null) {
96 chart.setIntervalSelector(chart.newIntervalSelector());
97 chart.getIntervalSelector().prefHeightProperty().bind(chart.heightProperty());
98 startX = mouseEvent.getX();
99 chart.getIntervalSelector().relocate(startX, 0);
102 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());
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);
129 public void handle(MouseEvent clickEvent) {
130 if (chart.getChartContextMenu() != null) {
131 chart.getChartContextMenu().hide();
133 if (clickEvent.getButton() == MouseButton.SECONDARY && clickEvent.isStillSincePress()) {
134 chart.getChartContextMenu(clickEvent);
135 chart.setOnMouseMoved(
this);
136 chart.getChartContextMenu().show(chart, clickEvent.getScreenX(), clickEvent.getScreenY());
137 clickEvent.consume();
153 @NbBundle.Messages({
"TimeLineChart.zoomHistoryActionGroup.name=Zoom History"})
155 return new ActionGroup(Bundle.TimeLineChart_zoomHistoryActionGroup_name(),
156 new Back(controller),
void clearIntervalSelector()
ChartDragHandler(Y chart)
TimeLineController getController()
MouseClickedHandler(C chart)
static ActionGroup newZoomHistoyActionGroup(TimeLineController controller)
ContextMenu getChartContextMenu()
IntervalSelector< X > newIntervalSelector()
void handle(MouseEvent mouseEvent)
void handle(MouseEvent clickEvent)
void setIntervalSelector(IntervalSelector<?extends X > newIntervalSelector)
IntervalSelector<?extends X > getIntervalSelector()