org.pentaho.reporting.engine.classic.core.modules.misc.survey
Class SurveyScaleExpression

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.function.AbstractExpression
      extended by org.pentaho.reporting.engine.classic.core.modules.misc.survey.SurveyScaleExpression
All Implemented Interfaces:
Serializable, Cloneable, Expression

public class SurveyScaleExpression
extends AbstractExpression

An expression that takes values from one or more fields in the current row of the report, builds a SurveyScale instance that will present those values, and returns that instance as the expression result. The fields used by the expression are defined using properties named '0', '1', ... 'N', which need to be specified after the expression is created. These fields should contain Number instances.The SurveyScale class implements the Drawable interface, so it can be displayed using a ContentFieldType.

See Also:
Serialized Form

Constructor Summary
SurveyScaleExpression()
           
SurveyScaleExpression(int lowest, int highest)
          Creates a new expression.
SurveyScaleExpression(int lowest, int highest, String lowerBoundsField, String upperBoundsField, Shape shape)
          Creates a new expression.
 
Method Summary
 Object clone()
          Clones the expression.
 String[] getField()
           
 String getField(int idx)
           
 int getHighest()
           
 int getLowest()
           
 Shape getOverrideShape()
          Returns the override shape.
 String getRangeLowerBoundField()
          Returns the name of the field containing the lower bound of the range that is to be highlighted on the scale.
 Paint getRangePaint()
           
 String getRangeUpperBoundField()
          Returns the name of the field containing the upper bound of the range that is to be highlighted on the scale.
 Object getValue()
          Returns a SurveyScale instance that is set up to display the values in the current row.
 boolean isOverrideShapeFilled()
           
 void setField(int index, String field)
           
 void setField(String[] fields)
           
 void setHighest(int highest)
           
 void setLowest(int lowest)
           
 void setOverrideShape(Shape shape)
          Sets the override shape.
 void setOverrideShapeFilled(boolean b)
          Sets a flag that controls whether the override shape is filled or not.
 void setRangeLowerBoundField(String field)
          Sets the name of the field containing the lower bound of the range that is to be highlighted on the scale.
 void setRangePaint(Paint rangePaint)
           
 void setRangeUpperBoundField(String field)
          Sets the name of the field containing the upper bound of the range that is to be highlighted on the scale.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
getDataRow, getDependencyLevel, getInstance, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurveyScaleExpression

public SurveyScaleExpression()

SurveyScaleExpression

public SurveyScaleExpression(int lowest,
                             int highest)
Creates a new expression.

Parameters:
lowest - the lowest value on the response scale.
highest - the highest value on the response scale.

SurveyScaleExpression

public SurveyScaleExpression(int lowest,
                             int highest,
                             String lowerBoundsField,
                             String upperBoundsField,
                             Shape shape)
Creates a new expression.

Parameters:
lowest - the lowest value on the response scale.
highest - the highest value on the response scale.
lowerBoundsField - the name of the field containing the lower bound of the highlighted range (null permitted).
upperBoundsField - the name of the field containing the upper bound of the highlighted range (null permitted).
shape - a shape that will be used to override the shape displayed for the first series (null permitted).
Method Detail

getRangeLowerBoundField

public String getRangeLowerBoundField()
Returns the name of the field containing the lower bound of the range that is to be highlighted on the scale.

Returns:
A string (possibly null).

setRangeLowerBoundField

public void setRangeLowerBoundField(String field)
Sets the name of the field containing the lower bound of the range that is to be highlighted on the scale. Set this to null if you have no range to highlight.

Parameters:
field - the field name (null permitted).

getRangeUpperBoundField

public String getRangeUpperBoundField()
Returns the name of the field containing the upper bound of the range that is to be highlighted on the scale.

Returns:
A string (possibly null).

setRangeUpperBoundField

public void setRangeUpperBoundField(String field)
Sets the name of the field containing the upper bound of the range that is to be highlighted on the scale. Set this to null if you have no range to highlight.

Parameters:
field - the field name (null permitted).

getOverrideShape

public Shape getOverrideShape()
Returns the override shape.

Returns:
The override shape (possibly null).

setOverrideShape

public void setOverrideShape(Shape shape)
Sets the override shape. The SurveyScale is created with a set of default shapes, this method allows you to replace the *first* shape if you need to (leave it as null otherwise).

Parameters:
shape - the shape (null permitted).

setOverrideShapeFilled

public void setOverrideShapeFilled(boolean b)
Sets a flag that controls whether the override shape is filled or not.

Parameters:
b - the flag.

getLowest

public int getLowest()

setLowest

public void setLowest(int lowest)

getHighest

public int getHighest()

setHighest

public void setHighest(int highest)

getValue

public Object getValue()
Returns a SurveyScale instance that is set up to display the values in the current row.

Returns:
a SurveyScale instance.

clone

public Object clone()
             throws CloneNotSupportedException
Clones the expression.

Specified by:
clone in interface Expression
Overrides:
clone in class AbstractExpression
Returns:
a copy of this expression.
Throws:
CloneNotSupportedException - this should never happen.

getField

public String[] getField()

setField

public void setField(String[] fields)

getField

public String getField(int idx)

setField

public void setField(int index,
                     String field)

isOverrideShapeFilled

public boolean isOverrideShapeFilled()

getRangePaint

public Paint getRangePaint()

setRangePaint

public void setRangePaint(Paint rangePaint)