Class NumberFieldElementFactory


  • public class NumberFieldElementFactory
    extends TextFieldElementFactory
    The number format factory can be used to create numeric text elements. These text elements have special abilities to format numeric values.

    Once the desired properties are set, the factory can be reused to create similiar text elements.

    Author:
    Thomas Morgner
    • Constructor Detail

      • NumberFieldElementFactory

        public NumberFieldElementFactory()
        Creates a new number field element factory.
    • Method Detail

      • getExcelCellFormat

        public String getExcelCellFormat()
        Returns the excel export cell format.
        Returns:
        the excel cell format.
      • setExcelCellFormat

        public void setExcelCellFormat​(String excelCellFormat)
        Defines a special cell format that should be used when exporting the report into Excel workbooks.
        Parameters:
        excelCellFormat - the excel cell format
      • getFormat

        public NumberFormat getFormat()
        Returns the number format used for all generated text elements. The number format is shared among all generated elements.
        Returns:
        the number format used in this factory.
      • setFormat

        public void setFormat​(NumberFormat format)
        Defines the number format used for all generated text elements. The number format is shared among all generated elements.
        Parameters:
        format - the number format used in this factory.
      • getFormatString

        public String getFormatString()
        Returns the format string of the used number format. This method will return null, if the current number format is no instance of DecimalFormat.
        Returns:
        the formatstring of the number format instance.
      • setFormatString

        public void setFormatString​(String formatString)
        Defines the format string of the used number format. This method will replace the number format instance of this factory.
        Parameters:
        formatString - the formatstring of the number format instance.
      • createNumberElement

        public static Element createNumberElement​(String name,
                                                  Rectangle2D bounds,
                                                  Color paint,
                                                  ElementAlignment alignment,
                                                  FontDefinition font,
                                                  String nullString,
                                                  NumberFormat format,
                                                  String field)
        Deprecated.
        Use a more fine-grained approach to define this element by using the element-factory directly.
        Creates a new TextElement containing a numeric filter structure.
        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 text alignment.
        font - the font for this element
        nullString - the text used when the value of this element is null
        field - the field in the datamodel to retrieve values from
        format - the NumberFormat used in this number element
        Returns:
        a report element for displaying Number objects.
        Throws:
        NullPointerException - if bounds, name or function are null
        IllegalArgumentException - if the given alignment is invalid
      • createNumberElement

        public static Element createNumberElement​(String name,
                                                  Rectangle2D bounds,
                                                  Color color,
                                                  ElementAlignment alignment,
                                                  ElementAlignment valign,
                                                  FontDefinition font,
                                                  String nullString,
                                                  NumberFormat format,
                                                  String field)
        Deprecated.
        Use a more fine-grained approach to define this element by using the element-factory directly.
        Creates a new TextElement containing a numeric 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.
        field - the field in the datamodel to retrieve values from.
        format - the NumberFormat used in this number element.
        Returns:
        a report element for displaying Number objects.
        Throws:
        NullPointerException - if bounds, name or function are null
        IllegalArgumentException - if the given alignment is invalid
      • createNumberElement

        public static Element createNumberElement​(String name,
                                                  Rectangle2D bounds,
                                                  Color paint,
                                                  ElementAlignment alignment,
                                                  FontDefinition font,
                                                  String nullString,
                                                  String format,
                                                  String field)
        Deprecated.
        Use a more fine-grained approach to define this element by using the element-factory directly.
        Creates a new TextElement containing a numeric filter structure.
        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 text alignment.
        font - the font for this element
        nullString - the text used when the value of this element is null
        field - the fieldname in the datamodel to retrieve values from
        format - the DecimalFormatString used in this text field
        Returns:
        a report element for displaying Number objects.
        Throws:
        NullPointerException - if bounds, name or function are null
        IllegalArgumentException - if the given alignment is invalid
      • createNumberElement

        public static Element createNumberElement​(String name,
                                                  Rectangle2D bounds,
                                                  Color color,
                                                  ElementAlignment alignment,
                                                  ElementAlignment valign,
                                                  FontDefinition font,
                                                  String nullString,
                                                  String format,
                                                  String field)
        Deprecated.
        Use a more fine-grained approach to define this element by using the element-factory directly.
        Creates a new TextElement containing a numeric filter structure.
        Parameters:
        name - the name of the new element.
        bounds - the bounds of the new element.
        color - the text color of the element.
        alignment - the horizontal text alignment.
        valign - the vertical alignment.
        font - the font for this element.
        nullString - t he text used when the value of this element is null.
        field - the fieldname in the datamodel to retrieve values from.
        format - the DecimalFormatString used in this text field.
        Returns:
        a report element for displaying Number objects.
        Throws:
        NullPointerException - if bounds, name or function are null
        IllegalArgumentException - if the given alignment is invalid