Draws a survey scale. By implementing the Drawable
interface,
instances can be displayed within a report using the org.jfree.report.DrawableElement
class.
createShapeList
protected ShapeList createShapeList()
Creates the shape list used when drawing the scale. The list returned must
contain exactly 6 elements.
draw
public void draw(Graphics2D g2,
Rectangle2D area)
Draws the survey scale.
g2
- the graphics device.area
- the area.
drawBorder
protected void drawBorder(Graphics2D g2,
Rectangle2D area)
drawRangeArea
protected void drawRangeArea(Rectangle2D area,
Graphics2D g2)
drawScaleValues
protected void drawScaleValues(Graphics2D g2,
Rectangle2D area)
drawTickMarks
protected void drawTickMarks(Graphics2D g2,
Rectangle2D area)
drawValues
protected void drawValues(Graphics2D g2,
Rectangle2D area)
getDefaultShape
public Shape getDefaultShape()
Returns the default shape, which is used, if a shape for a certain value is
not defined.
- the default shape, never null.
getRangeLowerBound
public Number getRangeLowerBound()
Returns the lower bound of the highlighted range. A null
value indicates that no range is set for highlighting.
- The lower bound (possibly
null
).
getRangePaint
public Paint getRangePaint()
Returns the paint used to highlight the range.
- A
Paint
object (never null
).
getRangeUpperBound
public Number getRangeUpperBound()
Returns the upper bound of the highlighted range. A null
value indicates that no range is set for highlighting.
- The upper bound (possibly
null
).
getScaleValueFont
public Font getScaleValueFont()
Returns the font used to display the scale values.
getScaleValuePaint
public Paint getScaleValuePaint()
Returns the color used to draw the scale values (if they are visible).
getShape
public Shape getShape(int index)
Returns the shape used to indicate the value of a response.
index
- the value index (zero-based).
isDrawBorder
public boolean isDrawBorder()
Returns a flag that controls whether or not a border is drawn around the
scale.
isDrawScaleValues
public boolean isDrawScaleValues()
Returns a flag that controls whether or not scale values are drawn.
isDrawTickMarks
public boolean isDrawTickMarks()
Returns the flag that controls whether the tick marks are drawn.
isShapeFilled
public boolean isShapeFilled(int index)
Returns a flag that controls whether the shape for a particular value
should be filled.
index
- the value index (zero-based).
recompute
protected void recompute()
This method is called whenever lowest or highest has changed. It will
recompute the range and upper and lower bounds.
setDefaultShape
public void setDefaultShape(Shape defaultShape)
Redefines the default shape.
defaultShape
- the default shape
setDrawBorder
public void setDrawBorder(boolean flag)
Sets a flag that controls whether or not a border is drawn around the
scale.
setDrawScaleValues
public void setDrawScaleValues(boolean flag)
Sets a flag that controls whether or not scale values are drawn.
setDrawTickMarks
public void setDrawTickMarks(boolean flag)
Sets the flag that controls whether the tick marks are drawn.
setRange
protected void setRange(int range)
setRangeLowerBound
public void setRangeLowerBound(Number bound)
Sets the lower bound for the range that is highlighted on the scale.
bound
- the lower bound (null
permitted).
setRangePaint
public void setRangePaint(Paint paint)
Sets the paint used to highlight the range (if one is specified).
paint
- the paint (null
not permitted).
setRangeUpperBound
public void setRangeUpperBound(Number bound)
Sets the upper bound for the range that is highlighted on the scale.
bound
- the upper bound (null
permitted).
setScaleValueFont
public void setScaleValueFont(Font font)
Sets the font used to display the scale values.
font
- the font (null
not permitted).
setScaleValuePaint
public void setScaleValuePaint(Paint paint)
Sets the color used to draw the scale values.
paint
- the paint (null
not permitted).
setShape
public void setShape(int index,
Shape shape)
Sets the shape used to mark a particular value in the dataset.
index
- the value index (zero-based).shape
- the shape (null
not permitted).
setShapeFilled
public void setShapeFilled(int index,
boolean fill)
Sets the flag that controls whether the shape for a particular value should
be filled.
index
- the value index (zero-based).fill
- the flag.