Package com.github.tadukoo.view.form
Interface SimpleForm
- All Superinterfaces:
Form,com.github.tadukoo.util.pojo.MappedPojo
- All Known Subinterfaces:
SimpleMainForm
- All Known Implementing Classes:
AbstractSimpleForm,AbstractSimpleMainForm,DateForm
Simple Form represents a form used in a program that the user can fill out and interact with.
It uses
FormFields for the fields and buttons and such to be displayed on a single tab.- Since:
- Alpha v.0.2
- Version:
- Alpha v.0.3.3
- Author:
- Logan Ferree (Tadukoo)
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddComponent(String key, JComponent component) Adds the givenJComponentto the Components mapdefault voidAdds the givenFormFieldto this Formdefault voidThis method should be called by the constructor (after callingsetDefaultFields()), and will create the components to be used on this Formdefault JComponentgetComponentByKey(String key) Grabs the appropriateJComponentpresent on this form for the given key for the fielddefault FormField<?>getFieldByKey(String key) default booleandefault voidThis method can be called by subclasses to update the values present in the form from the Component valuesvoidThis method should be called by the constructor to set default fields (this is where you should create newFormFields by callingaddField(FormField))Methods inherited from interface com.github.tadukoo.util.pojo.MappedPojo
clear, getItem, getKeys, getListItem, getListItemNoThrow, getListItemNoThrow, getMap, getPojoItem, getPojoItemNoThrow, getPojoItemNoThrow, hasItem, hasKey, isEmpty, removeItem, setItem
-
Method Details
-
getFieldMap
- Returns:
- The Map of
FormFields by their keys
-
getComponentMap
Map<String,JComponent> getComponentMap()- Returns:
- The Map of
JComponents by their keys
-
asComponent
JPanel asComponent()- Specified by:
asComponentin interfaceForm- Returns:
- This Form as a
Component
-
saveValues
default void saveValues()This method can be called by subclasses to update the values present in the form from the Component values- Specified by:
saveValuesin interfaceForm
-
labelsOnTop
default boolean labelsOnTop()- Returns:
- Whether to have labels for components above them (true) or to the left (false) - defaults to true
-
addField
Adds the givenFormFieldto this Form- Parameters:
field- TheFormFieldto add to this Form
-
setDefaultFields
This method should be called by the constructor to set default fields (this is where you should create newFormFields by callingaddField(FormField))- Throws:
Throwable- If anything goes wrong in creating the fields
-
getFieldKeys
- Returns:
- The keys in the Map of
FormFields
-
getFieldByKey
-
addComponent
Adds the givenJComponentto the Components map- Parameters:
key- The key to use for theJComponentcomponent- TheJComponentto be stored
-
createComponents
This method should be called by the constructor (after callingsetDefaultFields()), and will create the components to be used on this Form- Throws:
Throwable- If anything goes wrong in creating the components
-
getComponentKeys
- Returns:
- The keys in the Map of
JComponents
-
getComponentByKey
Grabs the appropriateJComponentpresent on this form for the given key for the field- Parameters:
key- The key used by the field to find theJComponent- Returns:
- The appropriate
JComponentfor the given key for its field
-