Package de.gsi.chart.plugins
Class AbstractSingleValueIndicator
- java.lang.Object
-
- de.gsi.chart.plugins.ChartPlugin
-
- de.gsi.chart.plugins.AbstractValueIndicator
-
- de.gsi.chart.plugins.AbstractSingleValueIndicator
-
- All Implemented Interfaces:
ValueIndicator,de.gsi.dataset.event.EventSource
- Direct Known Subclasses:
XValueIndicator,YValueIndicator
public abstract class AbstractSingleValueIndicator extends AbstractValueIndicator implements de.gsi.dataset.event.EventSource, ValueIndicator
Plugin indicating a specific X or Y value as a line drawn on the plot area, with an optionaltext labeldescribing the value.- Author:
- mhrabia
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.gsi.chart.plugins.AbstractValueIndicator
AbstractValueIndicator.Delta
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_PICKING_DISTANCEThe default distance between the data point coordinates and mouse cursor that triggers shifting the line.protected javafx.scene.shape.LinelineLine indicating the value.protected static doubleMIDDLE_POSITIONprotected javafx.scene.shape.LinepickLineprotected static java.lang.StringSTYLE_CLASS_LABELprotected static java.lang.StringSTYLE_CLASS_LINEprotected static java.lang.StringSTYLE_CLASS_MARKERprotected javafx.scene.shape.Polygontrianglesmall triangle marker as handler to shift the line markerprotected static doubletriangleHalfWidth-
Fields inherited from class de.gsi.chart.plugins.AbstractValueIndicator
dragDelta, editableIndicator, label, labelEdit
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSingleValueIndicator(Axis axis, double value, java.lang.String text)Creates a new instance of AbstractSingleValueIndicator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.atomic.AtomicBooleanautoNotification()doublegetLabelPosition()Returns the value of thelabelPositionProperty().doublegetPickingDistance()Returns the value of thepickingDistanceProperty().doublegetValue()Returns the indicated value.booleanisAutoRemove()javafx.beans.property.DoublePropertylabelPositionProperty()Relative position, between 0.0 (left, bottom) and 1.0 (right, top) of the descriptionlabelin the plot area.protected voidlayoutLine(double startX, double startY, double endX, double endY)Sets the line coordinates.protected voidlayoutMarker(double startX, double startY, double endX, double endY)Sets the marker coordinates.javafx.beans.property.DoublePropertypickingDistanceProperty()Distance of the mouse cursor from the line (in pixel) that should trigger the moving of the line.voidsetAutoRemove(boolean autoRemove)voidsetLabelPosition(double value)Sets the new value of thelabelPositionProperty().voidsetPickingDistance(double distance)Sets the value ofpickingDistanceProperty().voidsetValue(double newValue)Sets the value that should be indicated.java.util.List<de.gsi.dataset.event.EventListener>updateEventListener()javafx.beans.property.DoublePropertyvalueProperty()Value indicated by this plugin.-
Methods inherited from class de.gsi.chart.plugins.AbstractValueIndicator
addChildNodeIfNotPresent, editableIndicatorProperty, getAxis, getLabelHorizontalAnchor, getLabelVerticalAnchor, getText, isEditable, labelHorizontalAnchorProperty, labelVerticalAnchorProperty, layoutLabel, setEditable, setLabelHorizontalAnchor, setLabelVerticalAnchor, setStyleClasses, setText, textProperty, updateStyleClass
-
Methods inherited from class de.gsi.chart.plugins.ChartPlugin
addButtonsToToolBarProperty, chartProperty, getChart, getChartChildren, getLocationInPlotArea, isAddButtonsToToolBar, layoutChildren, registerInputEventHandler, setAddButtonsToToolBar, setChart, toDataPoint, toDisplayPoint
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener
-
Methods inherited from interface de.gsi.chart.plugins.ValueIndicator
getAxis, getText, setText
-
-
-
-
Field Detail
-
DEFAULT_PICKING_DISTANCE
protected static final int DEFAULT_PICKING_DISTANCE
The default distance between the data point coordinates and mouse cursor that triggers shifting the line.- See Also:
- Constant Field Values
-
MIDDLE_POSITION
protected static final double MIDDLE_POSITION
- See Also:
- Constant Field Values
-
STYLE_CLASS_LABEL
protected static final java.lang.String STYLE_CLASS_LABEL
- See Also:
- Constant Field Values
-
STYLE_CLASS_LINE
protected static final java.lang.String STYLE_CLASS_LINE
- See Also:
- Constant Field Values
-
STYLE_CLASS_MARKER
protected static final java.lang.String STYLE_CLASS_MARKER
- See Also:
- Constant Field Values
-
triangleHalfWidth
protected static double triangleHalfWidth
-
line
protected final javafx.scene.shape.Line line
Line indicating the value.
-
pickLine
protected final javafx.scene.shape.Line pickLine
-
triangle
protected final javafx.scene.shape.Polygon triangle
small triangle marker as handler to shift the line marker
-
-
Constructor Detail
-
AbstractSingleValueIndicator
protected AbstractSingleValueIndicator(Axis axis, double value, java.lang.String text)
Creates a new instance of AbstractSingleValueIndicator.- Parameters:
axis- reference axisvalue- a X value to be indicatedtext- the text to be shown by the label. Value ofAbstractValueIndicator.textProperty().
-
-
Method Detail
-
autoNotification
public java.util.concurrent.atomic.AtomicBoolean autoNotification()
- Specified by:
autoNotificationin interfacede.gsi.dataset.event.EventSource
-
getLabelPosition
public final double getLabelPosition()
Returns the value of thelabelPositionProperty().- Returns:
- the relative position of the
text label
-
getPickingDistance
public final double getPickingDistance()
Returns the value of thepickingDistanceProperty().- Returns:
- the current picking distance
-
getValue
public final double getValue()
Returns the indicated value.- Specified by:
getValuein interfaceValueIndicator- Returns:
- indicated value
-
isAutoRemove
public boolean isAutoRemove()
- Returns:
trueindicator should be removed if there is no listener attached to it
-
labelPositionProperty
public final javafx.beans.property.DoubleProperty labelPositionProperty()
Relative position, between 0.0 (left, bottom) and 1.0 (right, top) of the descriptionlabelin the plot area.Default value: 0.5
- Returns:
- labelPosition property
-
layoutLine
protected void layoutLine(double startX, double startY, double endX, double endY)Sets the line coordinates.- Parameters:
startX- start x coordinatestartY- start y coordinateendX- stop x coordinateendY- stop y coordinate
-
layoutMarker
protected void layoutMarker(double startX, double startY, double endX, double endY)Sets the marker coordinates.- Parameters:
startX- start x coordinatestartY- start y coordinateendX- stop x coordinateendY- stop y coordinate
-
pickingDistanceProperty
public final javafx.beans.property.DoubleProperty pickingDistanceProperty()
Distance of the mouse cursor from the line (in pixel) that should trigger the moving of the line. By default initialized to 30.- Returns:
- the picking distance property
-
setAutoRemove
public void setAutoRemove(boolean autoRemove)
- Parameters:
autoRemove-trueindicator should be removed if there is no listener attached to it
-
setLabelPosition
public final void setLabelPosition(double value)
Sets the new value of thelabelPositionProperty().- Parameters:
value- the label position, between 0.0 and 1.0 (both inclusive)
-
setPickingDistance
public final void setPickingDistance(double distance)
Sets the value ofpickingDistanceProperty().- Parameters:
distance- the new picking distance
-
setValue
public final void setValue(double newValue)
Sets the value that should be indicated.- Specified by:
setValuein interfaceValueIndicator- Parameters:
newValue- value to be indicated
-
updateEventListener
public java.util.List<de.gsi.dataset.event.EventListener> updateEventListener()
- Specified by:
updateEventListenerin interfacede.gsi.dataset.event.EventSource
-
valueProperty
public final javafx.beans.property.DoubleProperty valueProperty()
Value indicated by this plugin.- Specified by:
valuePropertyin interfaceValueIndicator- Returns:
- value property
-
-