public class SurveyScale extends Object implements ReportDrawable, Serializable
ContentType
class.Constructor and Description |
---|
SurveyScale()
Creates a new default instance.
|
SurveyScale(int lowest,
int highest,
Number[] values)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
static Shape |
createDiamond(float s)
Creates a diamond shape.
|
static Shape |
createDownTriangle(float s)
Creates a triangle shape that points downwards.
|
protected ArrayList<Shape> |
createShapeList()
Creates the shape list used when drawing the scale.
|
static Shape |
createUpTriangle(float s)
Creates a triangle shape that points upwards.
|
void |
draw(Graphics2D g2,
Rectangle2D area)
Draws the survey scale.
|
protected void |
drawRangeArea(Rectangle2D area,
Graphics2D g2) |
protected void |
drawScaleValues(Graphics2D g2,
Rectangle2D area) |
protected void |
drawTickMarks(Graphics2D g2,
Rectangle2D area) |
protected void |
drawValues(Graphics2D g2,
Rectangle2D area) |
Shape |
getDefaultShape()
Returns the default shape, which is used, if a shape for a certain value is not defined.
|
Paint |
getFillPaint() |
int |
getHighest() |
ImageMap |
getImageMap(Rectangle2D bounds)
Returns an optional image-map for the entry.
|
protected double |
getLowerBound() |
double |
getLowerMargin() |
int |
getLowest() |
Stroke |
getOutlineStroke() |
protected int |
getRange() |
Number |
getRangeLowerBound()
Returns the lower bound of the highlighted range.
|
Paint |
getRangePaint()
Returns the paint used to highlight the range.
|
Number |
getRangeUpperBound()
Returns the upper bound of the highlighted range.
|
Font |
getScaleValueFont()
Returns the font used to display the scale values.
|
Paint |
getScaleValuePaint()
Returns the color used to draw the scale values (if they are visible).
|
Shape |
getShape(int index)
Returns the shape used to indicate the value of a response.
|
StyleSheet |
getStyleSheet() |
Paint |
getTickMarkPaint() |
protected double |
getUpperBound() |
double |
getUpperMargin() |
Number[] |
getValues() |
boolean |
isAutoConfigure() |
boolean |
isDrawScaleValues()
Returns a flag that controls whether or not scale values are drawn.
|
boolean |
isDrawTickMarks()
Returns the flag that controls whether the tick marks are drawn.
|
boolean |
isShapeFilled(int index)
Returns a flag that controls whether the shape for a particular value should be filled.
|
protected void |
recompute()
This method is called whenever lowest or highest has changed.
|
void |
setAutoConfigure(boolean autoConfigure) |
void |
setConfiguration(Configuration config)
Provides the current report configuration of the current report process to the drawable.
|
void |
setDefaultShape(Shape defaultShape)
Redefines the default shape.
|
void |
setDefaultShape(SurveyScaleShapeType shapeType) |
void |
setDrawScaleValues(boolean flag)
Sets a flag that controls whether or not scale values are drawn.
|
void |
setDrawTickMarks(boolean flag)
Sets the flag that controls whether the tick marks are drawn.
|
void |
setFillPaint(Paint fillPaint) |
void |
setHighest(int highest) |
protected void |
setLowerBound(double lowerBound) |
void |
setLowerMargin(double lowerMargin) |
void |
setLowest(int lowest) |
void |
setOutlineStroke(Stroke outlineStroke) |
protected void |
setRange(int range) |
void |
setRangeLowerBound(Number bound)
Sets the lower bound for the range that is highlighted on the scale.
|
void |
setRangePaint(Paint paint)
Sets the paint used to highlight the range (if one is specified).
|
void |
setRangeUpperBound(Number bound)
Sets the upper bound for the range that is highlighted on the scale.
|
void |
setResourceBundleFactory(ResourceBundleFactory bundleFactory)
Defines the resource-bundle factory that can be used to localize the drawing process.
|
void |
setScaleValueFont(Font font)
Sets the font used to display the scale values.
|
void |
setScaleValuePaint(Paint paint)
Sets the color used to draw the scale values.
|
void |
setShape(int index,
Shape shape)
Sets the shape used to mark a particular value in the dataset.
|
void |
setShape(int index,
SurveyScaleShapeType shape)
Sets the shape used to mark a particular value in the dataset.
|
void |
setShapeFilled(int index,
boolean fill)
Sets the flag that controls whether the shape for a particular value should be filled.
|
void |
setStyleSheet(StyleSheet style)
Provides the computed stylesheet of the report element that contained this drawable.
|
void |
setTickMarkPaint(Paint tickMarkPaint) |
protected void |
setUpperBound(double upperBound) |
void |
setUpperMargin(double upperMargin) |
public SurveyScale()
public SurveyScale(int lowest, int highest, Number[] values)
lowest
- the lowest response value on the scale.highest
- the highest response value on the scale.values
- the values to display.public boolean isAutoConfigure()
public void setAutoConfigure(boolean autoConfigure)
public int getLowest()
public void setLowest(int lowest)
public int getHighest()
public void setHighest(int highest)
protected void recompute()
protected int getRange()
protected void setRange(int range)
protected double getLowerBound()
protected void setLowerBound(double lowerBound)
protected double getUpperBound()
protected void setUpperBound(double upperBound)
protected ArrayList<Shape> createShapeList()
public static Shape createDiamond(float s)
s
- the size factor (equal to half the height of the diamond).public static Shape createUpTriangle(float s)
s
- the size factor (equal to half the height of the triangle).public static Shape createDownTriangle(float s)
s
- the size factor (equal to half the height of the triangle).public Number getRangeLowerBound()
null
value indicates that no range is set for
highlighting.null
).public void setRangeLowerBound(Number bound)
bound
- the lower bound (null
permitted).public Number getRangeUpperBound()
null
value indicates that no range is set for
highlighting.null
).public void setRangeUpperBound(Number bound)
bound
- the upper bound (null
permitted).public boolean isDrawTickMarks()
public void setDrawTickMarks(boolean flag)
flag
- a boolean.public boolean isDrawScaleValues()
public void setDrawScaleValues(boolean flag)
flag
- the flag.public Font getScaleValueFont()
null
).public void setScaleValueFont(Font font)
font
- the font (null
not permitted).public Paint getScaleValuePaint()
null
).public void setScaleValuePaint(Paint paint)
paint
- the paint (null
not permitted).public Shape getShape(int index)
index
- the value index (zero-based).public void setShape(int index, Shape shape)
index
- the value index (zero-based).shape
- the shape (null
not permitted).public void setShape(int index, SurveyScaleShapeType shape)
index
- the value index (zero-based).shape
- the shape (null
not permitted).public boolean isShapeFilled(int index)
index
- the value index (zero-based).public void setShapeFilled(int index, boolean fill)
index
- the value index (zero-based).fill
- the flag.public Paint getRangePaint()
Paint
object (never null
).public void setRangePaint(Paint paint)
paint
- the paint (null
not permitted).public Shape getDefaultShape()
public void setDefaultShape(Shape defaultShape)
defaultShape
- the default shapeNullPointerException
- if the given shape is null.public void setDefaultShape(SurveyScaleShapeType shapeType)
public Paint getTickMarkPaint()
public void setTickMarkPaint(Paint tickMarkPaint)
public Number[] getValues()
public Paint getFillPaint()
public void setFillPaint(Paint fillPaint)
public Stroke getOutlineStroke()
public void setOutlineStroke(Stroke outlineStroke)
public double getUpperMargin()
public void setUpperMargin(double upperMargin)
public double getLowerMargin()
public void setLowerMargin(double lowerMargin)
public void draw(Graphics2D g2, Rectangle2D area)
draw
in interface ReportDrawable
g2
- the graphics device.area
- the area.protected void drawValues(Graphics2D g2, Rectangle2D area)
protected void drawScaleValues(Graphics2D g2, Rectangle2D area)
protected void drawTickMarks(Graphics2D g2, Rectangle2D area)
protected void drawRangeArea(Rectangle2D area, Graphics2D g2)
public void setConfiguration(Configuration config)
setConfiguration
in interface ReportDrawable
config
- the report configuration.public void setStyleSheet(StyleSheet style)
setStyleSheet
in interface ReportDrawable
style
- the stylesheet.public StyleSheet getStyleSheet()
public void setResourceBundleFactory(ResourceBundleFactory bundleFactory)
setResourceBundleFactory
in interface ReportDrawable
bundleFactory
- the resource-bundle factory.public ImageMap getImageMap(Rectangle2D bounds)
ReportDrawable
getImageMap
in interface ReportDrawable
bounds
- the bounds for which the image map is computed.Copyright © 2002–2017 Pentaho Corporation. All rights reserved.