com.jrefinery.report.io.simple
Class FontFactory

java.lang.Object
  |
  +--com.jrefinery.report.io.simple.FontFactory
All Implemented Interfaces:
ReportDefinitionTags

public class FontFactory
extends java.lang.Object
implements ReportDefinitionTags

Parses the font specifications for bands and text elements.

Author:
Thomas Morgner

Nested Class Summary
static class FontFactory.FontInformation
          The FontInformation class is used to store the font definition, until it can be applied to a stylesheet.
 
Field Summary
 
Fields inherited from interface com.jrefinery.report.io.simple.ReportDefinitionTags
ALIGNMENT_ATT, BOTTOMMARGIN_ATT, COLOR_ATT, CONFIGURATION_TAG, DATAREF_TAG, DATE_FIELD_TAG, DATE_FUNCTION_TAG, DEPENCY_LEVEL_ATT, DRAWABLE_FIELD_TAG, EXPRESSION_TAG, FIELD_TAG, FIELDNAME_ATT, FIELDS_TAG, FONT_NAME_ATT, FONT_SIZE_ATT, FONT_STYLE_ATT, FORMAT_ATT, FS_BOLD, FS_EMBEDDED, FS_ENCODING, FS_ITALIC, FS_STRIKETHR, FS_UNDERLINE, FUNCTION_TAG, FUNCTIONNAME_ATT, FUNCTIONS_TAG, GENERAL_FIELD_TAG, GENERAL_FUNCTION_TAG, GROUP_FOOTER_TAG, GROUP_HEADER_TAG, GROUP_TAG, GROUPS_TAG, HEIGHT_ATT, IMAGEFIELD_TAG, IMAGEFUNCTION_TAG, IMAGEREF_TAG, IMAGEURLFIELD_TAG, IMAGEURLFUNCTION_TAG, ITEMS_TAG, LABEL_TAG, LEFTMARGIN_ATT, LINE_TAG, LINEHEIGHT, MULTILINE_FIELD_TAG, MULTILINE_FUNCTION_TAG, NAME_ATT, NULLSTRING_ATT, NUMBER_FIELD_TAG, NUMBER_FUNCTION_TAG, ORIENTATION_ATT, ORIENTATION_LANDSCAPE_VAL, ORIENTATION_PORTRAIT_VAL, ORIENTATION_REVERSE_LANDSCAPE_VAL, PAGE_FOOTER_TAG, PAGE_HEADER_TAG, PAGEFORMAT_ATT, PROPERTIES_TAG, PROPERTY_ENCODING_ATT, PROPERTY_ENCODING_TEXT, PROPERTY_REFERENCE_TAG, PROPERTY_TAG, RECTANGLE_TAG, REPEAT_HEADER, REPORT_FOOTER_TAG, REPORT_HEADER_TAG, REPORT_TAG, RESOURCEBASE_ATTR, RESOURCEFIELD_TAG, RESOURCELABEL_TAG, RIGHTMARGIN_ATT, SHAPE_FIELD_TAG, STRING_FIELD_TAG, STRING_FUNCTION_TAG, TOPMARGIN_ATT, VALIGNMENT_ATT, WIDTH_ATT
 
Constructor Summary
FontFactory()
          Default constructor.
 
Method Summary
static void applyFontInformation(ElementStyleSheet es, FontFactory.FontInformation fi)
          Applies the font information to the ElementStyleSheet.
 FontFactory.FontInformation createFont(org.xml.sax.Attributes attr)
          Parses an element font.
 void createFont(org.xml.sax.Attributes attr, ElementStyleSheet target)
          Parses an element font.
protected  java.lang.Integer readInt(org.xml.sax.Attributes attr, java.lang.String name)
          Reads an attribute as int and returns def if that fails.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontFactory

public FontFactory()
Default constructor.

Method Detail

applyFontInformation

public static void applyFontInformation(ElementStyleSheet es,
                                        FontFactory.FontInformation fi)
Applies the font information to the ElementStyleSheet.

Parameters:
es - the element style sheet that should receive the font definition.
fi - the previously parsed font information.

readInt

protected java.lang.Integer readInt(org.xml.sax.Attributes attr,
                                    java.lang.String name)
Reads an attribute as int and returns def if that fails.

Parameters:
attr - the element attributes.
name - the attribute name.
Returns:
the int value.

createFont

public void createFont(org.xml.sax.Attributes attr,
                       ElementStyleSheet target)
                throws org.jfree.xml.ElementDefinitionException
Parses an element font. Missing attributes are replaces with the default font's attributes.

Parameters:
attr - the element attributes.
target - the target element style sheet, that should receive the created font definition.
Throws:
org.jfree.xml.ElementDefinitionException - if the font cannot be created.

createFont

public FontFactory.FontInformation createFont(org.xml.sax.Attributes attr)
                                       throws org.jfree.xml.ElementDefinitionException
Parses an element font. Missing attributes are replaces with the default font's attributes.

Parameters:
attr - the element attributes.
Returns:
the created font information.
Throws:
org.jfree.xml.ElementDefinitionException - if the font cannot be created.