Class EditDataSet


  • public class EditDataSet
    extends TableViewer
    Simple plugin to interact with DataSets implementing EditableDataSet.
    Author:
    rstein
    • Field Detail

      • STYLE_CLASS_SELECT_RECT

        protected static final java.lang.String STYLE_CLASS_SELECT_RECT
        See Also:
        Constant Field Values
      • STYLE_CLASS_SELECT_PATH

        protected static final java.lang.String STYLE_CLASS_SELECT_PATH
        See Also:
        Constant Field Values
      • NOEDIT_PSEUDO_CLASS

        protected static final javafx.css.PseudoClass NOEDIT_PSEUDO_CLASS
      • DEFAULT_MARKER_RADIUS

        protected static final int DEFAULT_MARKER_RADIUS
        See Also:
        Constant Field Values
      • DEFAULT_PICKING_DISTANCE

        public static final int DEFAULT_PICKING_DISTANCE
        See Also:
        Constant Field Values
      • isPointDragActive

        protected boolean isPointDragActive
      • defaultSelectFilter

        protected final java.util.function.Predicate<javafx.scene.input.MouseEvent> defaultSelectFilter
      • markedPoints

        protected final java.util.concurrent.ConcurrentHashMap<de.gsi.dataset.EditableDataSet,​java.util.concurrent.ConcurrentHashMap<java.lang.Integer,​EditDataSet.SelectedDataPoint>> markedPoints
      • selectRectangle

        protected final javafx.scene.shape.Rectangle selectRectangle
      • selectStartPoint

        protected javafx.geometry.Point2D selectStartPoint
      • selectEndPoint

        protected javafx.geometry.Point2D selectEndPoint
      • originalCursor

        protected javafx.scene.Cursor originalCursor
      • dragCursor

        protected final javafx.beans.property.ObjectProperty<javafx.scene.Cursor> dragCursor
      • editEnable

        protected javafx.beans.property.BooleanProperty editEnable
      • allowShiftX

        protected javafx.beans.property.BooleanProperty allowShiftX
      • allowShiftY

        protected javafx.beans.property.BooleanProperty allowShiftY
      • zoomInMouseFilter

        protected java.util.function.Predicate<javafx.scene.input.MouseEvent> zoomInMouseFilter
      • markerPane

        protected javafx.scene.layout.Pane markerPane
      • dragHandler

        protected javafx.event.EventHandler<javafx.scene.input.MouseEvent> dragHandler
        Creates an event handler that handles a mouse drag on the node.
    • Constructor Detail

      • EditDataSet

        public EditDataSet()
    • Method Detail

      • addPoint

        protected void addPoint​(double x,
                                double y)
      • applyDrag

        protected void applyDrag​(double deltaX,
                                 double deltaY)
      • deleteAllMarkedPoints

        protected void deleteAllMarkedPoints()
      • dragCursorProperty

        public final javafx.beans.property.ObjectProperty<javafx.scene.Cursor> dragCursorProperty()
        Mouse cursor to be used during drag operation.
        Returns:
        the mouse cursor property
      • editEnableProperty

        public final javafx.beans.property.ReadOnlyBooleanProperty editEnableProperty()
        Returns:
        whether points can be edited
      • findDataPoint

        protected void findDataPoint​(Axis xAxis,
                                     Axis yAxis,
                                     java.util.List<de.gsi.dataset.DataSet> dataSets)
      • findNearestDataPoint

        protected EditDataSet.DataPoint findNearestDataPoint​(Chart chart,
                                                             javafx.geometry.Point2D mouseLocation)
      • findNeighborPoints

        protected javafx.util.Pair<EditDataSet.DataPoint,​EditDataSet.DataPoint> findNeighborPoints​(de.gsi.dataset.DataSet dataSet,
                                                                                                         double searchedX)
        Handles series that have data sorted or not sorted with respect to X coordinate.
        Parameters:
        dataSet - data set
        searchedX - X coordinates
        Returns:
        pair of neighbouring data points
      • getDragCursor

        public final javafx.scene.Cursor getDragCursor()
        Returns the value of the dragCursorProperty()
        Returns:
        the current cursor
      • getInteractorBar

        protected javafx.scene.layout.HBox getInteractorBar()
        Description copied from class: TableViewer
        Helper function to initialize the UI elements for the Interactor toolbar.
        Overrides:
        getInteractorBar in class TableViewer
        Returns:
        HBox node with the toolbar elements
      • getPickingDistance

        public final double getPickingDistance()
        Returns the value of the pickingDistanceProperty().
        Returns:
        the current picking distance
      • getSelectionMouseFilter

        public java.util.function.Predicate<javafx.scene.input.MouseEvent> getSelectionMouseFilter()
        Returns zoom-in mouse event filter.
        Returns:
        zoom-in mouse event filter
        See Also:
        setZoomInMouseFilter(Predicate)
      • installCursor

        protected void installCursor()
      • isEditable

        public final boolean isEditable()
        Returns the value of the editEnableProperty()
        Returns:
        true: can edit point
      • isMouseEventWithinCanvas

        protected boolean isMouseEventWithinCanvas​(javafx.scene.input.MouseEvent mouseEvent)
      • performPointDrag

        protected void performPointDrag​(javafx.scene.input.MouseEvent event)
      • performSelection

        protected void performSelection()
      • pickingDistanceProperty

        public final javafx.beans.property.DoubleProperty pickingDistanceProperty()
        Distance of the mouse cursor from the data point (expressed in display units) that should trigger showing the tool tip. By default initialised to 10.
        Returns:
        the picking distance property
      • selectionDragged

        protected void selectionDragged​(javafx.scene.input.MouseEvent event)
      • selectionEnded

        protected void selectionEnded()
      • selectionOngoing

        protected boolean selectionOngoing()
      • selectionStarted

        protected void selectionStarted​(javafx.scene.input.MouseEvent event)
      • setDragCursor

        public final void setDragCursor​(javafx.scene.Cursor cursor)
        Sets value of the dragCursorProperty().
        Parameters:
        cursor - the cursor to be used by the plugin
      • setPickingDistance

        public final void setPickingDistance​(double distance)
        Sets the value of pickingDistanceProperty().
        Parameters:
        distance - the new picking distance
      • setZoomInMouseFilter

        public void setZoomInMouseFilter​(java.util.function.Predicate<javafx.scene.input.MouseEvent> zoomInMouseFilter)
        Sets filter on DRAG_DETECTED events that should start zoom-in operation.
        Parameters:
        zoomInMouseFilter - the filter to accept zoom-in mouse event. If null then any DRAG_DETECTED event will start zoom-in operation. By default it's set to defaultSelectFilter.
        See Also:
        getSelectionMouseFilter()
      • startDragHandler

        protected javafx.event.EventHandler<javafx.scene.input.MouseEvent> startDragHandler​(EditDataSet.SelectedDataPoint dataPoint)
        Creates an event handler that handles a mouse press on the node.
        Parameters:
        dataPoint - corresponding to clicked data point
        Returns:
        the event handler.
      • uninstallCursor

        protected void uninstallCursor()
      • updateMarker

        protected void updateMarker()
      • isControlDown

        public static boolean isControlDown()
      • isShiftDown

        public static boolean isShiftDown()