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
- Author:
- rstein
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classEditDataSet.DataPointprotected classEditDataSet.PointEditionPopupprotected classEditDataSet.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.BooleanPropertyallowShiftXprotected javafx.beans.property.BooleanPropertyallowShiftYprotected static intDEFAULT_MARKER_RADIUSstatic intDEFAULT_PICKING_DISTANCEprotected javafx.beans.property.ObjectProperty<javafx.scene.Cursor>dragCursorprotected javafx.event.EventHandler<javafx.scene.input.MouseEvent>dragHandlerCreates an event handler that handles a mouse drag on the node.protected javafx.beans.property.BooleanPropertyeditEnableprotected static intFONT_SIZE_COMBOprotected booleanisPointDragActiveprotected java.util.concurrent.ConcurrentHashMap<de.gsi.dataset.EditableDataSet,java.util.concurrent.ConcurrentHashMap<java.lang.Integer,EditDataSet.SelectedDataPoint>>markedPointsprotected javafx.scene.layout.PanemarkerPaneprotected static javafx.css.PseudoClassNOEDIT_PSEUDO_CLASSprotected javafx.scene.CursororiginalCursorprotected EditDataSet.PointEditionPopuppopupprotected static intSELECT_RECT_MIN_SIZEprotected javafx.geometry.Point2DselectEndPointprotected javafx.scene.shape.RectangleselectRectangleprotected javafx.geometry.Point2DselectStartPointprotected static java.lang.StringSTYLE_CLASS_SELECT_PATHprotected static java.lang.StringSTYLE_CLASS_SELECT_RECTprotected java.util.function.Predicate<javafx.scene.input.MouseEvent>zoomInMouseFilter-
Fields inherited from class de.gsi.chart.plugins.TableViewer
editable, FONT_AWESOME, FONT_SIZE
-
-
Constructor Summary
Constructors Constructor Description EditDataSet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPoint(double x, double y)protected voidapplyDrag(double deltaX, double deltaY)protected voiddeleteAllMarkedPoints()javafx.beans.property.ObjectProperty<javafx.scene.Cursor>dragCursorProperty()Mouse cursor to be used during drag operation.javafx.beans.property.ReadOnlyBooleanPropertyeditEnableProperty()protected voidfindDataPoint(Axis xAxis, Axis yAxis, java.util.List<de.gsi.dataset.DataSet> dataSets)protected EditDataSet.DataPointfindNearestDataPoint(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.CursorgetDragCursor()Returns the value of thedragCursorProperty()protected javafx.scene.layout.HBoxgetInteractorBar()Helper function to initialize the UI elements for the Interactor toolbar.doublegetPickingDistance()Returns the value of thepickingDistanceProperty().java.util.function.Predicate<javafx.scene.input.MouseEvent>getSelectionMouseFilter()Returns zoom-in mouse event filter.protected voidinstallCursor()static booleanisControlDown()booleanisEditable()Returns the value of theeditEnableProperty()protected booleanisMouseEventWithinCanvas(javafx.scene.input.MouseEvent mouseEvent)static booleanisShiftDown()protected voidperformPointDrag(javafx.scene.input.MouseEvent event)protected voidperformSelection()javafx.beans.property.DoublePropertypickingDistanceProperty()Distance of the mouse cursor from the data point (expressed in display units) that should trigger showing the tool tip.protected voidselectionDragged(javafx.scene.input.MouseEvent event)protected voidselectionEnded()protected booleanselectionOngoing()protected voidselectionStarted(javafx.scene.input.MouseEvent event)voidsetDragCursor(javafx.scene.Cursor cursor)Sets value of thedragCursorProperty().voidsetPickingDistance(double distance)Sets the value ofpickingDistanceProperty().voidsetZoomInMouseFilter(java.util.function.Predicate<javafx.scene.input.MouseEvent> zoomInMouseFilter)Sets filter onDRAG_DETECTEDevents 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 voiduninstallCursor()protected voidupdateMarker()-
Methods inherited from class de.gsi.chart.plugins.TableViewer
copySelectedToClipboard, exportGridToCSV, getTable
-
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
-
markedPoints
protected 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
-
isShiftDown
public static boolean isShiftDown()
-
isControlDown
public static boolean isControlDown()
-
dragCursorProperty
public final javafx.beans.property.ObjectProperty<javafx.scene.Cursor> dragCursorProperty()
Mouse cursor to be used during drag operation.- Returns:
- the mouse cursor property
-
setDragCursor
public final void setDragCursor(javafx.scene.Cursor cursor)
Sets value of thedragCursorProperty().- Parameters:
cursor- the cursor to be used by the plugin
-
getDragCursor
public final javafx.scene.Cursor getDragCursor()
Returns the value of thedragCursorProperty()- Returns:
- the current cursor
-
editEnableProperty
public final javafx.beans.property.ReadOnlyBooleanProperty editEnableProperty()
- Returns:
- whether points can be edited
-
isEditable
public final boolean isEditable()
Returns the value of theeditEnableProperty()- Returns:
- true: can edit point
-
installCursor
protected void installCursor()
-
uninstallCursor
protected void uninstallCursor()
-
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
-
getPickingDistance
public final double getPickingDistance()
Returns the value of thepickingDistanceProperty().- Returns:
- the current picking distance
-
setPickingDistance
public final void setPickingDistance(double distance)
Sets the value ofpickingDistanceProperty().- Parameters:
distance- the new picking distance
-
getInteractorBar
protected javafx.scene.layout.HBox getInteractorBar()
Description copied from class:TableViewerHelper function to initialize the UI elements for the Interactor toolbar.- Overrides:
getInteractorBarin classTableViewer- Returns:
- HBox node with the toolbar elements
-
selectionStarted
protected void selectionStarted(javafx.scene.input.MouseEvent event)
-
selectionOngoing
protected boolean selectionOngoing()
-
selectionDragged
protected void selectionDragged(javafx.scene.input.MouseEvent event)
-
selectionEnded
protected void selectionEnded()
-
performSelection
protected void performSelection()
-
updateMarker
protected void updateMarker()
-
findDataPoint
protected void findDataPoint(Axis xAxis, Axis yAxis, java.util.List<de.gsi.dataset.DataSet> dataSets)
-
isMouseEventWithinCanvas
protected boolean isMouseEventWithinCanvas(javafx.scene.input.MouseEvent mouseEvent)
-
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)
-
setZoomInMouseFilter
public void setZoomInMouseFilter(java.util.function.Predicate<javafx.scene.input.MouseEvent> zoomInMouseFilter)
Sets filter onDRAG_DETECTEDevents that should start zoom-in operation.- Parameters:
zoomInMouseFilter- the filter to accept zoom-in mouse event. Ifnullthen 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.
-
performPointDrag
protected void performPointDrag(javafx.scene.input.MouseEvent event)
-
applyDrag
protected void applyDrag(double deltaX, double deltaY)
-
addPoint
protected void addPoint(double x, double y)
-
findNearestDataPoint
protected EditDataSet.DataPoint findNearestDataPoint(Chart chart, javafx.geometry.Point2D mouseLocation)
-
findNeighborPoints
protected java.util.List<EditDataSet.DataPoint> findNeighborPoints(XYChart chart, double searchedX)
-
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
-
deleteAllMarkedPoints
protected void deleteAllMarkedPoints()
-
-