Class FormField.FormFieldBuilder<Type>

java.lang.Object
com.github.tadukoo.view.form.field.FormField.FormFieldBuilder<Type>
Type Parameters:
Type - The type of value being stored in the field (used for default value)
Direct Known Subclasses:
BooleanFormField.BooleanFormFieldBuilder, ButtonFormField.ButtonFormFieldBuilder, DateFormField.DateFormFieldBuilder, DropDownFormField.DropDownFormFieldBuilder, FormFormField.FormFormFieldBuilder, NumberFormField.NumberFormFieldBuilder, StringFormField.StringFormFieldBuilder, TableFormField.TableFormFieldBuilder
Enclosing class:
FormField<Type>

public abstract static class FormField.FormFieldBuilder<Type> extends Object
Builder to be used to create a FormField. This is the abstract version to be extended in subclasses of FormField. It has the following parameters:
FormField Parameters
Name Description Default Value or Required
key The name of the field (used as a key in Forms) Required
defaultValue The starting value of the field Defaults to null
labelType The LabelType to use for the field Defaults to LabelType.LABEL
labelForegroundPaint The SizablePaint for the foreground of the Label Defaults to null (to use the Look & Feel's default Label foreground paint)
labelBackgroundPaint The SizablePaint for the background of the Label Defaults to null (to use the Look & Feel's default Label background paint)
labelFont The Font to use for the Label - specified as a FontFamily, style, and size Defaults to null (to use the Look & Feel's default Label font)
labelShape The ShapeInfo to use for the Label Defaults to null (to use the Look & Feel's default Label shape)
labelBorder The Border to use for the Label Defaults to null (to use the Look & Feel's default Label border)
rowPos The row position of the field Required
colPos The column position of the field Required
rowSpan The row span of the field Defaults to 1
colSpan The column span of the field Defaults to 1
This builder also provides methods and parameters for font resource loading:
Font Resource Loading Parameters
Field Description Default Value
logFontResourceLoaderWarnings Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoader false
logger An EasyLogger that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoader null (since logging warnings is set to false by default)
graphEnv The GraphicsEnvironment to load fonts to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader GraphicsEnvironment.getLocalGraphicsEnvironment()
fontFolder The path to the fonts folder to find font files in if needed in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader "fonts/"
fontResourceLoader The FontResourceLoader to use in loading fonts and/or ensuring they're in the system a new FontResourceLoader with the specified values for logFontResourceLoaderWarnings, logger, graphEnv, and fontFolder
Since:
Alpha v.0.2
Version:
Alpha v.0.3
Author:
Logan Ferree (Tadukoo)
  • Field Details

    • key

      protected String key
      The name of the field (used as a key in Forms)
    • defaultValue

      protected Type defaultValue
      The starting value of the field
    • labelType

      protected LabelType labelType
      The LabelType to use for the field
    • labelForegroundPaint

      protected SizablePaint labelForegroundPaint
      The SizablePaint for the foreground of the Label
    • labelBackgroundPaint

      protected SizablePaint labelBackgroundPaint
      The SizablePaint for the background of the Label
    • labelFontFamily

      protected FontFamily labelFontFamily
      The FontFamily for the Label's font
    • labelFontStyle

      protected int labelFontStyle
      The font style for the Label
    • labelFontSize

      protected int labelFontSize
      The font size for the Label
    • labelShape

      protected ShapeInfo labelShape
      The ShapeInfo to use for the Label
    • labelBorder

      protected Border labelBorder
      The Border to use for the Label
    • rowPos

      protected int rowPos
      The row position of the field
    • colPos

      protected int colPos
      The column position of the field
    • rowSpan

      protected int rowSpan
      The row span of the field
    • colSpan

      protected int colSpan
      The column span of the field
    • logFontResourceLoaderWarnings

      protected boolean logFontResourceLoaderWarnings
      Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
    • logger

      protected com.github.tadukoo.util.logger.EasyLogger logger
      An EasyLogger that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoader
    • graphEnv

      protected GraphicsEnvironment graphEnv
      The GraphicsEnvironment to load a font to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
    • fontFolder

      protected String fontFolder
      The path to the fonts folder to find font files in if needed in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
    • fontResourceLoader

      protected FontResourceLoader fontResourceLoader
      The FontResourceLoader to use in loading a font and/or ensuring they're in the system
  • Constructor Details

    • FormFieldBuilder

      protected FormFieldBuilder()
      Constructs a new FormFieldBuilder (to be called in subclasses)
  • Method Details

    • key

      Parameters:
      key - The name of the field (used as a key in Forms)
      Returns:
      this, to continue building
    • defaultValue

      public FormField.FormFieldBuilder<Type> defaultValue(Type defaultValue)
      Parameters:
      defaultValue - The starting value of the field
      Returns:
      this, to continue building
    • labelType

      public FormField.FormFieldBuilder<Type> labelType(LabelType labelType)
      Parameters:
      labelType - The LabelType to use for the field
      Returns:
      this, to continue building
    • labelForegroundPaint

      public FormField.FormFieldBuilder<Type> labelForegroundPaint(SizablePaint labelForegroundPaint)
      Parameters:
      labelForegroundPaint - The SizablePaint for the foreground of the Label
      Returns:
      this, to continue building
    • labelBackgroundPaint

      public FormField.FormFieldBuilder<Type> labelBackgroundPaint(SizablePaint labelBackgroundPaint)
      Parameters:
      labelBackgroundPaint - The SizablePaint for the background of the Label
      Returns:
      this, to continue building
    • labelFont

      public FormField.FormFieldBuilder<Type> labelFont(FontFamily labelFontFamily, int labelFontStyle, int labelFontSize)
      Specifies the font to use on the Label
      Parameters:
      labelFontFamily - The FontFamily for the Label's font
      labelFontStyle - The font style for the Label
      labelFontSize - The font size for the Label
      Returns:
      this, to continue building
    • labelShape

      public FormField.FormFieldBuilder<Type> labelShape(ShapeInfo labelShape)
      Parameters:
      labelShape - The ShapeInfo to use for the Label
      Returns:
      this, to continue building
    • labelBorder

      public FormField.FormFieldBuilder<Type> labelBorder(Border labelBorder)
      Parameters:
      labelBorder - The Border to use for the Label
      Returns:
      this, to continue building
    • rowPos

      public FormField.FormFieldBuilder<Type> rowPos(int rowPos)
      Parameters:
      rowPos - The row position of the field
      Returns:
      this, to continue building
    • colPos

      public FormField.FormFieldBuilder<Type> colPos(int colPos)
      Parameters:
      colPos - The column position of the field
      Returns:
      this, to continue building
    • rowSpan

      public FormField.FormFieldBuilder<Type> rowSpan(int rowSpan)
      Parameters:
      rowSpan - The row span of the field
      Returns:
      this, to continue building
    • colSpan

      public FormField.FormFieldBuilder<Type> colSpan(int colSpan)
      Parameters:
      colSpan - The column span of the field
      Returns:
      this, to continue building
    • logFontResourceLoaderWarnings

      public FormField.FormFieldBuilder<Type> logFontResourceLoaderWarnings(boolean logFontResourceLoaderWarnings)
      Parameters:
      logFontResourceLoaderWarnings - Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
      Returns:
      this, to continue building
    • logger

      public FormField.FormFieldBuilder<Type> logger(com.github.tadukoo.util.logger.EasyLogger logger)
      Parameters:
      logger - An EasyLogger that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoader
      Returns:
      this, to continue building
    • graphEnv

      Parameters:
      graphEnv - The GraphicsEnvironment to load fonts to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
      Returns:
      this, to continue building
    • fontFolder

      public FormField.FormFieldBuilder<Type> fontFolder(String fontFolder)
      Parameters:
      fontFolder - The path to the fonts folder to find font files in if needed in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
      Returns:
      this, to continue building
    • fontResourceLoader

      public FormField.FormFieldBuilder<Type> fontResourceLoader(FontResourceLoader fontResourceLoader)
      Parameters:
      fontResourceLoader - The FontResourceLoader to use in loading fonts and/or ensuring they're in the system
      Returns:
      this, to continue building
    • build

      public abstract FormField<Type> build() throws Throwable
      Builds the FormField
      Returns:
      A newly created FormField
      Throws:
      Throwable - If anything goes wrong in building the Form Field