info.monitorenter.gui.chart.traces.painters
Class ATracePainter

java.lang.Object
  extended by info.monitorenter.gui.chart.traces.painters.ATracePainter
All Implemented Interfaces:
IPointPainter, ITracePainter, Serializable, Comparable
Direct Known Subclasses:
TracePainterDisc, TracePainterFill, TracePainterLine, TracePainterPolyline, TracePainterVerticalBar

public abstract class ATracePainter
extends Object
implements ITracePainter

A trace painter that adds the service of knowing the previous point that had to be painted.

Version:
$Revision: 1.11 $
Author:
Achim Westermann
See Also:
Serialized Form

Constructor Summary
ATracePainter()
           
 
Method Summary
 int compareTo(Object o)
           
 void discontinue(Graphics2D g2d, ITrace2D trace)
          Invoked to inform the painter that a discontinue in the trace to # paint has occured.
 void endPaintIteration(Graphics2D g2d)
          Invoked to inform implementations that a paint iteration ends for the corresponding ITrace2D.
 boolean equals(Object obj)
          Two instances are judged equal if they are of the same class.
protected  TracePoint2D getPreviousPoint()
          Returns the previous trace point that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).
 int getPreviousX()
          Returns the previous X value that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).
 int getPreviousY()
          Returns the previous Y value that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).
 int hashCode()
           
 void paintPoint(int absoluteX, int absoluteY, int nextX, int nextY, Graphics2D g, TracePoint2D original)
          Paint the point given by absolute coordinates on the given graphic context.
 void startPaintIteration(Graphics2D g2d, ITrace2D trace)
          Invoked to inform implementations that a paint iteration starts for the corresponding ITrace2D.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ATracePainter

public ATracePainter()
Method Detail

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
See Also:
Comparable.compareTo(java.lang.Object)

discontinue

public void discontinue(Graphics2D g2d,
                        ITrace2D trace)
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, Graphics2D, TracePoint2D) to draw them as polygons (e.g.: Graphics.drawPolyline(int[], int[], int)).

Specified by:
discontinue in interface ITracePainter
Parameters:
g2d - provided in case pending paint operations have to be performed.
trace - the trace to discontinue painting of.
See Also:
ITracePainter.discontinue(java.awt.Graphics2D, info.monitorenter.gui.chart.ITrace2D)

endPaintIteration

public void endPaintIteration(Graphics2D g2d)
Description copied from interface: ITracePainter
Invoked to inform implementations that a paint iteration ends for the corresponding ITrace2D.

Specified by:
endPaintIteration in interface ITracePainter
Parameters:
g2d - provided in case pending paint operations have to be performed.
See Also:
ITracePainter.endPaintIteration(java.awt.Graphics2D)

equals

public boolean equals(Object obj)
Two instances are judged equal if they are of the same class.

This implies that any state of a ATracePainter is unimportant - implementations that have a state (e.g. the radius for discs to paint in TracePainterDisc) this method should be considered to be overrriden (along with hashCode().

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getPreviousX

public int getPreviousX()
Returns the previous X value that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).

This value will be Integer.MIN_VALUE if no previous point had to be painted.

Returns:
the previous X value that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).

getPreviousY

public int getPreviousY()
Returns the previous Y value that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).

This value will be Integer.MIN_VALUE if no previous point had to be painted.

Returns:
the previous Y value that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

paintPoint

public void paintPoint(int absoluteX,
                       int absoluteY,
                       int nextX,
                       int nextY,
                       Graphics2D g,
                       TracePoint2D 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.

Note that by contract the TracePoint2D argument is only guaranteed to be non-null in case the instance is used as a painter for ITracePainter subtypes. If you plan to use your implementation also for a subcomponent of an IErrorBarPainter (e.g. IErrorBarPainter.setConnectionPainter(IPointPainter)) then you have to implement "null - safe" for that argument.

Specified by:
paintPoint in interface IPointPainter
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.Graphics2D, info.monitorenter.gui.chart.TracePoint2D)

startPaintIteration

public void startPaintIteration(Graphics2D g2d,
                                ITrace2D trace)
Description copied from interface: ITracePainter
Invoked to inform implementations that a paint iteration starts for the corresponding ITrace2D.

Specified by:
startPaintIteration in interface ITracePainter
Parameters:
g2d - provided in case pending paint operations have to be performed.
trace - the TracePoint2D to paint in this iteration.
See Also:
ITracePainter.startPaintIteration(java.awt.Graphics2D, info.monitorenter.gui.chart.ITrace2D)

getPreviousPoint

protected TracePoint2D getPreviousPoint()
Returns the previous trace point that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).

This value will be null if no previous point had to be painted.

Returns:
the previous trace point that had to be painted by paintPoint(int, int, int, int, Graphics2D, TracePoint2D).


Copyright © 2001 - 2007 LGPL, All Rights Footloose.