Class AErrorBarPolicyConfigurable
- java.lang.Object
-
- info.monitorenter.gui.chart.errorbars.AErrorBarPolicyConfigurable
-
- All Implemented Interfaces:
IErrorBarPolicy<AErrorBarPolicyConfigurable>
,IPointPainter<AErrorBarPolicyConfigurable>
,ITracePainter<AErrorBarPolicyConfigurable>
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.lang.Comparable<AErrorBarPolicyConfigurable>
,java.util.EventListener
- Direct Known Subclasses:
ErrorBarPolicyAbsoluteSummation
,ErrorBarPolicyRelative
public abstract class AErrorBarPolicyConfigurable extends java.lang.Object implements IErrorBarPolicy<AErrorBarPolicyConfigurable>, java.beans.PropertyChangeListener
A
base implementation that is configurable by the means of showing positive/negative errors in x/y dimension.IErrorBarPolicy
Implementations have to implement the methods
internalGetNegativeXError(int, int, ITracePoint2D)
internalGetNegativeYError(int, int, ITracePoint2D)
internalGetPositiveXError(int, int, ITracePoint2D)
internalGetPositiveYError(int, int, ITracePoint2D)
Please see the class description of
IErrorBarPixel
for details.- Version:
- $Revision: 1.41 $
- Author:
- Achim Westermann
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ITracePoint2D
m_lastPoint
The last trace point coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D)
.protected int
m_lastX
The last x coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D)
.protected int
m_lastY
The last y coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D)
.protected java.beans.PropertyChangeSupport
m_propertyChangeSupport
The instance that add support for firingPropertyChangeEvents
and maintainingPropertyChangeListeners
.-
Fields inherited from interface info.monitorenter.gui.chart.IErrorBarPolicy
PROPERTY_CONFIGURATION, PROPERTY_ERRORBARPAINTER
-
-
Constructor Summary
Constructors Constructor Description AErrorBarPolicyConfigurable()
Defcon.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addErrorBarPainter(IErrorBarPainter painter)
Adds the given error bar painter to the list of painters of this instance.void
addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Adds a property change listener.void
calculateErrorBar(int xPixel, int yPixel, ErrorBarPixel errorBar, ITracePoint2D original)
Calculates the errors of the given errorbar according to the point to render and the configuration of this instance.int
compareTo(AErrorBarPolicyConfigurable o)
void
discontinue(java.awt.Graphics g2d)
Invoked to inform the painter that a discontinue in the trace to # paint has occured.void
endPaintIteration(java.awt.Graphics g2d)
Invoked to inform implementations that a paint iteration ends for the correspondingITrace2D
.boolean
equals(java.lang.Object obj)
protected void
firePropertyChange(java.lang.String property, java.lang.Object oldvalue, java.lang.Object newvalue)
Fires a property change event to the registered listeners.javax.swing.JComponent
getCustomConfigurator()
Allows an implementation to return aJComponent
that takes care of custom configuration properties for the UI support of error bar policies.java.util.Set<IErrorBarPainter>
getErrorBarPainters()
Returns the set ofIErrorBarPainter
to use.protected ITrace2D
getTrace()
Returns the trace error bars have to be rendered for.int
hashCode()
protected abstract int
internalGetNegativeXError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the negative x error for the given point as a pixel value (not relative to the the origin value).protected abstract int
internalGetNegativeYError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the negative y error for the given point as a pixel value (not relative to the the origin value).protected abstract int
internalGetPositiveXError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the positive x error in pixel for the given point as an absolute value (not relative to the the origin value).protected abstract int
internalGetPositiveYError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the positive y error in pixel for the given point as an absolute value (not relative to the the origin value).boolean
isShowNegativeXErrors()
Returns true if negative errors in x dimension are shown.boolean
isShowNegativeYErrors()
Returns true if negative errors in y dimension are shown.boolean
isShowPositiveXErrors()
Returns true if positive errors in x dimension are shown.boolean
isShowPositiveYErrors()
Returns true if positive errors in y dimension are shown.void
paintPoint(int absoluteX, int absoluteY, int nextX, int nextY, java.awt.Graphics g, ITracePoint2D original)
Paint the point given by absolute coordinates on the given graphic context.void
propertyChange(java.beans.PropertyChangeEvent evt)
Just turns the property change event of subsequent configuration (like
toIErrorBarPainter.PROPERTY_CONNECTION
IErrorBarPolicy.PROPERTY_CONFIGURATION
added withPropertyChangeListener
addPropertyChangeListener(String, PropertyChangeListener)
boolean
removeErrorBarPainter(IErrorBarPainter painter)
Removes the given error bar painter.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deregisters a property change listener that has been registerd for listening on all properties.void
removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Removes a property change listener for listening on the given property.void
setErrorBarPainter(IErrorBarPainter painter)
Makes the given error bar painter the sole painter for error bars of this instance.void
setShowNegativeXErrors(boolean showNegativeXErrors)
Set whether negative errors in x dimension should be shown.void
setShowNegativeYErrors(boolean showNegativeYErrors)
Set whether negative errors in y dimension should be shown.void
setShowPositiveXErrors(boolean showPositiveXErrors)
Set whether positive errors in x dimension should be shown.void
setShowPositiveYErrors(boolean showPositiveYErrors)
Set whether positive errors in y dimension should be shown.void
setTrace(ITrace2D trace)
Intended forATrace2D
only that will register itself to the instances added to it.void
startPaintIteration(java.awt.Graphics g2d)
Invoked to inform implementations that a paint iteration starts for the correspondingITrace2D
.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface info.monitorenter.gui.chart.IErrorBarPolicy
getXError, getYError
-
-
-
-
Field Detail
-
m_lastPoint
protected ITracePoint2D m_lastPoint
The last trace point coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D)
.It will be needed at
endPaintIteration(Graphics)
as the former method only uses the first set of coordinates to store in the internal list to avoid duplicates.
-
m_lastX
protected int m_lastX
The last x coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D)
.It will be needed at
endPaintIteration(Graphics)
as the former method only uses the first set of coordinates to store in the internal list to avoid duplicates.
-
m_lastY
protected int m_lastY
The last y coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D)
.It will be needed at
endPaintIteration(Graphics)
as the former method only uses the first set of coordinates to store in the internal list to avoid duplicates.
-
m_propertyChangeSupport
protected java.beans.PropertyChangeSupport m_propertyChangeSupport
The instance that add support for firingPropertyChangeEvents
and maintainingPropertyChangeListeners
.PropertyChangeListener
instances.
-
-
Method Detail
-
addErrorBarPainter
public void addErrorBarPainter(IErrorBarPainter painter)
Description copied from interface:IErrorBarPolicy
Adds the given error bar painter to the list of painters of this instance.- Specified by:
addErrorBarPainter
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
painter
- the painter to use.- See Also:
IErrorBarPolicy.addErrorBarPainter(info.monitorenter.gui.chart.IErrorBarPainter)
-
addPropertyChangeListener
public final void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
Adds a property change listener.- Specified by:
addPropertyChangeListener
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
propertyName
- The name of the property to listen on.listener
- The PropertyChangeListener to be added.- See Also:
ITrace2D.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
calculateErrorBar
public final void calculateErrorBar(int xPixel, int yPixel, ErrorBarPixel errorBar, ITracePoint2D original)
Description copied from interface:IErrorBarPolicy
Calculates the errors of the given errorbar according to the point to render and the configuration of this instance.- Specified by:
calculateErrorBar
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
xPixel
- the x value in pixel to render an error bar for.yPixel
- the y value in pixel to render an error bar for.errorBar
- an error bar to use: This is for design reasons as internally this method is used too with a reused instance.original
- the original point, possibly useful for calculations.- See Also:
IErrorBarPolicy.calculateErrorBar(int, int, info.monitorenter.gui.chart.errorbars.ErrorBarPixel, info.monitorenter.gui.chart.ITracePoint2D)
-
compareTo
public int compareTo(AErrorBarPolicyConfigurable o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<AErrorBarPolicyConfigurable>
- See Also:
Comparable.compareTo(java.lang.Object)
-
discontinue
public void discontinue(java.awt.Graphics g2d)
Description copied from interface:ITracePainter
Invoked to inform the painter that a discontinue in the trace to # paint has occured.This only has to be implemented by painters that collect several points of
IPointPainter.paintPoint(int, int, int, int, Graphics, ITracePoint2D)
to draw them as polygons (e.g.:Graphics.drawPolyline(int[], int[], int)
).- Specified by:
discontinue
in interfaceITracePainter<AErrorBarPolicyConfigurable>
- Parameters:
g2d
- provided in case pending paint operations have to be performed.- See Also:
ITracePainter.discontinue(java.awt.Graphics)
-
endPaintIteration
public void endPaintIteration(java.awt.Graphics g2d)
Description copied from interface:IPointPainter
Invoked to inform implementations that a paint iteration ends for the correspondingITrace2D
.- Specified by:
endPaintIteration
in interfaceIPointPainter<AErrorBarPolicyConfigurable>
- Parameters:
g2d
- provided in case pending paint operations have to be performed.- See Also:
IPointPainter.endPaintIteration(java.awt.Graphics)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
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_XXX
constants defined inITrace2D
oldvalue
- the old value of the property.newvalue
- the new value of the property.
-
getCustomConfigurator
public javax.swing.JComponent getCustomConfigurator()
Description copied from interface:IErrorBarPolicy
Allows an implementation to return aJComponent
that takes care of custom configuration properties for the UI support of error bar policies.Returns a
JComponent
that - stand alone - takes care of configuring custom properties or null if nothing is required. This will be integrated in the error bar wizard UI of jchart2d.- Specified by:
getCustomConfigurator
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Returns:
- a
JComponent
that - stand alone - takes care of configuring custom properties or null if nothing is required. - See Also:
IErrorBarPolicy.getCustomConfigurator()
-
getErrorBarPainters
public java.util.Set<IErrorBarPainter> getErrorBarPainters()
Description copied from interface:IErrorBarPolicy
Returns the set ofIErrorBarPainter
to use.- Specified by:
getErrorBarPainters
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Returns:
- the set of
IErrorBarPainter
to use. - See Also:
IErrorBarPolicy.getErrorBarPainters()
-
getTrace
protected final ITrace2D getTrace()
Returns the trace error bars have to be rendered for.- Returns:
- the trace for rendering error bars.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
internalGetNegativeXError
protected abstract int internalGetNegativeXError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the negative x error for the given point as a pixel value (not relative to the the origin value).- Parameters:
xPixel
- the x value in pixel for the error to render.yPixel
- the y value in pixel for the error to render.original
- the original point, possibly useful for calculations.- Returns:
- the negative x error in pixel for the given point as an absolute value (not relative to the the origin value).
-
internalGetNegativeYError
protected abstract int internalGetNegativeYError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the negative y error for the given point as a pixel value (not relative to the the origin value).- Parameters:
xPixel
- the x value in pixel for the error to render.yPixel
- the y value in pixel for the error to render.original
- the original point, possibly useful for calculations.- Returns:
- the negative y error in pixel for the given point as an absolute value (not relative to the the origin value).
-
internalGetPositiveXError
protected abstract int internalGetPositiveXError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the positive x error in pixel for the given point as an absolute value (not relative to the the origin value).- Parameters:
xPixel
- the x value in pixel for the error to render.yPixel
- the y value in pixel for the error to render.original
- the original point, possibly useful for calculations.- Returns:
- the positive x error in pixel for the given point as an absolute value (not relative to the the origin value).
-
internalGetPositiveYError
protected abstract int internalGetPositiveYError(int xPixel, int yPixel, ITracePoint2D original)
Internally compute the positive y error in pixel for the given point as an absolute value (not relative to the the origin value).- Parameters:
xPixel
- the x coordinate in pixel for the error to render.yPixel
- the y coordinate in pixel for the error to render.original
- the original point, possibly useful for calculations.- Returns:
- the positive y error in pixel for the given point as an absolute value (not relative to the the origin value).
-
isShowNegativeXErrors
public final boolean isShowNegativeXErrors()
Description copied from interface:IErrorBarPolicy
Returns true if negative errors in x dimension are shown.- Specified by:
isShowNegativeXErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Returns:
- true if negative errors in x dimension are shown.
- See Also:
IErrorBarPolicy.isShowNegativeXErrors()
-
isShowNegativeYErrors
public final boolean isShowNegativeYErrors()
Description copied from interface:IErrorBarPolicy
Returns true if negative errors in y dimension are shown.- Specified by:
isShowNegativeYErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Returns:
- true if negative errors in y dimension are shown.
- See Also:
IErrorBarPolicy.isShowNegativeYErrors()
-
isShowPositiveXErrors
public final boolean isShowPositiveXErrors()
Description copied from interface:IErrorBarPolicy
Returns true if positive errors in x dimension are shown.- Specified by:
isShowPositiveXErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Returns:
- true if positive errors in x dimension are shown.
- See Also:
IErrorBarPolicy.isShowPositiveXErrors()
-
isShowPositiveYErrors
public final boolean isShowPositiveYErrors()
Description copied from interface:IErrorBarPolicy
Returns true if positive errors in y dimension are shown.- Specified by:
isShowPositiveYErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Returns:
- true if positive errors in y dimension are shown.
- See Also:
IErrorBarPolicy.isShowPositiveYErrors()
-
paintPoint
public void paintPoint(int absoluteX, int absoluteY, int nextX, int nextY, java.awt.Graphics g, ITracePoint2D original)
Description copied from interface:IPointPainter
Paint the point given by absolute coordinates on the given graphic context.The next coordinates are also provided to allow to check how much distance is available for the graphic representation of the current point.
- Specified by:
paintPoint
in interfaceIPointPainter<AErrorBarPolicyConfigurable>
- Parameters:
absoluteX
- the ready to use x value for the point to paint.absoluteY
- the ready to use y value for the point to paint.nextX
- the ready to use next x value for the point to paint.nextY
- the ready to use next y value for the point to paint.g
- the graphic context to paint on.original
- just for information, for painting this should be irrelevant and it should not be changed too!- See Also:
IPointPainter.paintPoint(int, int, int, int, java.awt.Graphics, info.monitorenter.gui.chart.ITracePoint2D)
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
Just turns the property change event of subsequent configuration (like
toIErrorBarPainter.PROPERTY_CONNECTION
IErrorBarPolicy.PROPERTY_CONFIGURATION
added withPropertyChangeListener
addPropertyChangeListener(String, PropertyChangeListener)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
- See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
-
removeErrorBarPainter
public boolean removeErrorBarPainter(IErrorBarPainter painter)
Description copied from interface:IErrorBarPolicy
Removes the given error bar painter.- Specified by:
removeErrorBarPainter
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
painter
- the error bar painter to remove.- Returns:
- true if the given error bar painter was removed, comparison by the means of the equals operation.
- See Also:
IErrorBarPolicy.removeErrorBarPainter(info.monitorenter.gui.chart.IErrorBarPainter)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:IErrorBarPolicy
Deregisters a property change listener that has been registerd for listening on all properties.- Specified by:
removePropertyChangeListener
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
listener
- a listener that will only be informed if the property identified by the argumentpropertyName
changes- See Also:
IErrorBarPolicy.removePropertyChangeListener(java.beans.PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
Description copied from interface:IErrorBarPolicy
Removes a property change listener for listening on the given property.- Specified by:
removePropertyChangeListener
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
property
- one of the constants with tehPROPERTY_
prefix defined in this class or subclasses.listener
- the listener for this property change.- See Also:
IErrorBarPolicy.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
setErrorBarPainter
public void setErrorBarPainter(IErrorBarPainter painter)
Description copied from interface:IErrorBarPolicy
Makes the given error bar painter the sole painter for error bars of this instance.- Specified by:
setErrorBarPainter
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
painter
- the painter to use.- See Also:
IErrorBarPolicy.setErrorBarPainter(info.monitorenter.gui.chart.IErrorBarPainter)
-
setShowNegativeXErrors
public final void setShowNegativeXErrors(boolean showNegativeXErrors)
Description copied from interface:IErrorBarPolicy
Set whether negative errors in x dimension should be shown.- Specified by:
setShowNegativeXErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
showNegativeXErrors
- if true negative errors in x dimension will be shown.- See Also:
IErrorBarPolicy.setShowNegativeXErrors(boolean)
-
setShowNegativeYErrors
public final void setShowNegativeYErrors(boolean showNegativeYErrors)
Description copied from interface:IErrorBarPolicy
Set whether negative errors in y dimension should be shown.- Specified by:
setShowNegativeYErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
showNegativeYErrors
- if true negative errors in y dimension will be shown.- See Also:
IErrorBarPolicy.setShowNegativeYErrors(boolean)
-
setShowPositiveXErrors
public final void setShowPositiveXErrors(boolean showPositiveXErrors)
Description copied from interface:IErrorBarPolicy
Set whether positive errors in x dimension should be shown.- Specified by:
setShowPositiveXErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
showPositiveXErrors
- if true positive errors in x dimension will be shown.- See Also:
IErrorBarPolicy.setShowPositiveXErrors(boolean)
-
setShowPositiveYErrors
public final void setShowPositiveYErrors(boolean showPositiveYErrors)
Description copied from interface:IErrorBarPolicy
Set whether positive errors in y dimension should be shown.- Specified by:
setShowPositiveYErrors
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
showPositiveYErrors
- if true positive errors in y dimension will be shown.- See Also:
IErrorBarPolicy.setShowPositiveYErrors(boolean)
-
setTrace
public void setTrace(ITrace2D trace)
Intended forATrace2D
only that will register itself to the instances added to it.This is support for error bar policies that need information about the whole trace (e.g. median value). It has nothing to do with the kind of error bar policy to be used by a trace. See
ITrace2D.setErrorBarPolicy(IErrorBarPolicy)
andITrace2D.addErrorBarPolicy(IErrorBarPolicy)
for this feature instead.- Specified by:
setTrace
in interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>
- Parameters:
trace
- the trace error bars are rendered for.
-
startPaintIteration
public void startPaintIteration(java.awt.Graphics g2d)
Description copied from interface:IPointPainter
Invoked to inform implementations that a paint iteration starts for the correspondingITrace2D
.- Specified by:
startPaintIteration
in interfaceIPointPainter<AErrorBarPolicyConfigurable>
- Parameters:
g2d
- provided in case pending paint operations have to be performed.- See Also:
IPointPainter.startPaintIteration(java.awt.Graphics)
-
-