Package de.gsi.chart.plugins
Class EditDataSet
- java.lang.Object
-
- de.gsi.chart.plugins.ChartPlugin
-
- de.gsi.chart.plugins.TableViewer
-
- de.gsi.chart.plugins.EditDataSet
-
public class EditDataSet extends TableViewer
Simple plugin to interact with DataSets implementingEditableDataSet
.- Author:
- rstein
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
EditDataSet.DataPoint
protected class
EditDataSet.PointEditionPopup
protected class
EditDataSet.SelectedDataPoint
-
Nested classes/interfaces inherited from class de.gsi.chart.plugins.TableViewer
TableViewer.ColumnType, TableViewer.DataSetsModel, TableViewer.DataSetsRow
-
-
Field Summary
Fields Modifier and Type Field Description protected javafx.beans.property.BooleanProperty
allowShiftX
protected javafx.beans.property.BooleanProperty
allowShiftY
protected static int
DEFAULT_MARKER_RADIUS
static int
DEFAULT_PICKING_DISTANCE
protected java.util.function.Predicate<javafx.scene.input.MouseEvent>
defaultSelectFilter
protected javafx.beans.property.ObjectProperty<javafx.scene.Cursor>
dragCursor
protected javafx.event.EventHandler<javafx.scene.input.MouseEvent>
dragHandler
Creates an event handler that handles a mouse drag on the node.protected javafx.beans.property.BooleanProperty
editEnable
protected static int
FONT_SIZE_COMBO
protected boolean
isPointDragActive
protected java.util.concurrent.ConcurrentHashMap<de.gsi.dataset.EditableDataSet,java.util.concurrent.ConcurrentHashMap<java.lang.Integer,EditDataSet.SelectedDataPoint>>
markedPoints
protected javafx.scene.layout.Pane
markerPane
protected static javafx.css.PseudoClass
NOEDIT_PSEUDO_CLASS
protected javafx.scene.Cursor
originalCursor
protected EditDataSet.PointEditionPopup
popup
protected static int
SELECT_RECT_MIN_SIZE
protected javafx.geometry.Point2D
selectEndPoint
protected javafx.scene.shape.Rectangle
selectRectangle
protected javafx.geometry.Point2D
selectStartPoint
protected static java.lang.String
STYLE_CLASS_SELECT_PATH
protected static java.lang.String
STYLE_CLASS_SELECT_RECT
protected java.util.function.Predicate<javafx.scene.input.MouseEvent>
zoomInMouseFilter
-
Fields inherited from class de.gsi.chart.plugins.TableViewer
editable, FONT_SIZE, MIN_REFRESH_RATE_WARN
-
-
Constructor Summary
Constructors Constructor Description EditDataSet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPoint(double x, double y)
protected void
applyDrag(double deltaX, double deltaY)
protected void
deleteAllMarkedPoints()
javafx.beans.property.ObjectProperty<javafx.scene.Cursor>
dragCursorProperty()
Mouse cursor to be used during drag operation.javafx.beans.property.ReadOnlyBooleanProperty
editEnableProperty()
protected void
findDataPoint(Axis xAxis, Axis yAxis, java.util.List<de.gsi.dataset.DataSet> dataSets)
protected EditDataSet.DataPoint
findNearestDataPoint(Chart chart, javafx.geometry.Point2D mouseLocation)
protected java.util.List<EditDataSet.DataPoint>
findNeighborPoints(XYChart chart, double searchedX)
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.javafx.scene.Cursor
getDragCursor()
Returns the value of thedragCursorProperty()
protected javafx.scene.layout.HBox
getInteractorBar()
Helper function to initialize the UI elements for the Interactor toolbar.double
getPickingDistance()
Returns the value of thepickingDistanceProperty()
.java.util.function.Predicate<javafx.scene.input.MouseEvent>
getSelectionMouseFilter()
Returns zoom-in mouse event filter.protected void
installCursor()
static boolean
isControlDown()
boolean
isEditable()
Returns the value of theeditEnableProperty()
protected boolean
isMouseEventWithinCanvas(javafx.scene.input.MouseEvent mouseEvent)
static boolean
isShiftDown()
protected void
performPointDrag(javafx.scene.input.MouseEvent event)
protected void
performSelection()
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.protected void
selectionDragged(javafx.scene.input.MouseEvent event)
protected void
selectionEnded()
protected boolean
selectionOngoing()
protected void
selectionStarted(javafx.scene.input.MouseEvent event)
void
setDragCursor(javafx.scene.Cursor cursor)
Sets value of thedragCursorProperty()
.void
setPickingDistance(double distance)
Sets the value ofpickingDistanceProperty()
.void
setZoomInMouseFilter(java.util.function.Predicate<javafx.scene.input.MouseEvent> zoomInMouseFilter)
Sets filter onDRAG_DETECTED
events that should start zoom-in operation.protected javafx.event.EventHandler<javafx.scene.input.MouseEvent>
startDragHandler(EditDataSet.SelectedDataPoint dataPoint)
Creates an event handler that handles a mouse press on the node.protected void
uninstallCursor()
protected void
updateMarker()
-
Methods inherited from class de.gsi.chart.plugins.TableViewer
copySelectedToClipboard, exportGridToCSV, getRefreshRate, getTable, refreshRateProperty, setRefreshRate
-
Methods inherited from class de.gsi.chart.plugins.ChartPlugin
addButtonsToToolBarProperty, chartProperty, getChart, getChartChildren, getLocationInPlotArea, isAddButtonsToToolBar, layoutChildren, registerInputEventHandler, setAddButtonsToToolBar, setChart, toDataPoint, toDisplayPoint
-
-
-
-
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
-
SELECT_RECT_MIN_SIZE
protected static final int SELECT_RECT_MIN_SIZE
- See Also:
- Constant Field Values
-
FONT_SIZE_COMBO
protected static final int FONT_SIZE_COMBO
- 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
-
popup
protected EditDataSet.PointEditionPopup popup
-
dragHandler
protected javafx.event.EventHandler<javafx.scene.input.MouseEvent> dragHandler
Creates an event handler that handles a mouse drag on the node.
-
-
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 setsearchedX
- X coordinates- Returns:
- pair of neighbouring data points
-
findNeighborPoints
protected java.util.List<EditDataSet.DataPoint> findNeighborPoints(XYChart chart, double searchedX)
-
getDragCursor
public final javafx.scene.Cursor getDragCursor()
Returns the value of thedragCursorProperty()
- 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 classTableViewer
- Returns:
- HBox node with the toolbar elements
-
getPickingDistance
public final double getPickingDistance()
Returns the value of thepickingDistanceProperty()
.- 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 theeditEnableProperty()
- 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 thedragCursorProperty()
.- Parameters:
cursor
- the cursor to be used by the plugin
-
setPickingDistance
public final void setPickingDistance(double distance)
Sets the value ofpickingDistanceProperty()
.- Parameters:
distance
- the new picking distance
-
setZoomInMouseFilter
public void setZoomInMouseFilter(java.util.function.Predicate<javafx.scene.input.MouseEvent> zoomInMouseFilter)
Sets filter onDRAG_DETECTED
events that should start zoom-in operation.- Parameters:
zoomInMouseFilter
- the filter to accept zoom-in mouse event. Ifnull
then any DRAG_DETECTED event will start zoom-in operation. By default it's set todefaultSelectFilter
.- 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()
-
-