Interface SimpleForm

All Superinterfaces:
Form, com.github.tadukoo.util.pojo.MappedPojo
All Known Subinterfaces:
SimpleMainForm
All Known Implementing Classes:
AbstractSimpleForm, AbstractSimpleMainForm, DateForm

public interface SimpleForm extends Form
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 Details

    • getFieldMap

      Map<String,FormField<?>> 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:
      asComponent in interface Form
      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:
      saveValues in interface Form
    • labelsOnTop

      default boolean labelsOnTop()
      Returns:
      Whether to have labels for components above them (true) or to the left (false) - defaults to true
    • addField

      default void addField(FormField<?> field)
      Adds the given FormField to this Form
      Parameters:
      field - The FormField to add to this Form
    • setDefaultFields

      void setDefaultFields() throws Throwable
      This method should be called by the constructor to set default fields (this is where you should create new FormFields by calling addField(FormField))
      Throws:
      Throwable - If anything goes wrong in creating the fields
    • getFieldKeys

      default Set<String> getFieldKeys()
      Returns:
      The keys in the Map of FormFields
    • getFieldByKey

      default FormField<?> getFieldByKey(String key)
      Parameters:
      key - The key for the FormField to retrieve
      Returns:
      The FormField stored with the given key
    • addComponent

      default void addComponent(String key, JComponent component)
      Adds the given JComponent to the Components map
      Parameters:
      key - The key to use for the JComponent
      component - The JComponent to be stored
    • createComponents

      default void createComponents() throws Throwable
      This method should be called by the constructor (after calling setDefaultFields()), and will create the components to be used on this Form
      Throws:
      Throwable - If anything goes wrong in creating the components
    • getComponentKeys

      default Set<String> getComponentKeys()
      Returns:
      The keys in the Map of JComponents
    • getComponentByKey

      default JComponent getComponentByKey(String key)
      Grabs the appropriate JComponent present on this form for the given key for the field
      Parameters:
      key - The key used by the field to find the JComponent
      Returns:
      The appropriate JComponent for the given key for its field