Package org.jfree.chart.plot
Class DefaultDrawingSupplier
java.lang.Object
org.jfree.chart.plot.DefaultDrawingSupplier
- All Implemented Interfaces:
Serializable
,Cloneable
,DrawingSupplier
,PublicCloneable
public class DefaultDrawingSupplier
extends Object
implements DrawingSupplier, Cloneable, PublicCloneable, Serializable
A default implementation of the
DrawingSupplier
interface. All
Plot
instances have a new instance of this class installed by
default.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Paint[]
The default fill paint sequence.static final Paint[]
The default outline paint sequence.static final Stroke[]
The default outline stroke sequence.static final Paint[]
The default fill paint sequence.static final Shape[]
The default shape sequence.static final Stroke[]
The default stroke sequence.private int
The current fill paint index.private Paint[]
The fill paint sequence.private int
The current outline paint index.private Paint[]
The outline paint sequence.private int
The current outline stroke index.private Stroke[]
The outline stroke sequence.private int
The current paint index.private Paint[]
The paint sequence.private static final long
For serialization.private int
The current shape index.private Shape[]
The shape sequence.private int
The current stroke index.private Stroke[]
The stroke sequence. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new supplier, with default sequences for fill paint, outline paint, stroke and shapes.DefaultDrawingSupplier
(Paint[] paintSequence, Paint[] fillPaintSequence, Paint[] outlinePaintSequence, Stroke[] strokeSequence, Stroke[] outlineStrokeSequence, Shape[] shapeSequence) Creates a new supplier.DefaultDrawingSupplier
(Paint[] paintSequence, Paint[] outlinePaintSequence, Stroke[] strokeSequence, Stroke[] outlineStrokeSequence, Shape[] shapeSequence) Creates a new supplier. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone.static Shape[]
Creates an array of standard shapes to display for the items in series on charts.boolean
Tests this object for equality with another object.private boolean
equalShapes
(Shape[] s1, Shape[] s2) A utility method for testing the equality of two arrays of shapes.Returns the next fill paint in the sequence.Returns the next outline paint in the sequence.Returns the next outline stroke in the sequence.Returns the next paint in the sequence.Returns the next shape in the sequence.Returns the next stroke in the sequence.private static int[]
intArray
(double a, double b, double c) Helper method to avoid lots of explicit casts in getShape().private static int[]
intArray
(double a, double b, double c, double d) Helper method to avoid lots of explicit casts in getShape().private void
readObject
(ObjectInputStream stream) Restores a serialized object.private void
writeObject
(ObjectOutputStream stream) Handles serialization.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
DEFAULT_PAINT_SEQUENCE
The default fill paint sequence. -
DEFAULT_OUTLINE_PAINT_SEQUENCE
The default outline paint sequence. -
DEFAULT_FILL_PAINT_SEQUENCE
The default fill paint sequence. -
DEFAULT_STROKE_SEQUENCE
The default stroke sequence. -
DEFAULT_OUTLINE_STROKE_SEQUENCE
The default outline stroke sequence. -
DEFAULT_SHAPE_SEQUENCE
The default shape sequence. -
paintSequence
The paint sequence. -
paintIndex
private int paintIndexThe current paint index. -
outlinePaintSequence
The outline paint sequence. -
outlinePaintIndex
private int outlinePaintIndexThe current outline paint index. -
fillPaintSequence
The fill paint sequence. -
fillPaintIndex
private int fillPaintIndexThe current fill paint index. -
strokeSequence
The stroke sequence. -
strokeIndex
private int strokeIndexThe current stroke index. -
outlineStrokeSequence
The outline stroke sequence. -
outlineStrokeIndex
private int outlineStrokeIndexThe current outline stroke index. -
shapeSequence
The shape sequence. -
shapeIndex
private int shapeIndexThe current shape index.
-
-
Constructor Details
-
DefaultDrawingSupplier
public DefaultDrawingSupplier()Creates a new supplier, with default sequences for fill paint, outline paint, stroke and shapes. -
DefaultDrawingSupplier
public DefaultDrawingSupplier(Paint[] paintSequence, Paint[] outlinePaintSequence, Stroke[] strokeSequence, Stroke[] outlineStrokeSequence, Shape[] shapeSequence) Creates a new supplier.- Parameters:
paintSequence
- the fill paint sequence.outlinePaintSequence
- the outline paint sequence.strokeSequence
- the stroke sequence.outlineStrokeSequence
- the outline stroke sequence.shapeSequence
- the shape sequence.
-
DefaultDrawingSupplier
public DefaultDrawingSupplier(Paint[] paintSequence, Paint[] fillPaintSequence, Paint[] outlinePaintSequence, Stroke[] strokeSequence, Stroke[] outlineStrokeSequence, Shape[] shapeSequence) Creates a new supplier.- Parameters:
paintSequence
- the paint sequence.fillPaintSequence
- the fill paint sequence.outlinePaintSequence
- the outline paint sequence.strokeSequence
- the stroke sequence.outlineStrokeSequence
- the outline stroke sequence.shapeSequence
- the shape sequence.
-
-
Method Details
-
getNextPaint
Returns the next paint in the sequence.- Specified by:
getNextPaint
in interfaceDrawingSupplier
- Returns:
- The paint.
-
getNextOutlinePaint
Returns the next outline paint in the sequence.- Specified by:
getNextOutlinePaint
in interfaceDrawingSupplier
- Returns:
- The paint.
-
getNextFillPaint
Returns the next fill paint in the sequence.- Specified by:
getNextFillPaint
in interfaceDrawingSupplier
- Returns:
- The paint.
-
getNextStroke
Returns the next stroke in the sequence.- Specified by:
getNextStroke
in interfaceDrawingSupplier
- Returns:
- The stroke.
-
getNextOutlineStroke
Returns the next outline stroke in the sequence.- Specified by:
getNextOutlineStroke
in interfaceDrawingSupplier
- Returns:
- The stroke.
-
getNextShape
Returns the next shape in the sequence.- Specified by:
getNextShape
in interfaceDrawingSupplier
- Returns:
- The shape.
-
createStandardSeriesShapes
Creates an array of standard shapes to display for the items in series on charts.- Returns:
- The array of shapes.
-
equals
Tests this object for equality with another object. -
equalShapes
A utility method for testing the equality of two arrays of shapes.- Parameters:
s1
- the first array (null
permitted).s2
- the second array (null
permitted).- Returns:
- A boolean.
-
writeObject
Handles serialization.- Parameters:
stream
- the output stream.- Throws:
IOException
- if there is an I/O problem.
-
readObject
Restores a serialized object.- Parameters:
stream
- the input stream.- Throws:
IOException
- if there is an I/O problem.ClassNotFoundException
- if there is a problem loading a class.
-
intArray
private static int[] intArray(double a, double b, double c) Helper method to avoid lots of explicit casts in getShape(). Returns an array containing the provided doubles cast to ints.- Parameters:
a
- xb
- yc
- z- Returns:
- int[3] with converted params.
-
intArray
private static int[] intArray(double a, double b, double c, double d) Helper method to avoid lots of explicit casts in getShape(). Returns an array containing the provided doubles cast to ints.- Parameters:
a
- xb
- yc
- zd
- t- Returns:
- int[4] with converted params.
-
clone
Returns a clone.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if a component of the supplier does not support cloning.
-