Class ElementTrafficLightFunction
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.AbstractExpression
-
- org.pentaho.reporting.engine.classic.core.function.AbstractFunction
-
- org.pentaho.reporting.engine.classic.core.function.AbstractElementFormatFunction
-
- org.pentaho.reporting.engine.classic.core.function.ElementTrafficLightFunction
-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,PageEventListener
,ReportListener
,Expression
,Function
,LayoutProcessorFunction
public class ElementTrafficLightFunction extends AbstractElementFormatFunction
Deprecated.This function can be safely replaced by a formula.A function that performs basic traffic lighting based on a range of values and a given set of colors to use. The default colors are for red for values smaller than 50, yellow for values smaller than 75 and green for all values greater than 75. The default behaviour will be applied if no other limits and colors are defined. This function respects absolute values when flagged. By default the given limits specify the lower boundary of an range. That means a value lower than the first given limit will return the default color, a value lower than the second value will return the first color and so on. That logic can be inversed using the 'useOppositeLogic' flag. In that case the limits specify an upper boundary. If the value read from the datarow is greater than the last limit specified, the default is returned. If the value is greater than the second last limit, the last color is used, and so on.- Author:
- Michael D'Amour
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ElementTrafficLightFunction()
Deprecated.Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
evaluateElement(ReportElement e)
Deprecated.Color[]
getColor()
Deprecated.Returns all colors defined in this function mapped to their respective position.Color
getColor(int index)
Deprecated.Returns the color at the given index in the list of LightDefinition entries.int
getColorCount()
Deprecated.Returns the number of LightDefinitions defined in this function.Color
getDefaultColor()
Deprecated.Returns the default color that is used if none of the limits applies.String
getField()
Deprecated.Returns the field used by the function.ElementTrafficLightFunction
getInstance()
Deprecated.Return a completly separated copy of this function.Number[]
getLimit()
Deprecated.Returns all numerical limits defined in this function mapped to their respective position.Number
getLimit(int index)
Deprecated.Returns the numerical limit at the given index in the list of LightDefinition entries.int
getLimitCount()
Deprecated.Returns the number of LightDefinitions defined in this function.boolean
isDefineBackground()
Deprecated.Returns whether the computed color is applied to the foreground or background of the element.boolean
isUseAbsoluteValue()
Deprecated.Defines, whether all negative limits should be made positive, by calling 'Math.abs'.boolean
isUseOppositeLogic()
Deprecated.Returns whether limits specify the lower or the upper boundary of a range.void
setColor(int index, Color color)
Deprecated.Updates the color at the given index in the list of LightDefinition entries.void
setColor(Color[] colors)
Deprecated.Updates all colors defined in this function mapped to their respective position.void
setDefaultColor(Color defaultColor)
Deprecated.Defines the default color that is used if none of the limits applies.void
setDefineBackground(boolean defineBackground)
Deprecated.Defines whether the computed color is applied to the foreground or background of the element.void
setField(String field)
Deprecated.Sets the field name for the function.void
setLimit(int index, Number value)
Deprecated.Updates the numerical limit at the given index in the list of LightDefinition entries.void
setLimit(Number[] limits)
Deprecated.Updates all numerical limits defined in this function mapped to their respective position.void
setUseAbsoluteValue(boolean useAbsoluteValue)
Deprecated.Defines, whether all negative limits should be made positive, by calling 'Math.abs'.void
setUseOppositeLogic(boolean useOppositeLogic)
Deprecated.Defines whether limits specify the lower or the upper boundary of a range.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractElementFormatFunction
getDependencyLevel, getElement, getValue, groupFinished, groupStarted, isExecutable, itemsAdvanced, itemsFinished, itemsStarted, pageFinished, pageStarted, processBand, processFooterBands, processGroupHeaders, processHeaderBands, processRootBand, recordCacheHit, recordCacheMiss, reportCachePerformance, reportDone, reportFinished, reportInitialized, reportStarted, setElement
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
summaryRowSelection
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
clone, getDataRow, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.function.Expression
clone, getDataRow, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setDependencyLevel, setName, setRuntime
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.event.ReportListener
summaryRowSelection
-
-
-
-
Method Detail
-
isUseAbsoluteValue
public boolean isUseAbsoluteValue()
Deprecated.Defines, whether all negative limits should be made positive, by calling 'Math.abs'.- Returns:
- Returns the useAbsoluteValue.
-
setUseAbsoluteValue
public void setUseAbsoluteValue(boolean useAbsoluteValue)
Deprecated.Defines, whether all negative limits should be made positive, by calling 'Math.abs'.- Parameters:
useAbsoluteValue
- The useAbsoluteValue to set.
-
isUseOppositeLogic
public boolean isUseOppositeLogic()
Deprecated.Returns whether limits specify the lower or the upper boundary of a range.- Returns:
- true, if limits specify the upper boundaries, false otherwise.
-
setUseOppositeLogic
public void setUseOppositeLogic(boolean useOppositeLogic)
Deprecated.Defines whether limits specify the lower or the upper boundary of a range. This property defaults to false, making limits define the lower boundary.- Parameters:
useOppositeLogic
- true, if limits specify the upper boundaries, false otherwise.
-
setColor
public void setColor(int index, Color color)
Deprecated.Updates the color at the given index in the list of LightDefinition entries.- Parameters:
index
- the position of the entry that should be updated.color
- the new color.
-
getColor
public Color getColor(int index)
Deprecated.Returns the color at the given index in the list of LightDefinition entries.- Parameters:
index
- the position of the entry that should be queried.- Returns:
- the color at the given position.
-
getColorCount
public int getColorCount()
Deprecated.Returns the number of LightDefinitions defined in this function.- Returns:
- the number of entries.
-
getColor
public Color[] getColor()
Deprecated.Returns all colors defined in this function mapped to their respective position.- Returns:
- the colors as array.
-
setColor
public void setColor(Color[] colors)
Deprecated.Updates all colors defined in this function mapped to their respective position. If the color-array contains more entries than the function has, new LightDefinitions will be added. If the given array contains fewer entries, the extra LightDefinitions will be deleted.- Parameters:
colors
- the colors as array.
-
setLimit
public void setLimit(int index, Number value)
Deprecated.Updates the numerical limit at the given index in the list of LightDefinition entries.- Parameters:
index
- the position of the entry that should be updated.value
- the new numerical limit.
-
getLimit
public Number getLimit(int index)
Deprecated.Returns the numerical limit at the given index in the list of LightDefinition entries.- Parameters:
index
- the position of the entry that should be queried.- Returns:
- the numerical limit at the given position.
-
getLimitCount
public int getLimitCount()
Deprecated.Returns the number of LightDefinitions defined in this function.- Returns:
- the number of entries.
-
getLimit
public Number[] getLimit()
Deprecated.Returns all numerical limits defined in this function mapped to their respective position.- Returns:
- the numerical limits as array.
-
setLimit
public void setLimit(Number[] limits)
Deprecated.Updates all numerical limits defined in this function mapped to their respective position. If the numerical limits-array contains more entries than the function has, new LightDefinitions will be added. If the given array contains fewer entries, the extra LightDefinitions will be deleted.- Parameters:
limits
- the numerical limits as array.
-
getDefaultColor
public Color getDefaultColor()
Deprecated.Returns the default color that is used if none of the limits applies.- Returns:
- the default color.
-
setDefaultColor
public void setDefaultColor(Color defaultColor)
Deprecated.Defines the default color that is used if none of the limits applies.- Parameters:
defaultColor
- the default color.
-
isDefineBackground
public boolean isDefineBackground()
Deprecated.Returns whether the computed color is applied to the foreground or background of the element.- Returns:
- true, if the color is applied as background, false if the color is applied as foreground.
-
setDefineBackground
public void setDefineBackground(boolean defineBackground)
Deprecated.Defines whether the computed color is applied to the foreground or background of the element.- Parameters:
defineBackground
- true, if the color is applied as background, false if the color is applied as foreground.
-
getField
public String getField()
Deprecated.Returns the field used by the function. The field name corresponds to a column name in the data-row.- Returns:
- The field name.
-
setField
public void setField(String field)
Deprecated.Sets the field name for the function. The field name corresponds to a column name in the data-row.- Parameters:
field
- the field name.
-
evaluateElement
protected boolean evaluateElement(ReportElement e)
Deprecated.- Specified by:
evaluateElement
in classAbstractElementFormatFunction
-
getInstance
public ElementTrafficLightFunction getInstance()
Deprecated.Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.- Specified by:
getInstance
in interfaceExpression
- Overrides:
getInstance
in classAbstractElementFormatFunction
- Returns:
- a copy of this function.
-
-