Class MessageFieldElementFactory
- 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.MessageFieldElementFactory
-
public class MessageFieldElementFactory extends TextElementFactory
The message format factory can be used to create formatted text elements using the format defined forMessageFormat
. These text elements have special abilities to format numeric values and dates based on the MessageFormat string. Once the desired properties are set, the factory can be reused to create similar text elements.- Author:
- Jörg Schaible
-
-
Constructor Summary
Constructors Constructor Description MessageFieldElementFactory()
Creates a new message field element factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Element
createElement()
Creates the message text element based on the defined settings.static Element
createMessageElement(String name, Rectangle2D bounds, Color color, ElementAlignment alignment, ElementAlignment valign, FontDefinition font, String nullString, String formatString)
Deprecated.Use a more fine-grained approach to define this element by using the element-factory directly.static Element
createMessageElement(String name, Rectangle2D bounds, Color paint, ElementAlignment alignment, FontDefinition font, String nullString, String format)
Deprecated.Use a more fine-grained approach to define this element by using the element-factory directly.String
getFormatString()
Returns the format string of the used message format.String
getMessageNullString()
String
getNullString()
Returns the null string for the text element.void
setFormatString(String formatString)
Defines the format string of the used message format.void
setMessageNullString(String messageNullString)
void
setNullString(String nullString)
Defines the null string for the text element.-
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
-
getFormatString
public String getFormatString()
Returns the format string of the used message format.- Returns:
- the formatstring of the number format instance.
-
setFormatString
public void setFormatString(String formatString)
Defines the format string of the used message format. The format string should contain a format for the element 0. This method will replace the message format instance of this factory.- Parameters:
formatString
- the formatstring of the message format instance.
-
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.
-
getMessageNullString
public String getMessageNullString()
-
setMessageNullString
public void setMessageNullString(String messageNullString)
-
createElement
public Element createElement()
Creates the message text element based on the defined settings. Undefined properties will not be set in the generated element.- Specified by:
createElement
in classElementFactory
- Returns:
- the generated numeric text element
- See Also:
ElementFactory.createElement()
-
createMessageElement
public static Element createMessageElement(String name, Rectangle2D bounds, Color paint, ElementAlignment alignment, FontDefinition font, String nullString, String format)
Deprecated.Use a more fine-grained approach to define this element by using the element-factory directly.Creates a new TextElement containing a message filter structure.- Parameters:
name
- the name of the new elementbounds
- the bounds of the new elementpaint
- the text color of this text elementalignment
- the horizontal text alignment.font
- the font for this elementnullString
- the text used when the value of this element is nullformat
- the format string used in this message element- Returns:
- a report element for displaying
Number
objects. - Throws:
NullPointerException
- if bounds, name or function are nullIllegalArgumentException
- if the given alignment is invalid
-
createMessageElement
public static Element createMessageElement(String name, Rectangle2D bounds, Color color, ElementAlignment alignment, ElementAlignment valign, FontDefinition font, String nullString, String formatString)
Deprecated.Use a more fine-grained approach to define this element by using the element-factory directly.Creates a new TextElement containing a message filter structure.- Parameters:
name
- the name of the new element.bounds
- the bounds of the new element.color
- the text color of this text element.alignment
- the horizontal text alignment.valign
- the vertical alignment.font
- the font for this element.nullString
- the text used when the value of this element is null.formatString
- the MessageFormat used in this number element.- Returns:
- a report element for displaying
Number
objects. - Throws:
NullPointerException
- if bounds, name or function are nullIllegalArgumentException
- if the given alignment is invalid
-
-