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
Form Fields are fields used on
Forms
.- Since:
- Alpha v.0.2
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
The column position of this fieldprivate final int
The column span of this fieldprivate final Type
The starting value of the fieldprivate final String
The path to the fonts folder to find font files in if needed in the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderprivate final FontResourceLoader
TheFontResourceLoader
to use for fonts on this fieldprivate final GraphicsEnvironment
TheGraphicsEnvironment
to load a font to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderprivate final String
The name of this field (used as a key inForms
)private final SizablePaint
TheSizablePaint
for the background of the Labelprivate final Border
TheBorder
to use for the Labelprivate final FontFamily
TheFontFamily
for the Label's fontprivate final int
The font size for the Labelprivate final int
The font style for the Labelprivate final SizablePaint
TheSizablePaint
for the foreground of the Labelprivate final ShapeInfo
TheShapeInfo
to use for the Labelprivate final LabelType
TheLabelType
to use for this fieldprivate final boolean
Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderprivate final com.github.tadukoo.util.logger.EasyLogger
AnEasyLogger
that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoaderprivate final int
The row position of this fieldprivate final int
The row span of this fieldprivate final FieldType
TheFieldType
of this field -
Constructor Summary
ModifierConstructorDescriptionprotected
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. -
Method Summary
Modifier and TypeMethodDescriptionint
int
abstract JComponent
Creates theJComponent
to be used for this field.getKey()
int
int
com.github.tadukoo.util.logger.EasyLogger
int
int
getType()
abstract Type
getValue
(JComponent component) Takes in theJComponent
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.boolean
-
Field Details
-
type
TheFieldType
of this field -
key
The name of this field (used as a key inForms
) -
defaultValue
The starting value of the field -
labelType
TheLabelType
to use for this field -
labelForegroundPaint
TheSizablePaint
for the foreground of the Label -
labelBackgroundPaint
TheSizablePaint
for the background of the Label -
labelFontFamily
TheFontFamily
for the Label's font -
labelFontStyle
private final int labelFontStyleThe font style for the Label -
labelFontSize
private final int labelFontSizeThe font size for the Label -
labelShape
TheShapeInfo
to use for the Label -
labelBorder
TheBorder
to use for the Label -
rowPos
private final int rowPosThe row position of this field -
colPos
private final int colPosThe column position of this field -
rowSpan
private final int rowSpanThe row span of this field -
colSpan
private final int colSpanThe column span of this field -
logFontResourceLoaderWarnings
private final boolean logFontResourceLoaderWarningsWhether 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 loggerAnEasyLogger
that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoader -
graphEnv
TheGraphicsEnvironment
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
TheFontResourceLoader
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
- TheFieldType
of this fieldkey
- The name of this field (used as a key inForms
)defaultValue
- The starting value of the fieldlabelType
- TheLabelType
to use for this fieldlabelForegroundPaint
- TheSizablePaint
for the foreground of the LabellabelBackgroundPaint
- TheSizablePaint
for the background of the LabellabelFontFamily
- TheFontFamily
for the Label's fontlabelFontStyle
- The font style for the LabellabelFontSize
- The font size for the LabellabelShape
- TheShapeInfo
to use for the LabellabelBorder
- TheBorder
to use for the LabelrowPos
- The row position of this fieldcolPos
- The column position of this fieldrowSpan
- The row span of this fieldcolSpan
- The column span of this fieldlogFontResourceLoaderWarnings
- Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderlogger
- AnEasyLogger
that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoadergraphEnv
- TheGraphicsEnvironment
to load a font to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderfontFolder
- The path to the fonts folder to find font files in if needed in the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderfontResourceLoader
- TheFontResourceLoader
to use for fonts on this field
-
-
Method Details
-
getType
- Returns:
- The
FieldType
of this field
-
getKey
- Returns:
- The name of this field (used as a key in
Forms
)
-
getDefaultValue
- Returns:
- The starting value of this field
-
getLabelType
- Returns:
- The
LabelType
to use for this field
-
getLabelForegroundPaint
- Returns:
- The
SizablePaint
for the foreground of the Label
-
getLabelBackgroundPaint
- Returns:
- The
SizablePaint
for the background of the Label
-
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
- Returns:
- The
ShapeInfo
to use for the Label
-
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
- Returns:
- The
GraphicsEnvironment
to load a font to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoader
-
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
- Returns:
- The
FontResourceLoader
to use for fonts on this field
-
getComponent
Creates theJComponent
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
Takes in theJComponent
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
- TheJComponent
associated with this field- Returns:
- The data extracted from the
JComponent
-