Class ResourceMessageElementFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.elementfactory.ElementFactory
-
- org.pentaho.reporting.engine.classic.core.elementfactory.TextElementFactory
-
- org.pentaho.reporting.engine.classic.core.elementfactory.ResourceMessageElementFactory
-
public class ResourceMessageElementFactory 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
Constructors Constructor Description ResourceMessageElementFactory()
DefaultConstructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Element
createElement()
Generates the element based on the defined properties.static Element
createResourceMessage(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
getFormatKey()
Returns the resource key that contains the label text.String
getMessageNullString()
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.void
setFormatKey(String formatKey)
Defines the resource key, which will be used to read the translated label text.void
setMessageNullString(String messageNullString)
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.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.elementfactory.TextElementFactory
applyStyle, 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
applyElementName, getAbsolutePosition, getAvoidPagebreaks, getBackgroundColor, getBooleanValue, 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, getWidowOrphanOptOut, 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, setWidowOrphanOptOut, setWidows, setWidth, setX, setY
-
-
-
-
Method Detail
-
getMessageNullString
public String getMessageNullString()
-
setMessageNullString
public void setMessageNullString(String messageNullString)
-
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.
-
getFormatKey
public String getFormatKey()
Returns the resource key that contains the label text.- Returns:
- the label resource bundle key.
-
setFormatKey
public void setFormatKey(String formatKey)
Defines the resource key, which will be used to read the translated label text.- Parameters:
formatKey
- the resource bundle key.
-
createElement
public Element createElement()
Generates the element based on the defined properties.- Specified by:
createElement
in classElementFactory
- 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()
-
createResourceMessage
public static Element createResourceMessage(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 ajava.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 bundleresourceBase
- the classname/basename of the assigned resource bundlenullValue
- the null string of the text element (can be null).- Returns:
- the created ResourceElement
-
-