Class ATrace2D
- java.lang.Object
-
- info.monitorenter.gui.chart.traces.ATrace2D
-
- All Implemented Interfaces:
ITrace2D,java.beans.PropertyChangeListener,java.io.Serializable,java.lang.Comparable<ITrace2D>,java.util.EventListener
- Direct Known Subclasses:
Trace2DArithmeticMean,Trace2DArithmeticMeanX,Trace2DArithmeticMeanY,Trace2DLtd,Trace2DSimple,Trace2DSorted
public abstract class ATrace2D extends java.lang.Object implements ITrace2D, java.lang.Comparable<ITrace2D>
The abstract basic implementation ofthat provides the major amount of aspects needed in order to work correctly together withITrace2D.Chart2DCaching of minimum and maximum bounds, property change support, the complex z-Index handling (incorporates calls to internals of
Chart2D, default naming, bound management and event handling are covered here.- Version:
- $Revision: 1.75 $
- Author:
- Achim Westermann
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface info.monitorenter.gui.chart.ITrace2D
ITrace2D.DistancePoint
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<ITrace2D>m_computingTracesThe list of traces that compute their values from this trace.protected doublem_maxXCached maximum x value for performance improvement.protected doublem_maxXErrorBarCached maximum x value with error bar extension for performance improvement.protected doublem_maxYCached maximum y value for performance improvement.protected doublem_maxYErrorBarCached maximum y value with error bar extension for performance improvement.protected doublem_minXCached minimum x value for performance improvement.protected doublem_minXErrorBarCached minimum x value with error bar extension for performance improvement.protected doublem_minYCached minimum y value for performance improvement.protected doublem_minYErrorBarCached minimum y value with error bar extension for performance improvement.protected java.lang.Stringm_nameThe name property.protected java.lang.Stringm_physicalUnitsXThe physical unit property for x dimension.protected java.lang.Stringm_physicalUnitsYThe physical unit property for x dimension.protected java.beans.PropertyChangeSupportm_propertyChangeSupportThe instance that add support for firingPropertyChangeEventsand maintainingPropertyChangeListeners.protected java.lang.Objectm_rendererTheChart2Dthis trace is added to.-
Fields inherited from interface info.monitorenter.gui.chart.ITrace2D
PROPERTY_COLOR, PROPERTY_ERRORBARPOLICY, PROPERTY_ERRORBARPOLICY_CONFIGURATION, PROPERTY_LABEL, PROPERTY_MAX_X, PROPERTY_MAX_Y, PROPERTY_MIN_X, PROPERTY_MIN_Y, PROPERTY_NAME, PROPERTY_PAINTERS, PROPERTY_PHYSICALUNITS, PROPERTY_POINT_CHANGED, PROPERTY_POINT_HIGHLIGHTERS_CHANGED, PROPERTY_STROKE, PROPERTY_TRACEPOINT, PROPERTY_VISIBLE, PROPERTY_ZINDEX, Z_INDEX_MIN, ZINDEX_MAX
-
-
Constructor Summary
Constructors Constructor Description ATrace2D()Defcon.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddComputingTrace(ITrace2D trace)Adds a trace that "should" compute values from the points added via.ITrace2D.addPoint(ITracePoint2D)booleanaddErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)Adds the given error bar policy to the internal set of error bar policies.booleanaddPoint(double x, double y)Adds a trace point to the internal data.booleanaddPoint(ITracePoint2D p)Add the given point to thisITrace2D.booleanaddPointHighlighter(IPointPainter<?> highlighter)Adds the given point painter to the internal set of point highlighters.protected abstract booleanaddPointInternal(ITracePoint2D p)Override this template method for the custom add operation that depends on the policies of the implementation.voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Registers a property change listener that will be informed about changes of the property identified by the givenpropertyName.booleanaddTracePainter(ITracePainter<?> painter)Adds the given trace painter to the internal set of trace painters.intcompareTo(ITrace2D o)booleancontainsTracePainter(ITracePainter<?> painter)Returns true if the given painter is contained in this compound painter.protected voidensureInitialized()Ensures that no deadlock due to a missing internal chart reference may occur.protected voidfinalize()Decreases internal instance count by one.protected voidfirePointAdded(ITracePoint2D added)Fire property change events related to an added point.voidfirePointChanged(ITracePoint2D changed, int state)Method triggered by,ITracePoint2D.setLocation(double, double)oraddPoint(ITracePoint2D).removePoint(ITracePoint2D)protected voidfirePointRemoved(ITracePoint2D removed)Fire property change events related to a removed point.protected voidfirePropertyChange(java.lang.String property, java.lang.Object oldvalue, java.lang.Object newvalue)Fires a property change event to the registered listeners.java.util.List<javax.swing.event.ChangeListener>getChangeListeners()Returns a shallow copied list of the change listeners of this instance.java.awt.ColorgetColor()Get theColorthis trace will be painted with.java.util.Set<IErrorBarPolicy<?>>getErrorBarPolicies()Returns theSet<that will be used to render error bars for this trace.IErrorBarPolicy>booleangetHasErrorBars()Returns true if this trace has error bars configured.static intgetInstanceCount()Returns the instanceCount for allATrace2Dsubclasses.java.lang.StringgetLabel()Returns a label for this trace.doublegetMaxX()Returns the original maximum x- value ignoring the offsetX.doublegetMaxY()Returns the original maximum y- value ignoring the offsetY.doublegetMinX()Returns the original minimum x- value ignoring the offsetX.doublegetMinY()Returns the original minimum y- value ignoring the offsetY.java.lang.StringgetName()Returns the name of this trace.ITrace2D.DistancePointgetNearestPointEuclid(double x, double y)Naive implementation that iterates over every point.ITrace2D.DistancePointgetNearestPointManhattan(double x, double y)Naive implementation that iterates over every point.java.lang.StringgetPhysicalUnits()Returns the concatenation[x: ".ITrace2D.getPhysicalUnitsX()", y: "ITrace2D.getPhysicalUnitsY()"]java.lang.StringgetPhysicalUnitsX()Returns the physical unit string value for the x dimension.java.lang.StringgetPhysicalUnitsY()Returns the physical unit string value for the y dimension.java.util.Set<IPointPainter<?>>getPointHighlighters()Returns theSet<that may be used to highlight points of this trace.IPointPainter>java.beans.PropertyChangeListener[]getPropertyChangeListeners(java.lang.String property)Returns all property change listeners for the given property.Chart2DgetRenderer()Returns the chart that renders this instance or null, if this trace is not added to a chart.java.awt.StrokegetStroke()Get theStrokeobject this instance will be painted with.java.util.Set<ITracePainter<?>>getTracePainters()Returns theSet<that will be used to paint this trace.ITracePainter>java.lang.IntegergetZIndex()The z-index defines the order in which this instance will be painted.booleanisVisible()Returns true if this instance should be rendered.protected voidmaxXSearch()Internal search for the maximum x value that is only invoked if no cached value is at hand or bounds have changed by adding new points.protected voidmaxYSearch()Internal search for the maximum y value that is only invoked if no cached value is at hand or bounds have changed by adding new points.protected voidminXSearch()Internal search for the minimum x value that is only invoked if no cached value is at hand or bounds have changed by adding new points.protected voidminYSearch()Internal search for the minimum y value that is only invoked if no cached value is at hand or bounds have changed by adding new points.voidpropertyChange(java.beans.PropertyChangeEvent evt)java.util.Set<IPointPainter<?>>removeAllPointHighlighters()Clears all internal point highlighters used.voidremoveAllPoints()Changes the internal state to empty to allow that the caching of bounds is cleared and delegates the call toremoveAllPointsInternal().protected abstract voidremoveAllPointsInternal()Override this template method for the custom remove operation that depends on theCollectionused in the implementation.booleanremoveComputingTrace(ITrace2D trace)Remove a trace that "should" compute values from the points added via.ITrace2D.addPoint(ITracePoint2D)booleanremoveErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)Removes the given error bar policy from the internal set of error bar policies.booleanremovePoint(ITracePoint2D point)Remove the given point from thisITrace2D.booleanremovePointHighlighter(IPointPainter<?> higlighter)Removes the given point highlighter, if it's class is contained.protected abstract ITracePoint2DremovePointInternal(ITracePoint2D point)Override this template method for the custom remove operation that depends on the internal storage the implementation.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Unregisters a property change listener that has been registered for listening on all properties.voidremovePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)Removes a property change listener for listening on the given property.booleanremoveTracePainter(ITracePainter<?> painter)Removes the given trace painter, if it's class is contained and if more painters are remaining.voidsetColor(java.awt.Color color)Set theColorthis trace will be painted with.java.util.Set<IErrorBarPolicy<?>>setErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)Replaces all internal error bar policies by the new one.voidsetName(java.lang.String name)Sets the descriptive name for this trace.voidsetPhysicalUnits(java.lang.String xunit, java.lang.String yunit)Assigns a specific String representing the physical unit to theITrace2D(e.g.java.util.Set<IPointPainter<?>>setPointHighlighter(IPointPainter<?> highlighter)Replaces all internal point highlighters by the new one.voidsetRenderer(Chart2D renderer)Allows the chart this instance is painted by to register itself.voidsetStroke(java.awt.Stroke stroke)Allows to specify the rendering of the ITrace2D.java.util.Set<ITracePainter<?>>setTracePainter(ITracePainter<?> painter)Replaces all internal trace painters by the new one.voidsetVisible(boolean visible)Set the visible property of this instance.voidsetZIndex(java.lang.Integer zIndex)Sets the internal z-index property.booleanshowsErrorBars()Tests whether error bars are painted by this trace.booleanshowsNegativeXErrorBars()Tests whether error bars in negative x direction are painted by this trace.booleanshowsNegativeYErrorBars()Tests whether error bars in negative y direction are painted by this trace.booleanshowsPositiveXErrorBars()Tests whether error bars in positive x direction are painted by this trace.booleanshowsPositiveYErrorBars()Tests whether error bars in positive y direction are painted by this trace.java.lang.StringtoString()ReturnsgetName().-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface info.monitorenter.gui.chart.ITrace2D
getMaxSize, getSize, isEmpty, iterator
-
-
-
-
Field Detail
-
m_computingTraces
protected java.util.List<ITrace2D> m_computingTraces
The list of traces that compute their values from this trace.
-
m_maxX
protected double m_maxX
Cached maximum x value for performance improvement.
-
m_maxXErrorBar
protected double m_maxXErrorBar
Cached maximum x value with error bar extension for performance improvement.
-
m_maxY
protected double m_maxY
Cached maximum y value for performance improvement.
-
m_maxYErrorBar
protected double m_maxYErrorBar
Cached maximum y value with error bar extension for performance improvement.
-
m_minX
protected double m_minX
Cached minimum x value for performance improvement.
-
m_minXErrorBar
protected double m_minXErrorBar
Cached minimum x value with error bar extension for performance improvement.
-
m_minY
protected double m_minY
Cached minimum y value for performance improvement.
-
m_minYErrorBar
protected double m_minYErrorBar
Cached minimum y value with error bar extension for performance improvement.
-
m_name
protected java.lang.String m_name
The name property.
-
m_physicalUnitsX
protected java.lang.String m_physicalUnitsX
The physical unit property for x dimension.
-
m_physicalUnitsY
protected java.lang.String m_physicalUnitsY
The physical unit property for x dimension.
-
m_propertyChangeSupport
protected java.beans.PropertyChangeSupport m_propertyChangeSupport
The instance that add support for firingPropertyChangeEventsand maintainingPropertyChangeListeners.
-
m_renderer
protected java.lang.Object m_renderer
TheChart2Dthis trace is added to. Needed for synchronization.
-
-
Method Detail
-
getInstanceCount
public static int getInstanceCount()
Returns the instanceCount for allATrace2Dsubclasses.- Returns:
- Returns the instanceCount for all
ATrace2Dsubclasses.
-
addComputingTrace
public void addComputingTrace(ITrace2D trace)
Description copied from interface:ITrace2DAdds a trace that "should" compute values from the points added via.ITrace2D.addPoint(ITracePoint2D)The given trace will be informed in case an add operation on this trace succeeds via
.ITrace2D.addPoint(ITracePoint2D)- Specified by:
addComputingTracein interfaceITrace2D- Parameters:
trace- the trace that will calculate it's points from the added points of this trace.- See Also:
ITrace2D.addComputingTrace(info.monitorenter.gui.chart.ITrace2D)
-
ensureInitialized
protected final void ensureInitialized()
Ensures that no deadlock due to a missing internal chart reference may occur.- Throws:
java.lang.IllegalStateException- if this trace is not assigned to a chart.
-
addErrorBarPolicy
public final boolean addErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Description copied from interface:ITrace2DAdds the given error bar policy to the internal set of error bar policies.It will be the last error bar policy to render (most forward on screen).
- Specified by:
addErrorBarPolicyin interfaceITrace2D- Parameters:
errorBarPolicy- the error bar policy to add for rendering this trace's error bars.- Returns:
- true if the painter was added (same instance was not contained before).
- See Also:
ITrace2D.addErrorBarPolicy(info.monitorenter.gui.chart.IErrorBarPolicy)
-
addPoint
public final boolean addPoint(double x, double y)Description copied from interface:ITrace2DAdds a trace point to the internal data.Warning:
Do not call this method before this trace has been added to a chart or you will not succeed as the chart is needed to get the proper.Chart2D.getTracePointProvider()- Specified by:
addPointin interfaceITrace2D- Parameters:
x- the x-value of the point to add.y- the y-value of the point to add.- Returns:
- true if the operation was successful, false else.
- See Also:
ITrace2D.addPoint(double, double)
-
addPoint
public final boolean addPoint(ITracePoint2D p)
Add the given point to thisITrace2D.This implementation performs caching of minimum and maximum values for x and y and the delegates to
addPointInternal(ITracePoint2D)that has to perform the "real" add operation.Property change events are fired as described in method
.firePointAdded(ITracePoint2D)- Specified by:
addPointin interfaceITrace2D- Parameters:
p- theTracePoint2Dto add.- Returns:
- true if the operation was successful, false else.
- See Also:
firePointChanged(ITracePoint2D, int)
-
addPointHighlighter
public boolean addPointHighlighter(IPointPainter<?> highlighter)
Description copied from interface:ITrace2DAdds the given point painter to the internal set of point highlighters.It will be the last point painter to paint highlighting if highlighting is active.
- Specified by:
addPointHighlighterin interfaceITrace2D- Parameters:
highlighter- the highlighter to add for highlighting this trace.- Returns:
- true if the highlighter was added (class of instance not contained before).
- See Also:
ITrace2D.addPointHighlighter(info.monitorenter.gui.chart.IPointPainter)
-
addPointInternal
protected abstract boolean addPointInternal(ITracePoint2D p)
Override this template method for the custom add operation that depends on the policies of the implementation.
No property change events have to be fired by default. If this method returns
truethe outer logic of the calling methodwill perform bound checks for the new point and fire property changes as described in methodaddPoint(ITracePoint2D).firePointChanged(ITracePoint2D, int)In special cases - when additional modifications to the internal set of points take place (e.g. a further point gets removed) this method should return false (regardless whether the new point was accepted or not) and perform bound checks and fire the property changes as mentioned above "manually".
- Parameters:
p- the point to add.- Returns:
- true if the given point was accepted or false if not.
-
addPropertyChangeListener
public final void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:ITrace2DRegisters a property change listener that will be informed about changes of the property identified by the givenpropertyName.- Specified by:
addPropertyChangeListenerin interfaceITrace2D- Parameters:
propertyName- the name of the property the listener is interested inlistener- a listener that will only be informed if the property identified by the argumentpropertyNamechanges- See Also:
ITrace2D.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
addTracePainter
public boolean addTracePainter(ITracePainter<?> painter)
Description copied from interface:ITrace2DAdds the given trace painter to the internal set of trace painters.It will be the last painter to paint (most forward).
- Specified by:
addTracePainterin interfaceITrace2D- Parameters:
painter- the painter to add for rendering this trace.- Returns:
- true if the painter was added (class of instance not contained before).
- See Also:
ITrace2D.addTracePainter(info.monitorenter.gui.chart.ITracePainter)
-
compareTo
public final int compareTo(ITrace2D o)
- Specified by:
compareToin interfacejava.lang.Comparable<ITrace2D>- Parameters:
o- the trace to compare to.- Returns:
- see interface.
- See Also:
Comparable.compareTo(java.lang.Object)
-
containsTracePainter
public boolean containsTracePainter(ITracePainter<?> painter)
Description copied from interface:ITrace2DReturns true if the given painter is contained in this compound painter.- Specified by:
containsTracePainterin interfaceITrace2D- Parameters:
painter- the painter to check whether it is contained.- Returns:
- true if the given painter is contained in this compound painter.
- See Also:
ITrace2D.containsTracePainter(info.monitorenter.gui.chart.ITracePainter)
-
finalize
protected void finalize() throws java.lang.ThrowableDecreases internal instance count by one.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable- if something goes wrong.
-
firePointAdded
protected void firePointAdded(ITracePoint2D added)
Fire property change events related to an added point.A property change event for property
with null as the old value and the new point as the new value is fired. This allows e.g. rescaling of those instances (instead of having to rescale a whole trace).ITrace2D.PROPERTY_TRACEPOINTAdditionally before this property change, property change events for bounds are fired as described in method
.firePointChanged(ITracePoint2D, int)- Parameters:
added- the point that was added.
-
firePointChanged
public void firePointChanged(ITracePoint2D changed, int state)
Method triggered by,ITracePoint2D.setLocation(double, double)oraddPoint(ITracePoint2D).removePoint(ITracePoint2D)Bound checks are performed and property change events for the properties
,ITrace2D.PROPERTY_MAX_X,ITrace2D.PROPERTY_MIN_XandITrace2D.PROPERTY_MAX_Yare fired if the add bounds have changed due to the modification of the point.ITrace2D.PROPERTY_MIN_YIf
stateisa property change event withITracePoint2D.STATE_CHANGEDwill be fired to all listeners.ITrace2D.PROPERTY_POINT_CHANGED- Specified by:
firePointChangedin interfaceITrace2D- Parameters:
changed- the point that has been changed which may be a newly added point (from, a removed one or a modified one.addPoint(ITracePoint2D)state- one of {to inform about the type of change.ITracePoint2D.STATE_ADDED,ITracePoint2D.STATE_CHANGED,ITracePoint2D.STATE_REMOVED
-
firePointRemoved
protected void firePointRemoved(ITracePoint2D removed)
Fire property change events related to a removed point.A property change event for property
with a point as the old value and null as the new value is fired. This allows e.g. rescaling of those instances (instead of having to rescale a whole trace).ITrace2D.PROPERTY_TRACEPOINTAdditionally before this property change, property change events for bounds are fired as described in method
.firePointChanged(ITracePoint2D, int)- Parameters:
removed- the point that was removed.
-
firePropertyChange
protected final void firePropertyChange(java.lang.String property, java.lang.Object oldvalue, java.lang.Object newvalue)Fires a property change event to the registered listeners.- Parameters:
property- one of thePROPERTY_XXXconstants defined in.ITrace2Doldvalue- the old value of the property.newvalue- the new value of the property.
-
getChangeListeners
public java.util.List<javax.swing.event.ChangeListener> getChangeListeners()
Returns a shallow copied list of the change listeners of this instance.- Returns:
- a shallow copied list of the change listeners of this instance.
-
getColor
public final java.awt.Color getColor()
Get theColorthis trace will be painted with.
-
getErrorBarPolicies
public final java.util.Set<IErrorBarPolicy<?>> getErrorBarPolicies()
Description copied from interface:ITrace2DReturns theSet<that will be used to render error bars for this trace.IErrorBarPolicy>- Specified by:
getErrorBarPoliciesin interfaceITrace2D- Returns:
- the
Set<that will be used to render error bars for this trace.IErrorBarPolicy> - See Also:
ITrace2D.getErrorBarPolicies()
-
getHasErrorBars
public final boolean getHasErrorBars()
Description copied from interface:ITrace2DReturns true if this trace has error bars configured.If this returns false, no error bars will be painted for this trace.
- Specified by:
getHasErrorBarsin interfaceITrace2D- Returns:
- true if this trace has error bars configured.
- See Also:
ITrace2D.getHasErrorBars()
-
getLabel
public final java.lang.String getLabel()
Returns a label for this trace.The label is constructed of
- The name of this trace (
getName()). - The physical unit of this trace (
getPhysicalUnits()).
- Specified by:
getLabelin interfaceITrace2D- Returns:
- a label for this trace.
- See Also:
ITrace2D.getLabel(),getName(),getPhysicalUnits()
- The name of this trace (
-
getMaxX
public final double getMaxX()
Returns the original maximum x- value ignoring the offsetX.
-
getMaxY
public final double getMaxY()
Returns the original maximum y- value ignoring the offsetY.
-
getMinX
public final double getMinX()
Returns the original minimum x- value ignoring the offsetX.
-
getMinY
public final double getMinY()
Returns the original minimum y- value ignoring the offsetY.
-
getName
public final java.lang.String getName()
Returns the name of this trace.- Specified by:
getNamein interfaceITrace2D- Returns:
- the name of this trace.
- See Also:
ITrace2D.getName(),setName(String s)
-
getNearestPointEuclid
public ITrace2D.DistancePoint getNearestPointEuclid(double x, double y)
Naive implementation that iterates over every point.Subclasses that have more insight about their internal data storage could override this with a faster implementation (e.g. if the points are kept in a sorted order a skip - strategy) could find the minimum faster.
- Specified by:
getNearestPointEuclidin interfaceITrace2D- Parameters:
x- the x value as a normalized value between 0 and 1.0.y- the x value as a normalized value between 0 and 1.0.- Returns:
- the nearest point to the given normalized value coordinates of this trace in Euclid distance.
- See Also:
ITrace2D.getNearestPointEuclid(double, double)
-
getNearestPointManhattan
public ITrace2D.DistancePoint getNearestPointManhattan(double x, double y)
Naive implementation that iterates over every point.Subclasses that have more insight about their internal data storage could override this with a faster implementation (e.g. if the points are kept in a sorted order a skip - strategy could find the minimum faster.
- Specified by:
getNearestPointManhattanin interfaceITrace2D- Parameters:
x- the x value as a normalized value between 0 and 1.0.y- the x value as a normalized value between 0 and 1.0.- Returns:
- the nearest point to the given normalized value coordinates of this trace in Manhattan distance.
- See Also:
ITrace2D.getNearestPointManhattan(double, double)
-
getPhysicalUnits
public final java.lang.String getPhysicalUnits()
Description copied from interface:ITrace2DReturns the concatenation[x: ".ITrace2D.getPhysicalUnitsX()", y: "ITrace2D.getPhysicalUnitsY()"]- Specified by:
getPhysicalUnitsin interfaceITrace2D- Returns:
- the concatenation
[x: ".ITrace2D.getPhysicalUnitsX()", y: "ITrace2D.getPhysicalUnitsY()"] - See Also:
ITrace2D.getPhysicalUnits()
-
getPhysicalUnitsX
public final java.lang.String getPhysicalUnitsX()
Description copied from interface:ITrace2DReturns the physical unit string value for the x dimension.- Specified by:
getPhysicalUnitsXin interfaceITrace2D- Returns:
- the physical unit string value for the x dimension.
- See Also:
ITrace2D.getPhysicalUnitsX()
-
getPhysicalUnitsY
public final java.lang.String getPhysicalUnitsY()
Description copied from interface:ITrace2DReturns the physical unit string value for the y dimension.- Specified by:
getPhysicalUnitsYin interfaceITrace2D- Returns:
- the physical unit string value for the y dimension.
- See Also:
ITrace2D.getPhysicalUnitsY()
-
getPointHighlighters
public final java.util.Set<IPointPainter<?>> getPointHighlighters()
Description copied from interface:ITrace2DReturns theSet<that may be used to highlight points of this trace.IPointPainter>This is used by the point highlighting feature:
Chart2D.enablePointHighlighting(boolean)- Specified by:
getPointHighlightersin interfaceITrace2D- Returns:
- the
Set<that may be used to highlight points.IPointPainter> - See Also:
ITrace2D.getPointHighlighters()
-
getPropertyChangeListeners
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String property)
Description copied from interface:ITrace2DReturns all property change listeners for the given property.- Specified by:
getPropertyChangeListenersin interfaceITrace2D- Parameters:
property- one of the constants with thePROPERTY_prefix defined in this class or subclasses.- Returns:
- the property change listeners for the given property.
- See Also:
ITrace2D.getPropertyChangeListeners(String)
-
getRenderer
public final Chart2D getRenderer()
Returns the chart that renders this instance or null, if this trace is not added to a chart.The chart that renders this trace registers itself with this trace in
Chart2D.addTrace(ITrace2D).- Specified by:
getRendererin interfaceITrace2D- Returns:
- Returns the renderer.
- See Also:
Chart2D.addTrace(ITrace2D)
-
getStroke
public final java.awt.Stroke getStroke()
Get theStrokeobject this instance will be painted with.- Specified by:
getStrokein interfaceITrace2D- Returns:
- the
Strokeobject thisITrace2Dwill be painted with. - See Also:
ITrace2D.getStroke()
-
getTracePainters
public final java.util.Set<ITracePainter<?>> getTracePainters()
Description copied from interface:ITrace2DReturns theSet<that will be used to paint this trace.ITracePainter>The original set should be returned by contract to allow adding painters "silently" (vs. using
).ITrace2D.addTracePainter(ITracePainter)- Specified by:
getTracePaintersin interfaceITrace2D- Returns:
- the
Set<that will be used to paint this trace.ITracePainter> - See Also:
ITrace2D.getTracePainters()
-
getZIndex
public final java.lang.Integer getZIndex()
Description copied from interface:ITrace2DThe z-index defines the order in which this instance will be painted.A higher value will bring it more "to the front".
- Specified by:
getZIndexin interfaceITrace2D- Returns:
- the z-index that will define the order in which this instance will be painted.
- See Also:
ITrace2D.getZIndex()
-
isVisible
public final boolean isVisible()
Description copied from interface:ITrace2DReturns true if this instance should be rendered.- Specified by:
isVisiblein interfaceITrace2D- Returns:
- true if this instance should be rendered.
- See Also:
ITrace2D.isVisible()
-
maxXSearch
protected void maxXSearch()
Internal search for the maximum x value that is only invoked if no cached value is at hand or bounds have changed by adding new points.The result is assigned to the property maxX.
- See Also:
getMaxX()
-
maxYSearch
protected void maxYSearch()
Internal search for the maximum y value that is only invoked if no cached value is at hand or bounds have changed by adding new points.The result is assigned to the property maxY.
- See Also:
getMaxY()
-
minXSearch
protected void minXSearch()
Internal search for the minimum x value that is only invoked if no cached value is at hand or bounds have changed by adding new points.The result is assigned to the property minX.
- See Also:
getMinX()
-
minYSearch
protected void minYSearch()
Internal search for the minimum y value that is only invoked if no cached value is at hand or bounds have changed by adding new points.The result is assigned to the property minY.
- See Also:
getMinY()
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
-
removeAllPointHighlighters
public java.util.Set<IPointPainter<?>> removeAllPointHighlighters()
Description copied from interface:ITrace2DClears all internal point highlighters used.Returns the
Set<that was used to highlight points.IPointPainter>This is used by the point highlighting feature:
Chart2D.enablePointHighlighting(boolean)- Specified by:
removeAllPointHighlightersin interfaceITrace2D- Returns:
- the
Set<that was be used to highlight points.IPointPainter> - See Also:
ITrace2D.removeAllPointHighlighters()
-
removeAllPoints
public final void removeAllPoints()
Changes the internal state to empty to allow that the caching of bounds is cleared and delegates the call toremoveAllPointsInternal().- Specified by:
removeAllPointsin interfaceITrace2D- See Also:
ITrace2D.removeAllPoints()
-
removeAllPointsInternal
protected abstract void removeAllPointsInternal()
Override this template method for the custom remove operation that depends on theCollectionused in the implementation.No change events have to be fired, this is done by
ATrace2D.
-
removeComputingTrace
public boolean removeComputingTrace(ITrace2D trace)
Description copied from interface:ITrace2DRemove a trace that "should" compute values from the points added via.ITrace2D.addPoint(ITracePoint2D)- Specified by:
removeComputingTracein interfaceITrace2D- Parameters:
trace- the trace that will calculate it's points from the added points of this trace.- Returns:
- true if the given trace was removed (recognized by the means of
).Object.equals(Object) - See Also:
ITrace2D.removeComputingTrace(info.monitorenter.gui.chart.ITrace2D)
-
removeErrorBarPolicy
public boolean removeErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Description copied from interface:ITrace2DRemoves the given error bar policy from the internal set of error bar policies.- Specified by:
removeErrorBarPolicyin interfaceITrace2D- Parameters:
errorBarPolicy- the error bar policy to remove.- Returns:
- true if the painter was removed (same instance contained before).
- See Also:
ITrace2D.removeErrorBarPolicy(info.monitorenter.gui.chart.IErrorBarPolicy)
-
removePoint
public boolean removePoint(ITracePoint2D point)
Remove the given point from thisITrace2D.This implementation performs caching of minimum and maximum values for x and y and the delegates to
that has to perform the "real" add remove operation.removePointInternal(ITracePoint2D)Property change events are fired as described in method
.firePointRemoved(ITracePoint2D)- Specified by:
removePointin interfaceITrace2D- Parameters:
point- theTracePoint2Dto remove.- Returns:
- true if the removal succeeded, false else: this could be that the given point was not contained.
- See Also:
firePointChanged(ITracePoint2D, int)
-
removePointHighlighter
public boolean removePointHighlighter(IPointPainter<?> higlighter)
Description copied from interface:ITrace2DRemoves the given point highlighter, if it's class is contained.- Specified by:
removePointHighlighterin interfaceITrace2D- Parameters:
higlighter- the highlighter to remove.- Returns:
- true if a point highlighter of the class of the given argument was removed.
- See Also:
ITrace2D.removePointHighlighter(info.monitorenter.gui.chart.IPointPainter)
-
removePointInternal
protected abstract ITracePoint2D removePointInternal(ITracePoint2D point)
Override this template method for the custom remove operation that depends on the internal storage the implementation.The returned point may be the same as the given. But some "computing" traces like
will internally delete a different point and return that one.Trace2DArithmeticMeanNo property change events have to be fired by default. If this method returns
nullthe outer logic of the calling methodwill perform bound checks for the returned point and fire property changes for the propertiesremovePoint(ITracePoint2D),ITrace2D.PROPERTY_MAX_X,ITrace2D.PROPERTY_MIN_XandITrace2D.PROPERTY_MAX_Y.ITrace2D.PROPERTY_MIN_YIn special cases - when additional modifications to the internal set of points take place (e.g. a further point get added) this method should return false (regardless whether the old point was really removed or not) and perform bound checks and fire the property changes as mentioned above "manually".
- Parameters:
point- the point to remove.- Returns:
- null if unsuccessful (and no events should be fired) or the point that actually was removed (in case different than the given one it should be somehow related to the given one).
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:ITrace2DUnregisters a property change listener that has been registered for listening on all properties.- Specified by:
removePropertyChangeListenerin interfaceITrace2D- Parameters:
listener- a listener that will only be informed if the property identified by the argumentpropertyNamechanges- See Also:
ITrace2D.removePropertyChangeListener(java.beans.PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)Description copied from interface:ITrace2DRemoves a property change listener for listening on the given property.- Specified by:
removePropertyChangeListenerin interfaceITrace2D- Parameters:
property- one of the constants with thePROPERTY_prefix defined in this class or subclasses.listener- the listener for this property change.- See Also:
ITrace2D.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
removeTracePainter
public boolean removeTracePainter(ITracePainter<?> painter)
Description copied from interface:ITrace2DRemoves the given trace painter, if it's class is contained and if more painters are remaining.- Specified by:
removeTracePainterin interfaceITrace2D- Parameters:
painter- the trace painter to remove.- Returns:
- true if a trace painter of the class of the given argument was removed.
- See Also:
ITrace2D.removeTracePainter(info.monitorenter.gui.chart.ITracePainter)
-
setColor
public final void setColor(java.awt.Color color)
Set the
Colorthis trace will be painted with.
-
setErrorBarPolicy
public final java.util.Set<IErrorBarPolicy<?>> setErrorBarPolicy(IErrorBarPolicy<?> errorBarPolicy)
Description copied from interface:ITrace2DReplaces all internal error bar policies by the new one.- Specified by:
setErrorBarPolicyin interfaceITrace2D- Parameters:
errorBarPolicy- the new sole painter to use.- Returns:
- the
Set<that was used before.IErrorBarPolicy> - See Also:
ITrace2D.setErrorBarPolicy(info.monitorenter.gui.chart.IErrorBarPolicy)
-
setName
public final void setName(java.lang.String name)
Sets the descriptive name for this trace.If the given argument is null or consists of whitespaces only the lable for this trace might become invisible (depending on physical units set).
- Specified by:
setNamein interfaceITrace2D- Parameters:
name- the descriptive name for this trace.- See Also:
ITrace2D.setName(java.lang.String)
-
setPhysicalUnits
public final void setPhysicalUnits(java.lang.String xunit, java.lang.String yunit)Description copied from interface:ITrace2DAssigns a specific String representing the physical unit to theITrace2D(e.g. Volt, Ohm, lux, ...) which will be displayed by theChart2D- Specified by:
setPhysicalUnitsin interfaceITrace2D- Parameters:
xunit- the physical unit for the x axis.yunit- the physical unit for the y axis.- See Also:
ITrace2D.setPhysicalUnits(String, String)
-
setPointHighlighter
public final java.util.Set<IPointPainter<?>> setPointHighlighter(IPointPainter<?> highlighter)
Description copied from interface:ITrace2DReplaces all internal point highlighters by the new one.- Specified by:
setPointHighlighterin interfaceITrace2D- Parameters:
highlighter- the new sole highlighter to use.- Returns:
- the
Set<that was used before or null if nothing changed.IPointPainter> - See Also:
ITrace2D.setPointHighlighter(info.monitorenter.gui.chart.IPointPainter)
-
setRenderer
public final void setRenderer(Chart2D renderer)
Allows the chart this instance is painted by to register itself.This is internally required for synchronization and re-ordering due to z-Index changes.
- Specified by:
setRendererin interfaceITrace2D- Parameters:
renderer- the chart that paints this instance.
-
setStroke
public final void setStroke(java.awt.Stroke stroke)
Description copied from interface:ITrace2DAllows to specify the rendering of the ITrace2D. This Stroke will be assigned to theGraphics2Dby the renderingChart2Dwhen painting this instance.- Specified by:
setStrokein interfaceITrace2D- Parameters:
stroke- the stroke to use for painting this trace.- See Also:
ITrace2D.setStroke(java.awt.Stroke)
-
setTracePainter
public final java.util.Set<ITracePainter<?>> setTracePainter(ITracePainter<?> painter)
Description copied from interface:ITrace2DReplaces all internal trace painters by the new one.- Specified by:
setTracePainterin interfaceITrace2D- Parameters:
painter- the new sole painter to use.- Returns:
- the
Set<that was used before.ITracePainter> - See Also:
ITrace2D.setTracePainter(info.monitorenter.gui.chart.ITracePainter)
-
setVisible
public final void setVisible(boolean visible)
Set the visible property of this instance.
Invisible
ITrace2Dinstances (visible == false) will not be painted.- Specified by:
setVisiblein interfaceITrace2D- Parameters:
visible- the visible property of this instance to set.- See Also:
ITrace2D.setVisible(boolean)
-
setZIndex
public final void setZIndex(java.lang.Integer zIndex)
Description copied from interface:ITrace2DSets the internal z-index property. This decides the order in which different traces within the sameare painted.Chart2DThe higher the given value is the more this trace will be brought to front.
The value must not be lower than
ITrace2D.Z_INDEX_MIN(0) and higher thanITrace2D.ZINDEX_MAX(100).This might not be tested for increased performance but ignoring these bounds may result in wrong ordering of display.
- Specified by:
setZIndexin interfaceITrace2D- Parameters:
zIndex- the z index of this trace - the lower the value the more in front the trace will appear amongst other traces in the same chart.- See Also:
ITrace2D.setZIndex(java.lang.Integer)
-
showsErrorBars
public boolean showsErrorBars()
Description copied from interface:ITrace2DTests whether error bars are painted by this trace.Returns true if
- this trace contains
IErrorBarPolicyinstances. - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- Specified by:
showsErrorBarsin interfaceITrace2D- Returns:
- true if this trace renders error bars.
- See Also:
ITrace2D.showsErrorBars()
- this trace contains
-
showsNegativeXErrorBars
public boolean showsNegativeXErrorBars()
Description copied from interface:ITrace2DTests whether error bars in negative x direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowNegativeXErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- Specified by:
showsNegativeXErrorBarsin interfaceITrace2D- Returns:
- true if this trace renders error bars in negative x direction.
- See Also:
ITrace2D.showsNegativeXErrorBars()
- this trace contains at leaste one
-
showsNegativeYErrorBars
public boolean showsNegativeYErrorBars()
Description copied from interface:ITrace2DTests whether error bars in negative y direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowNegativeYErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- Specified by:
showsNegativeYErrorBarsin interfaceITrace2D- Returns:
- true if this trace renders error bars in negative y direction.
- See Also:
ITrace2D.showsNegativeYErrorBars()
- this trace contains at leaste one
-
showsPositiveXErrorBars
public boolean showsPositiveXErrorBars()
Description copied from interface:ITrace2DTests whether error bars in positive x direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowPositiveXErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- Specified by:
showsPositiveXErrorBarsin interfaceITrace2D- Returns:
- true if this trace renders error bars in positive x direction.
- See Also:
ITrace2D.showsPositiveXErrorBars()
- this trace contains at leaste one
-
showsPositiveYErrorBars
public boolean showsPositiveYErrorBars()
Description copied from interface:ITrace2DTests whether error bars in positive y direction are painted by this trace.Returns true if
- this trace contains at leaste one
IErrorBarPolicyinstance thatIErrorBarPolicy.isShowPositiveYErrors(). - and at least one of these instances contains at least one
IErrorBarPainterinstance.
- Specified by:
showsPositiveYErrorBarsin interfaceITrace2D- Returns:
- true if this trace renders error bars in positive y direction.
- See Also:
ITrace2D.showsPositiveYErrorBars()
- this trace contains at leaste one
-
-