org.pentaho.reporting.engine.classic.core.elementfactory
Class ResourceLabelElementFactory

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory
      extended by org.pentaho.reporting.engine.classic.core.elementfactory.TextElementFactory
          extended by org.pentaho.reporting.engine.classic.core.elementfactory.ResourceLabelElementFactory

public class ResourceLabelElementFactory
extends TextElementFactory

A factory to define translateable LabelElements. LabelElements are considered immutable and should not be modified once they are created. The label expects plain text. The content of the label will be translated using an assigned resource bundle.

Author:
Thomas Morgner

Constructor Summary
ResourceLabelElementFactory()
          DefaultConstructor.
 
Method Summary
 Element createElement()
          Generates the element based on the defined properties.
static Element createResourceLabel(String name, Rectangle2D bounds, Color paint, ElementAlignment alignment, ElementAlignment valign, FontDefinition font, String nullValue, String resourceBase, String resourceKey)
          Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.
 String getNullString()
          Returns the null string for the text element.
 String getResourceBase()
          Returns the base name of the resource bundle used to translate the content later.
 String getResourceKey()
          Returns the resource key that contains the label text.
 void setNullString(String nullString)
          Defines the null string for the text element.
 void setResourceBase(String resourceBase)
          Defines the base name of the resource bundle used to translate the content later.
 void setResourceKey(String resourceKey)
          Defines the resource key, which will be used to read the translated label text.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.elementfactory.TextElementFactory
getBold, getEmbedFont, getEncoding, getFontName, getFontSize, getItalic, getLineHeight, getMaximumLetterSpacing, getMinimumLetterSpacing, getOptimumLetterSpacing, getReservedLiteral, getStrikethrough, getTrimTextContent, getUnderline, getVerticalTextAlignment, getWhitespaceCollapse, getWrap, getWrapText, setBold, setEmbedFont, setEncoding, setFontName, setFontSize, setItalic, setLineHeight, setMaximumLetterSpacing, setMinimumLetterSpacing, setOptimumLetterSpacing, setReservedLiteral, setStrikethrough, setTrimTextContent, setUnderline, setVerticalTextAlignment, setWhitespaceCollapse, setWrap, setWrapText
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory
getAbsolutePosition, getAvoidPagebreaks, getBackgroundColor, getBorderBottomColor, getBorderBottomLeftRadius, getBorderBottomLeftRadiusHeight, getBorderBottomLeftRadiusWidth, getBorderBottomRightRadius, getBorderBottomRightRadiusHeight, getBorderBottomRightRadiusWidth, getBorderBottomStyle, getBorderBottomWidth, getBorderBreakColor, getBorderBreakStyle, getBorderBreakWidth, getBorderColor, getBorderLeftColor, getBorderLeftStyle, getBorderLeftWidth, getBorderRadius, getBorderRadiusHeight, getBorderRadiusWidth, getBorderRightColor, getBorderRightStyle, getBorderRightWidth, getBorderStyle, getBorderTopColor, getBorderTopLeftRadius, getBorderTopLeftRadiusHeight, getBorderTopLeftRadiusWidth, getBorderTopRightRadius, getBorderTopRightRadiusHeight, getBorderTopRightRadiusWidth, getBorderTopStyle, getBorderTopWidth, getBorderWidth, getColor, getDynamicHeight, getFontSmooth, getHeight, getHorizontalAlignment, getHRefTarget, getHRefTitle, getHRefWindow, getLayoutCachable, getMaximumHeight, getMaximumSize, getMaximumWidth, getMinimumHeight, getMinimumSize, getMinimumWidth, getName, getOrphans, getOverflowX, getOverflowY, getPadding, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getPreferredSize, getUseMinChunkWidth, getVerticalAlignment, getVisible, getWidows, getWidth, getX, getY, setAbsolutePosition, setAvoidPagebreaks, setBackgroundColor, setBorderBottomColor, setBorderBottomLeftRadius, setBorderBottomLeftRadiusHeight, setBorderBottomLeftRadiusWidth, setBorderBottomRightRadius, setBorderBottomRightRadiusHeight, setBorderBottomRightRadiusWidth, setBorderBottomStyle, setBorderBottomWidth, setBorderBreakColor, setBorderBreakStyle, setBorderBreakWidth, setBorderColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftWidth, setBorderRadius, setBorderRadiusHeight, setBorderRadiusWidth, setBorderRightColor, setBorderRightStyle, setBorderRightWidth, setBorderStyle, setBorderTopColor, setBorderTopLeftRadius, setBorderTopLeftRadiusHeight, setBorderTopLeftRadiusWidth, setBorderTopRightRadius, setBorderTopRightRadiusHeight, setBorderTopRightRadiusWidth, setBorderTopStyle, setBorderTopWidth, setBorderWidth, setColor, setDynamicHeight, setFontSmooth, setHeight, setHorizontalAlignment, setHRefTarget, setHRefTitle, setHRefWindow, setLayoutCachable, setMaximumHeight, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumWidth, setName, setOrphans, setOverflowX, setOverflowY, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPreferredSize, setUseMinChunkWidth, setVerticalAlignment, setVisible, setWidows, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceLabelElementFactory

public ResourceLabelElementFactory()
DefaultConstructor.

Method Detail

getResourceBase

public String getResourceBase()
Returns the base name of the resource bundle used to translate the content later.

Returns:
the resource bundle name of the element.

setResourceBase

public void setResourceBase(String resourceBase)
Defines the base name of the resource bundle used to translate the content later.

Parameters:
resourceBase - the resource bundle name of the element.

getNullString

public String getNullString()
Returns the null string for the text element. The null string is used when no content is found for that element.

Returns:
the null string.

setNullString

public void setNullString(String nullString)
Defines the null string for the text element. The null string is used when no content is found for that element. The nullstring itself can be null.

Parameters:
nullString - the null string.

getResourceKey

public String getResourceKey()
Returns the resource key that contains the label text.

Returns:
the label resource bundle key.

setResourceKey

public void setResourceKey(String resourceKey)
Defines the resource key, which will be used to read the translated label text.

Parameters:
resourceKey - the resource bundle key.

createElement

public Element createElement()
Generates the element based on the defined properties.

Specified by:
createElement in class ElementFactory
Returns:
the generated element.
Throws:
NullPointerException - if the resource class name is null.
IllegalStateException - if the resource key is not defined.
See Also:
ElementFactory.createElement()

createResourceLabel

public static Element createResourceLabel(String name,
                                          Rectangle2D bounds,
                                          Color paint,
                                          ElementAlignment alignment,
                                          ElementAlignment valign,
                                          FontDefinition font,
                                          String nullValue,
                                          String resourceBase,
                                          String resourceKey)
Deprecated. Use a more fine-grained approach to define this element by using the element-factory directly.

Creates a ResourceElement. ResourceElements resolve their value using a java.util.ResourceBundle.

Parameters:
name - the name of the new element.
bounds - the bounds of the new element.
paint - the text color of this text element.
alignment - the horizontal alignment.
valign - the vertical alignment.
font - the font for this element.
resourceKey - the key which is used to query the resource bundle
resourceBase - the classname/basename of the assigned resource bundle
nullValue - the null string of the text element (can be null).
Returns:
the created ResourceElement