Class ErrorBarPainter
- java.lang.Object
-
- info.monitorenter.gui.chart.errorbars.ErrorBarPainter
-
- All Implemented Interfaces:
IErrorBarPainter,java.io.Serializable
- Direct Known Subclasses:
ErrorBarPainterLine
public class ErrorBarPainter extends java.lang.Object implements IErrorBarPainter
Implementation of an error bar painter that allows configuration of the way the connection, start point and end point of an error bar is painted by the use ofIPointPainter.Property change events are fired as described in method
. Note that adding property change listeners to the nested access facades of typeIErrorBarPainter.addPropertyChangeListener(String, PropertyChangeListener)accessible viaIErrorBarPainter.ISegmentgetXXXSegment()methods will fire the corresponding events for listeners of this instance (as they delegate the calls) while they fire events for properties defined intoo. If you register for events of this instance and for the retrieved segments you will receive twoIErrorBarPainter.ISegmentfor the same value changed.PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)- Version:
- $Revision: 1.27 $
- Author:
- Achim Westermann
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface info.monitorenter.gui.chart.IErrorBarPainter
IErrorBarPainter.ISegment
-
-
Field Summary
Fields Modifier and Type Field Description static java.awt.ColorDEFAULT_SEGMENT_COLORDefault color for all segments in case theirhas not been configured with a color.IPointPainterConfigurableUIprotected java.beans.PropertyChangeSupportm_propertyChangeSupportThe instance that add support for firingPropertyChangeEventsand maintainingPropertyChangeListeners.-
Fields inherited from interface info.monitorenter.gui.chart.IErrorBarPainter
PROPERTY_CONNECTION, PROPERTY_CONNECTION_COLOR, PROPERTY_ENDPOINT, PROPERTY_ENDPOINT_COLOR, PROPERTY_STARTPOINT, PROPERTY_STARTPOINT_COLOR
-
-
Constructor Summary
Constructors Constructor Description ErrorBarPainter()Creates an instance that by default will not render any error bar.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.booleanequals(java.lang.Object obj)java.awt.ColorgetConnectionColor()Returns the color of the connection segment or null if unconfigured.IPointPainterConfigurableUI<?>getConnectionPainter()Returns the painter for the connection segment of the error bar.java.awt.ColorgetEndPointColor()Returns the color of the end point or null if unconfigured.IPointPainterConfigurableUI<?>getEndPointPainter()Returns the painter for the end point of the error bar.java.beans.PropertyChangeListener[]getPropertyChangeListeners(java.lang.String property)Returns all property change listeners for the given property.IErrorBarPainter.ISegmentgetSegmentConnection()Returns the facade instance for accessing the connection segment of this configurable error bar painter.IErrorBarPainter.ISegmentgetSegmentEnd()Returns the facade instance for accessing the end segment of this configurable error bar painter.IErrorBarPainter.ISegmentgetSegmentStart()Returns the facade instance for accessing the start segment of this configurable error bar painter.java.awt.ColorgetStartPointColor()Returns the color of the start point or null if unconfigured.IPointPainterConfigurableUI<?>getStartPointPainter()Returns the painter for the start point of the error bar.inthashCode()voidpaintErrorBar(int absoluteX, int absoluteY, ITracePoint2D original, java.awt.Graphics g, IErrorBarPixel errorBar)Paint the error bar for the point given by absolute coordinates on the given graphic context.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.voidsetConnectionColor(java.awt.Color connectionColor)Sets the color for the connection segment.voidsetConnectionPainter(IPointPainterConfigurableUI<?> connectionPainter)Note that the choice for the right point painter has to be taken with care: It is senseless to use an implementation that does not interconnect both coordinates given toIPointPainter.paintPoint(int, int, int, int, Graphics, ITracePoint2D).voidsetEndPointColor(java.awt.Color endPointColor)Sets the color for the end point.voidsetEndPointPainter(IPointPainterConfigurableUI<?> endPointPainter)Sets the painter for the end point of the error bar.voidsetStartPointColor(java.awt.Color startPointColor)Sets the color for the start point.voidsetStartPointPainter(IPointPainterConfigurableUI<?> startPointPainter)Note that the choice for the right point painter has to be taken with care: It is senseless to use an implementation that interconnects both coordinates given toIPointPainter.paintPoint(int, int, int, int, Graphics, ITracePoint2D).
-
-
-
Field Detail
-
m_propertyChangeSupport
protected java.beans.PropertyChangeSupport m_propertyChangeSupport
The instance that add support for firingPropertyChangeEventsand maintainingPropertyChangeListeners.
-
DEFAULT_SEGMENT_COLOR
public static final java.awt.Color DEFAULT_SEGMENT_COLOR
Default color for all segments in case theirhas not been configured with a color.IPointPainterConfigurableUI
-
-
Method Detail
-
addPropertyChangeListener
public final void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:IErrorBarPainterRegisters a property change listener that will be informed about changes of the property identified by the givenpropertyName.PropertyChangeEvents
PropertyChangeListenerinstances may be added viaContainer.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener). They inherit the properties to listen fromContainer.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener). Additionally morePropertyChangeEventsshould be triggered (contract for implementation!).Property Change events
The followingPropertyChangeEventinstances will be fired to registeredPropertyChangeListenerinstances.getPropertyName()getSource()getOldValue()getNewValue()comment IErrorBarPainter.PROPERTY_ENDPOINTthat changed.IErrorBarPainter.IPointPainter.IPointPainterNote that null as the old value indicates a new painter. Null as the new value is valid and means that the end point rendering is turned off. IErrorBarPainter.PROPERTY_STARTPOINTthat changed.IErrorBarPainter.IPointPainter.IPointPainterNote that null as the old value indicates a new painter. Null as the new value is valid and means that the start point rendering is turned off. IErrorBarPainter.PROPERTY_CONNECTIONthat changed.IErrorBarPainter.IPointPainter.IPointPainterNote that null as the old value indicates a new painter. Null as the new value is valid and means that the connection segment point rendering is turned off. IErrorBarPainter.PROPERTY_ENDPOINT_COLORthat changed.IErrorBarPainter.Color.ColorNote that null as the old value indicates a new color different from the default. Null as the new value is valid and means that the end point color is switched to default. IErrorBarPainter.PROPERTY_STARTPOINT_COLORthat changed.IErrorBarPainter.Color.ColorNote that null as the old value indicates a new color different from the default. Null as the new value is valid and means that the start point color is switched to default. IErrorBarPainter.PROPERTY_CONNECTION_COLORthat changed.IErrorBarPainter.Color.ColorNote that null as the old value indicates a new color different from the default. Null as the new value is valid and means that the connection segment color is switched to default. - Specified by:
addPropertyChangeListenerin interfaceIErrorBarPainter- 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:
IErrorBarPainter.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
getConnectionColor
public final java.awt.Color getConnectionColor()
Description copied from interface:IErrorBarPainterReturns the color of the connection segment or null if unconfigured.- Specified by:
getConnectionColorin interfaceIErrorBarPainter- Returns:
- the color of the connection segment or null if unconfigured.
- See Also:
IErrorBarPainter.getConnectionColor()
-
getConnectionPainter
public final IPointPainterConfigurableUI<?> getConnectionPainter()
Description copied from interface:IErrorBarPainterReturns the painter for the connection segment of the error bar.- Specified by:
getConnectionPainterin interfaceIErrorBarPainter- Returns:
- The painter for the connection segment of the error bar.
- See Also:
IErrorBarPainter.getConnectionPainter()
-
getEndPointColor
public final java.awt.Color getEndPointColor()
Description copied from interface:IErrorBarPainterReturns the color of the end point or null if unconfigured.- Specified by:
getEndPointColorin interfaceIErrorBarPainter- Returns:
- the color of the end point or null if unconfigured.
- See Also:
IErrorBarPainter.getEndPointColor()
-
getEndPointPainter
public final IPointPainterConfigurableUI<?> getEndPointPainter()
Description copied from interface:IErrorBarPainterReturns the painter for the end point of the error bar.- Specified by:
getEndPointPainterin interfaceIErrorBarPainter- Returns:
- The painter for the end point of the error bar.
- See Also:
IErrorBarPainter.getEndPointPainter()
-
getPropertyChangeListeners
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String property)
Description copied from interface:IErrorBarPainterReturns all property change listeners for the given property.- Specified by:
getPropertyChangeListenersin interfaceIErrorBarPainter- 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:
IErrorBarPainter.getPropertyChangeListeners(java.lang.String)
-
getSegmentConnection
public IErrorBarPainter.ISegment getSegmentConnection()
Description copied from interface:IErrorBarPainterReturns the facade instance for accessing the connection segment of this configurable error bar painter.- Specified by:
getSegmentConnectionin interfaceIErrorBarPainter- Returns:
- the facade instance for accessing the connection segment of this configurable error bar painter.
- See Also:
IErrorBarPainter.getSegmentConnection()
-
getSegmentEnd
public IErrorBarPainter.ISegment getSegmentEnd()
Description copied from interface:IErrorBarPainterReturns the facade instance for accessing the end segment of this configurable error bar painter.- Specified by:
getSegmentEndin interfaceIErrorBarPainter- Returns:
- the facade instance for accessing the end segment of this configurable error bar painter.
- See Also:
IErrorBarPainter.getSegmentEnd()
-
getSegmentStart
public IErrorBarPainter.ISegment getSegmentStart()
Description copied from interface:IErrorBarPainterReturns the facade instance for accessing the start segment of this configurable error bar painter.- Specified by:
getSegmentStartin interfaceIErrorBarPainter- Returns:
- the facade instance for accessing the start segment of this configurable error bar painter.
- See Also:
IErrorBarPainter.getSegmentStart()
-
getStartPointColor
public final java.awt.Color getStartPointColor()
Description copied from interface:IErrorBarPainterReturns the color of the start point or null if unconfigured.- Specified by:
getStartPointColorin interfaceIErrorBarPainter- Returns:
- the color of the start point or null if unconfigured.
- See Also:
IErrorBarPainter.getStartPointColor()
-
getStartPointPainter
public final IPointPainterConfigurableUI<?> getStartPointPainter()
Description copied from interface:IErrorBarPainterReturns the painter for the start point of the error bar.- Specified by:
getStartPointPainterin interfaceIErrorBarPainter- Returns:
- the painter for the start point of the error bar.
- See Also:
IErrorBarPainter.getStartPointPainter()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
paintErrorBar
public void paintErrorBar(int absoluteX, int absoluteY, ITracePoint2D original, java.awt.Graphics g, IErrorBarPixel errorBar)Description copied from interface:IErrorBarPainterPaint the error bar for the point given by absolute coordinates on the given graphic context.Basic implementations should modularize further and allow configuration for the way of painting the connection segments, the start point (origin) and end point of the error bar with implementations of
IPointPainter.- Specified by:
paintErrorBarin interfaceIErrorBarPainter- 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.original- the original trace point this error bar is painted for.g- the graphic context to paint on.errorBar- contains the data for the errors to render.- See Also:
IErrorBarPainter.paintErrorBar(int, int, ITracePoint2D, Graphics, IErrorBarPixel)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:IErrorBarPainterUnregisters a property change listener that has been registered for listening on all properties.- Specified by:
removePropertyChangeListenerin interfaceIErrorBarPainter- Parameters:
listener- a listener that will only be informed if the property identified by the argumentpropertyNamechanges- See Also:
IErrorBarPainter.removePropertyChangeListener(java.beans.PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)Description copied from interface:IErrorBarPainterRemoves a property change listener for listening on the given property.- Specified by:
removePropertyChangeListenerin interfaceIErrorBarPainter- Parameters:
property- one of the constants with tehPROPERTY_prefix defined in this class or subclasses.listener- the listener for this property change.- See Also:
IErrorBarPainter.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
setConnectionColor
public final void setConnectionColor(java.awt.Color connectionColor)
Description copied from interface:IErrorBarPainterSets the color for the connection segment.If this is not used or null is provided, the color of the corresponding trace will be used. If no underlying connection painter exists nothing will be done.
- Specified by:
setConnectionColorin interfaceIErrorBarPainter- Parameters:
connectionColor- The connection segment color to set.- See Also:
IErrorBarPainter.setConnectionColor(java.awt.Color)
-
setConnectionPainter
public final void setConnectionPainter(IPointPainterConfigurableUI<?> connectionPainter)
Description copied from interface:IErrorBarPainterNote that the choice for the right point painter has to be taken with care: It is senseless to use an implementation that does not interconnect both coordinates given toIPointPainter.paintPoint(int, int, int, int, Graphics, ITracePoint2D).Choosing a
PointPainterLinewill have the same visual effect as setting such an instance for the start point painter.Currently the only useful choice is the
PointPainterLineor null (to make the connection segment invisible). But the interface is open enough to use implementations that would paint interpolated dots, discs, squares,... whatever you think of (contribute!).- Specified by:
setConnectionPainterin interfaceIErrorBarPainter- Parameters:
connectionPainter- The connection segmentPainter to set.- See Also:
IErrorBarPainter.setConnectionPainter(info.monitorenter.gui.chart.IPointPainterConfigurableUI)
-
setEndPointColor
public final void setEndPointColor(java.awt.Color endPointColor)
Description copied from interface:IErrorBarPainterSets the color for the end point.If this is not used or null is provided, the color of the corresponding trace will be used. If no underlying end point painter exists nothing will be done.
- Specified by:
setEndPointColorin interfaceIErrorBarPainter- Parameters:
endPointColor- The end point color to set.- See Also:
IErrorBarPainter.setEndPointColor(java.awt.Color)
-
setEndPointPainter
public final void setEndPointPainter(IPointPainterConfigurableUI<?> endPointPainter)
Description copied from interface:IErrorBarPainterSets the painter for the end point of the error bar.Note that the choice for the right point painter has to be taken with care: It is senseless to use an implementation that interconnects both coordinates given to
IPointPainter.paintPoint(int, int, int, int, Graphics, ITracePoint2D).Choosing a
PointPainterLinewill have the same visual effect as setting such an instance for the connection segment painter.- Specified by:
setEndPointPainterin interfaceIErrorBarPainter- Parameters:
endPointPainter- The end point painter to set.- See Also:
IErrorBarPainter.setEndPointPainter(info.monitorenter.gui.chart.IPointPainterConfigurableUI)
-
setStartPointColor
public final void setStartPointColor(java.awt.Color startPointColor)
Description copied from interface:IErrorBarPainterSets the color for the start point.If this is not used or null is provided, the color of the corresponding trace will be used. If no underlying start point painter exists nothing will be done.
- Specified by:
setStartPointColorin interfaceIErrorBarPainter- Parameters:
startPointColor- The start point color to set.- See Also:
IErrorBarPainter.setStartPointColor(java.awt.Color)
-
setStartPointPainter
public final void setStartPointPainter(IPointPainterConfigurableUI<?> startPointPainter)
Description copied from interface:IErrorBarPainterNote that the choice for the right point painter has to be taken with care: It is senseless to use an implementation that interconnects both coordinates given toIPointPainter.paintPoint(int, int, int, int, Graphics, ITracePoint2D).Choosing a
PointPainterLinewill have the same visual effect as setting such an instance for the connection segment painter.- Specified by:
setStartPointPainterin interfaceIErrorBarPainter- Parameters:
startPointPainter- The startPointPainter to set.- See Also:
IErrorBarPainter.setStartPointPainter(IPointPainterConfigurableUI)
-
-