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
Abase implementation that is configurable by the means of showing positive/negative errors in x/y dimension.IErrorBarPolicyImplementations 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
IErrorBarPixelfor details.- Version:
- $Revision: 1.41 $
- Author:
- Achim Westermann
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ITracePoint2Dm_lastPointThe last trace point coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D).protected intm_lastXThe last x coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D).protected intm_lastYThe last y coordinate that was sent topaintPoint(int, int, int, int, Graphics, ITracePoint2D).protected java.beans.PropertyChangeSupportm_propertyChangeSupportThe instance that add support for firingPropertyChangeEventsand 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 voidaddErrorBarPainter(IErrorBarPainter painter)Adds the given error bar painter to the list of painters of this instance.voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Adds a property change listener.voidcalculateErrorBar(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.intcompareTo(AErrorBarPolicyConfigurable o)voiddiscontinue(java.awt.Graphics g2d)Invoked to inform the painter that a discontinue in the trace to # paint has occured.voidendPaintIteration(java.awt.Graphics g2d)Invoked to inform implementations that a paint iteration ends for the correspondingITrace2D.booleanequals(java.lang.Object obj)protected voidfirePropertyChange(java.lang.String property, java.lang.Object oldvalue, java.lang.Object newvalue)Fires a property change event to the registered listeners.javax.swing.JComponentgetCustomConfigurator()Allows an implementation to return aJComponentthat takes care of custom configuration properties for the UI support of error bar policies.java.util.Set<IErrorBarPainter>getErrorBarPainters()Returns the set ofIErrorBarPainterto use.protected ITrace2DgetTrace()Returns the trace error bars have to be rendered for.inthashCode()protected abstract intinternalGetNegativeXError(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 intinternalGetNegativeYError(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 intinternalGetPositiveXError(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 intinternalGetPositiveYError(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).booleanisShowNegativeXErrors()Returns true if negative errors in x dimension are shown.booleanisShowNegativeYErrors()Returns true if negative errors in y dimension are shown.booleanisShowPositiveXErrors()Returns true if positive errors in x dimension are shown.booleanisShowPositiveYErrors()Returns true if positive errors in y dimension are shown.voidpaintPoint(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.voidpropertyChange(java.beans.PropertyChangeEvent evt)Just turns the property change event of subsequent configuration (liketoIErrorBarPainter.PROPERTY_CONNECTIONand informs outerIErrorBarPolicy.PROPERTY_CONFIGURATIONadded withPropertyChangeListener.addPropertyChangeListener(String, PropertyChangeListener)booleanremoveErrorBarPainter(IErrorBarPainter painter)Removes the given error bar painter.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Deregisters a property change listener that has been registerd 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.voidsetErrorBarPainter(IErrorBarPainter painter)Makes the given error bar painter the sole painter for error bars of this instance.voidsetShowNegativeXErrors(boolean showNegativeXErrors)Set whether negative errors in x dimension should be shown.voidsetShowNegativeYErrors(boolean showNegativeYErrors)Set whether negative errors in y dimension should be shown.voidsetShowPositiveXErrors(boolean showPositiveXErrors)Set whether positive errors in x dimension should be shown.voidsetShowPositiveYErrors(boolean showPositiveYErrors)Set whether positive errors in y dimension should be shown.voidsetTrace(ITrace2D trace)Intended forATrace2Donly that will register itself to the instances added to it.voidstartPaintIteration(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 firingPropertyChangeEventsand maintainingPropertyChangeListeners.PropertyChangeListenerinstances.
-
-
Method Detail
-
addErrorBarPainter
public void addErrorBarPainter(IErrorBarPainter painter)
Description copied from interface:IErrorBarPolicyAdds the given error bar painter to the list of painters of this instance.- Specified by:
addErrorBarPainterin 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:
addPropertyChangeListenerin 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:IErrorBarPolicyCalculates the errors of the given errorbar according to the point to render and the configuration of this instance.- Specified by:
calculateErrorBarin 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:
compareToin interfacejava.lang.Comparable<AErrorBarPolicyConfigurable>- See Also:
Comparable.compareTo(java.lang.Object)
-
discontinue
public void discontinue(java.awt.Graphics g2d)
Description copied from interface:ITracePainterInvoked 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:
discontinuein 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:IPointPainterInvoked to inform implementations that a paint iteration ends for the correspondingITrace2D.- Specified by:
endPaintIterationin 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:
equalsin 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_XXXconstants defined in.ITrace2Doldvalue- the old value of the property.newvalue- the new value of the property.
-
getCustomConfigurator
public javax.swing.JComponent getCustomConfigurator()
Description copied from interface:IErrorBarPolicyAllows an implementation to return aJComponentthat takes care of custom configuration properties for the UI support of error bar policies.Returns a
JComponentthat - 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:
getCustomConfiguratorin interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>- Returns:
- a
JComponentthat - 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:IErrorBarPolicyReturns the set ofIErrorBarPainterto use.- Specified by:
getErrorBarPaintersin interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>- Returns:
- the set of
IErrorBarPainterto 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:
hashCodein 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:IErrorBarPolicyReturns true if negative errors in x dimension are shown.- Specified by:
isShowNegativeXErrorsin 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:IErrorBarPolicyReturns true if negative errors in y dimension are shown.- Specified by:
isShowNegativeYErrorsin 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:IErrorBarPolicyReturns true if positive errors in x dimension are shown.- Specified by:
isShowPositiveXErrorsin 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:IErrorBarPolicyReturns true if positive errors in y dimension are shown.- Specified by:
isShowPositiveYErrorsin 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:IPointPainterPaint 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:
paintPointin 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 (liketoIErrorBarPainter.PROPERTY_CONNECTIONand informs outerIErrorBarPolicy.PROPERTY_CONFIGURATIONadded withPropertyChangeListener.addPropertyChangeListener(String, PropertyChangeListener)- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
-
removeErrorBarPainter
public boolean removeErrorBarPainter(IErrorBarPainter painter)
Description copied from interface:IErrorBarPolicyRemoves the given error bar painter.- Specified by:
removeErrorBarPainterin 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:IErrorBarPolicyDeregisters a property change listener that has been registerd for listening on all properties.- Specified by:
removePropertyChangeListenerin interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>- Parameters:
listener- a listener that will only be informed if the property identified by the argumentpropertyNamechanges- See Also:
IErrorBarPolicy.removePropertyChangeListener(java.beans.PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)Description copied from interface:IErrorBarPolicyRemoves a property change listener for listening on the given property.- Specified by:
removePropertyChangeListenerin 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:IErrorBarPolicyMakes the given error bar painter the sole painter for error bars of this instance.- Specified by:
setErrorBarPainterin 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:IErrorBarPolicySet whether negative errors in x dimension should be shown.- Specified by:
setShowNegativeXErrorsin 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:IErrorBarPolicySet whether negative errors in y dimension should be shown.- Specified by:
setShowNegativeYErrorsin 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:IErrorBarPolicySet whether positive errors in x dimension should be shown.- Specified by:
setShowPositiveXErrorsin 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:IErrorBarPolicySet whether positive errors in y dimension should be shown.- Specified by:
setShowPositiveYErrorsin 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 forATrace2Donly 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:
setTracein interfaceIErrorBarPolicy<AErrorBarPolicyConfigurable>- Parameters:
trace- the trace error bars are rendered for.
-
startPaintIteration
public void startPaintIteration(java.awt.Graphics g2d)
Description copied from interface:IPointPainterInvoked to inform implementations that a paint iteration starts for the correspondingITrace2D.- Specified by:
startPaintIterationin interfaceIPointPainter<AErrorBarPolicyConfigurable>- Parameters:
g2d- provided in case pending paint operations have to be performed.- See Also:
IPointPainter.startPaintIteration(java.awt.Graphics)
-
-