Class FormField<Type>

java.lang.Object
com.github.tadukoo.view.form.field.FormField<Type>
Type Parameters:
Type - The type of value being stored in the field (used for default value)
Direct Known Subclasses:
BooleanFormField, ButtonFormField, DateFormField, DropDownFormField, FormFormField, NumberFormField, StringFormField, TableFormField

public abstract class FormField<Type> extends Object
Form Fields are fields used on Forms.
Since:
Alpha v.0.2
Version:
Alpha v.0.3
Author:
Logan Ferree (Tadukoo)
  • Field Details

    • type

      private final FieldType type
      The FieldType of this field
    • key

      private final String key
      The name of this field (used as a key in Forms)
    • defaultValue

      private final Type defaultValue
      The starting value of the field
    • labelType

      private final LabelType labelType
      The LabelType to use for this field
    • labelForegroundPaint

      private final SizablePaint labelForegroundPaint
      The SizablePaint for the foreground of the Label
    • labelBackgroundPaint

      private final SizablePaint labelBackgroundPaint
      The SizablePaint for the background of the Label
    • labelFontFamily

      private final FontFamily labelFontFamily
      The FontFamily for the Label's font
    • labelFontStyle

      private final int labelFontStyle
      The font style for the Label
    • labelFontSize

      private final int labelFontSize
      The font size for the Label
    • labelShape

      private final ShapeInfo labelShape
      The ShapeInfo to use for the Label
    • labelBorder

      private final Border labelBorder
      The Border to use for the Label
    • rowPos

      private final int rowPos
      The row position of this field
    • colPos

      private final int colPos
      The column position of this field
    • rowSpan

      private final int rowSpan
      The row span of this field
    • colSpan

      private final int colSpan
      The column span of this field
    • logFontResourceLoaderWarnings

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

      private final 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

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

      private final 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

      private final FontResourceLoader fontResourceLoader
      The FontResourceLoader to use for fonts on this field
  • Constructor Details

    • FormField

      protected FormField(FieldType type, String key, Type defaultValue, LabelType labelType, SizablePaint labelForegroundPaint, SizablePaint labelBackgroundPaint, FontFamily labelFontFamily, int labelFontStyle, int labelFontSize, ShapeInfo labelShape, Border labelBorder, int rowPos, int colPos, int rowSpan, int colSpan, boolean logFontResourceLoaderWarnings, com.github.tadukoo.util.logger.EasyLogger logger, GraphicsEnvironment graphEnv, String fontFolder, FontResourceLoader fontResourceLoader)
      Creates a new FormField with the given parameters.
      Parameters:
      type - The FieldType of this field
      key - The name of this field (used as a key in Forms)
      defaultValue - The starting value of the field
      labelType - The LabelType to use for this field
      labelForegroundPaint - The SizablePaint for the foreground of the Label
      labelBackgroundPaint - The SizablePaint for the background of the Label
      labelFontFamily - The FontFamily for the Label's font
      labelFontStyle - The font style for the Label
      labelFontSize - The font size for the Label
      labelShape - The ShapeInfo to use for the Label
      labelBorder - The Border to use for the Label
      rowPos - The row position of this field
      colPos - The column position of this field
      rowSpan - The row span of this field
      colSpan - The column span of this field
      logFontResourceLoaderWarnings - Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
      logger - An EasyLogger that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoader
      graphEnv - The GraphicsEnvironment to load a font to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
      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 - The FontResourceLoader to use for fonts on this field
  • Method Details

    • getType

      public FieldType getType()
      Returns:
      The FieldType of this field
    • getKey

      public String getKey()
      Returns:
      The name of this field (used as a key in Forms)
    • getDefaultValue

      public Type getDefaultValue()
      Returns:
      The starting value of this field
    • getLabelType

      public LabelType getLabelType()
      Returns:
      The LabelType to use for this field
    • getLabelForegroundPaint

      public SizablePaint getLabelForegroundPaint()
      Returns:
      The SizablePaint for the foreground of the Label
    • getLabelBackgroundPaint

      public SizablePaint getLabelBackgroundPaint()
      Returns:
      The SizablePaint for the background of the Label
    • getLabelFontFamily

      public FontFamily getLabelFontFamily()
      Returns:
      The FontFamily for the Label's font
    • getLabelFontStyle

      public int getLabelFontStyle()
      Returns:
      The font style for the Label
    • getLabelFontSize

      public int getLabelFontSize()
      Returns:
      The font size for the Label
    • getLabelShape

      public ShapeInfo getLabelShape()
      Returns:
      The ShapeInfo to use for the Label
    • getLabelBorder

      public Border getLabelBorder()
      Returns:
      The Border to use for the Label
    • getRowPos

      public int getRowPos()
      Returns:
      The row position of this field
    • getColPos

      public int getColPos()
      Returns:
      The column position of this field
    • getRowSpan

      public int getRowSpan()
      Returns:
      The row span of this field
    • getColSpan

      public int getColSpan()
      Returns:
      The column span of this field
    • logFontResourceLoaderWarnings

      public boolean logFontResourceLoaderWarnings()
      Returns:
      Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
    • getLogger

      public com.github.tadukoo.util.logger.EasyLogger getLogger()
      Returns:
      An EasyLogger that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoader
    • getGraphEnv

      public GraphicsEnvironment getGraphEnv()
      Returns:
      The GraphicsEnvironment to load a font to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
    • getFontFolder

      public String getFontFolder()
      Returns:
      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
    • getFontResourceLoader

      public FontResourceLoader getFontResourceLoader()
      Returns:
      The FontResourceLoader to use for fonts on this field
    • getComponent

      public abstract JComponent getComponent() throws Throwable
      Creates the JComponent to be used for this field.
      Returns:
      A newly created JComponent to use on the form
      Throws:
      Throwable - If anything goes wrong setting up the Component
    • getValue

      public abstract Type getValue(JComponent component)
      Takes in the JComponent for this field and grabs the data off of it, returning it in the proper format for the field to be repopulated on the form.
      Parameters:
      component - The JComponent associated with this field
      Returns:
      The data extracted from the JComponent