Class Form

All Implemented Interfaces:
Animatable<Form>, CanDrop<Form>, Draggable<Form>, Focusable<Form>, HandleHotKey<Form>, HandleMouseEvents<Form>, BasedOnDataDescriptor<Form>, Scrollable<Form>

Form component

The form component display a form on the interface, in which the user can input various data. The component is able to create and handle an entire form, based on a DataDescriptor. It also allows the inputted data to be validated, and handles the events related to editing data. The component implements the database data saving and data editing operations. It is compatible by the framework's DataDescriptor and records.

The component also allows the inputted data to be sent to a servlet, that can be implemented in the application, or an outside one. The data can be sent, according to HTML standards, with a POST or GET message, but this is not needed during normal use, since every data inputted by the user is accessible on the server side, at all times as well.

The form handles every form item component, thus the modification and query of the individual form item values are handled. If the form component is used to edit data, then the values of the form items can be accessed through the form.

The data inputted by the user can also be validated through the form. By default this only checks if mandatory fields are filled out, but a custom validator class can be created by implementing the FormValidator interface. In this case, the default validator will not function, only the custom one. The custom validator can be passed to the form by using the setFormValidator(FormValidator) method

The form component supports multiple display types, allowing for the implementation of simple and complex forms. By default the DefaultFormBuilder is used, that creates a simple form. The framework offers other form builder classes, these are described in the FormBuildType enum. A custom form builder can also be created, by implementing the FormBuilder interface. The custom form builder implementation can be set by using the setBuildType(FormBuildType, FormBuilder) method.

Supported events:

AnimationStart AnimationEnd, Focus FocusOut FocusIn LosesFocus MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, Scrollable Drop, DragStart, DragEnd HotKey

Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • Form

      public Form()
      Creates an empty form component
    • Form

      public Form(String language)
      Creates an empty form component, with the specified language
      Parameters:
      language - The language code to be used by the form. If not specified, or null the default language will be used. The framework's default language can be set by the JBStrapParamType.DEFAULT_LANGUAGE JBStrap parameter
    • Form

      public Form(String id, String language)
      Creates an empty form component, with the specified language
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      language - The language code to be used by the form. If not specified, or null the default language will be used. The framework's default language can be set by the JBStrapParamType.DEFAULT_LANGUAGE JBStrap parameter
    • Form

      public Form(FormEncoding encode)
      Creates an empty form component, with the specified encoding. Default encoding: FormEncoding.MULTIPART
      Parameters:
      encode - The form encoding. Usable values can be found in the FormEncoding enum
    • Form

      public Form(String id, FormEncoding encode)
      Creates an empty form component, with the specified encoding. Default encoding: FormEncoding.MULTIPART
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      encode - The form encoding. Usable values can be found in the FormEncoding enum
    • Form

      public Form(FormEncoding encode, String language)
      Creates an empty form component, with the specified encoding and language code. Default encoding: FormEncoding.MULTIPART.
      Parameters:
      encode - The form encoding. Usable values can be found in the FormEncoding enum
      language - The language code to be used by the form. If not specified, or null the default language will be used. The framework's default language can be set by the JBStrapParamType.DEFAULT_LANGUAGE JBStrap parameter
    • Form

      public Form(String id, FormEncoding encode, String language)
      Creates an empty form component, with the specified encoding and language code. Default encoding: FormEncoding.MULTIPART.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      encode - The form encoding. Usable values can be found in the FormEncoding enum
      language - The language code to be used by the form. If not specified, or null the default language will be used. The framework's default language can be set by the JBStrapParamType.DEFAULT_LANGUAGE JBStrap parameter
    • Form

      public Form(FormMethod method)
      Creates an empty form component, and sets the form send type. By default this is FormMethod.POST
      Parameters:
      method - The form sending method. Usable ones can be found in the FormMethod enum
    • Form

      public Form(FormMethod method, String language)
      Creates an empty form component, sets the form send type and language code. By default, the method is FormMethod.POST
      Parameters:
      method - The form sending method. Usable ones can be found in the FormMethod enum
      language - The language code to be used by the form. If not specified, or null the default language will be used.
    • Form

      public Form(String action, FormMethod method, FormEncoding encode)
      Creates an empty form, with the specified action, encoding, and method.
      Parameters:
      action - The form action
      method - The form sending method. Usable ones can be found in the FormMethod enum
      encode - The form encoding. Usable values can be found in the FormEncoding enum
    • Form

      public Form(String id, String action, FormMethod method, FormEncoding encode)
      Creates an empty form, with the specified action, encoding, and method.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      action - The form action
      method - The form sending method. Usable ones can be found in the FormMethod enum
      encode - The form encoding. Usable values can be found in the FormEncoding enum
    • Form

      public Form(String action, FormMethod method, FormEncoding encode, String language)
      Creates an empty form, with the specified action, encoding, method and language.
      Parameters:
      action - The form action
      method - The form sending method. Usable ones can be found in the FormMethod enum
      encode - The form encoding. Usable values can be found in the FormEncoding enum
      language - The language code to be used by the form. If not specified, or null the default language will be used.
    • Form

      public Form(String id, String action, FormMethod method, FormEncoding encode, String language)
      Creates an empty form, with the specified action, encoding, method and language.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      action - The form action
      method - The form sending method. Usable ones can be found in the FormMethod enum
      encode - The form encoding. Usable values can be found in the FormEncoding enum
      language - The language code to be used by the form. If not specified, or null the default language will be used.
    • Form

      public Form(DataDescriptor dataDescriptor)
      Creates a form, based on the specified DataDescriptor. The form item components in the DataDescriptor columns, (which do not have the visibility of ColumnVisibleType.ONLY_LIST, ColumnVisibleType.LIST or ColumnVisibleType.HIDDEN) will be set to the form component. The type of form item is decided by the column's EditorType setting. Each form item has its parameters specified by the appropriate column of the DataDescriptor. The usable form item parameters are described in the description of the form item components. If the specified column cannot create a form item component, or if an error is encountered, the error will be logged in the server log.
      Parameters:
      dataDescriptor - The DataDescriptor
      See Also:
    • Form

      public Form(String id, DataDescriptor dataDescriptor)
      Creates a form, based on the specified DataDescriptor. The form item components in the DataDescriptor columns, (which do not have the visibility of ColumnVisibleType.ONLY_LIST, ColumnVisibleType.LIST or ColumnVisibleType.HIDDEN) will be set to the form component. The type of form item is decided by the column's EditorType setting. Each form item has its parameters specified by the appropriate column of the DataDescriptor. The usable form item parameters are described in the description of the form item components. If the specified column cannot create a form item component, or if an error is encountered, the error will be logged in the server log.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      dataDescriptor - The DataDescriptor
      See Also:
    • Form

      public Form(DataDescriptor dataDescriptor, String language)
      Creates a form, based on the specified DataDescriptor, with the specified language. The form item components in the DataDescriptor columns, (which do not have the visibility of ColumnVisibleType.ONLY_LIST, ColumnVisibleType.LIST or ColumnVisibleType.HIDDEN) will be set to the form component. The type of form item is decided by the column's EditorType setting. Each form item has its parameters specified by the appropriate column of the DataDescriptor. The usable form item parameters are described in the description of the form item components. If the specified column cannot create a form item component, or if an error is encountered, the error will be logged in the server log.
      Parameters:
      dataDescriptor - The DataDescriptor
      language - The language code to be used by the form. If not specified, or null the default language will be used.
      See Also:
    • Form

      public Form(String id, DataDescriptor dataDescriptor, String language)
      Creates a form, based on the specified DataDescriptor, with the specified language. The form item components in the DataDescriptor columns, (which do not have the visibility of ColumnVisibleType.ONLY_LIST, ColumnVisibleType.LIST or ColumnVisibleType.HIDDEN) will be set to the form component. The type of form item is decided by the column's EditorType setting. Each form item has its parameters specified by the appropriate column of the DataDescriptor. The usable form item parameters are described in the description of the form item components. If the specified column cannot create a form item component, or if an error is encountered, the error will be logged in the server log.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      dataDescriptor - The DataDescriptor
      language - The language code to be used by the form. If not specified, or null the default language will be used.
      See Also:
  • Method Details

    • setBuildType

      public final Form setBuildType(FormBuildType buildType)
      Sets the form builder class. By default, the form uses the DefaultFormBuilder class.
      Parameters:
      buildType - The builder type. Usable types: FormBuildType
      Returns:
      The form component
      See Also:
    • setBuildType

      public final Form setBuildType(FormBuildType buildType, FormBuilder builder)
      Sets the builder class, by specifiyng the builder class instance. If using a built-in builder, the class instance does not need to be specified, the method will ignore it. If using a cusotm implementation, then it must be set to CUSTOM, and the builder class instance must be specified.
      Parameters:
      buildType - The builder type. Usable types: FormBuildType. If using a custom implementation, this value must be FormBuildType.CUSTOM.
      builder - The form builder class instance. If using a built in builder, this parameter will be ignored (can be defined as null). If using a custom one, the builder instance must be specified. The class must implement the FormBuilder interface.
      Returns:
      The form component
      Throws:
      NullPointerException - AIf the builder type is CUSTOM, and the builder instance is null
      See Also:
    • setFormType

      public Form setFormType(FormType formType)
      Sets the form type. By default the FormType.HORIZONTAL type is used, meaning that the items are under each other.
      Parameters:
      formType - The form type. The usable types can be found in the FormType enum
      Returns:
      The form component
    • getFormType

      public FormType getFormType()
      Gets the form type.
      Returns:
      The form type, or null, if cannot be defined
    • getDataDescriptor

      public final DataDescriptor getDataDescriptor()
      Gets the form's DataDescriptor.
      Specified by:
      getDataDescriptor in interface BasedOnDataDescriptor<Form>
      Returns:
      The DataDescriptor instance, that is used to build the form or null, if no DataDescriptor is used
    • setDataDescriptor

      public final Form setDataDescriptor(DataDescriptor dataDescriptor)
      Sets the form's DataDescriptor. The form item components in the DataDescriptor columns, (which do not have the visibility of ColumnVisibleType.ONLY_LIST, ColumnVisibleType.LIST or ColumnVisibleType.HIDDEN) will be set to the form component. The type of form item is decided by the column's EditorType setting. Each form item has its parameters specified by the appropriate column of the DataDescriptor. The usable form item parameters are described in the description of the form item components. If the specified column cannot create a form item component, or if an error is encountered, the error will be logged in the server log.
      Specified by:
      setDataDescriptor in interface BasedOnDataDescriptor<Form>
      Parameters:
      dataDescriptor - The DataDescriptor instance
      Returns:
      The form component
      See Also:
    • setAction

      public final Form setAction(String action)
      Sets the form action
      Parameters:
      action - The form action
      Returns:
      The form component
    • getAction

      public final String getAction()
      Gets the form action
      Returns:
      The form action or null, if not specified
    • setFormEncode

      public final Form setFormEncode(FormEncoding encode)
      Sets the form encoding. The default encoding is FormEncoding.MULTIPART
      Parameters:
      encode - The form encoding. Usable values can be found in the FormEncoding enum
      Returns:
      The form component
    • getFormEncode

      public FormEncoding getFormEncode()
      Gets the form encoding.
      Returns:
      The form encoding or null if not set, or an encoding type that the framework does not recognize
    • setFormMethod

      public final Form setFormMethod(FormMethod method)
      Sets the form method. The default method is the FormMethod.POST
      Parameters:
      method - The form method. Applicable values can be found in the FormMethod enum
      Returns:
      The form component
    • getFormMethod

      public final FormMethod getFormMethod()
      Gets the form method
      Returns:
      The form method or null if not set, or is a type that the framework does not recognize
    • newRecord

      public final Form newRecord()

      Starts the editing of a new record in the form component.

      The method deletes all previous data from the form, and starts editing a new one. In this case, every form item value will revert to the default value, or if not specified, to an empty value. The form change handler (FormChangeHandler) is called, the parameter containing the changed form item will be null, and the record parameter will gain the empty record

      If the record editing is started like this, then when saving the form, the new record will also be in the database, with the content that the user specified.

      Returns:
      The form component
    • editRecord

      public Form editRecord(Record record)

      Starts the editing of the specified record in the form component.

      The method uses the specified record to load values in the form item components. The method will go through every form item, and if it finds an attribute, that corresponds to a form item name, it will give that form item the value from the attribute. If not found, the form item will have its default value set to it. If it does not have a default value, it will receive a null value.

      The form change handler (FormChangeHandler) is called, the parameter containing the changed form item will be null, and the record parameter will gain the edited record.

      If the record editing is started like this, then when saving the form, the edited record will also be edited the database, with the content that the user specified. If the specified record did not exist in the database, it will be added to it.

      Parameters:
      record - The record is to be edited
      Returns:
      The form component
      Throws:
      NullPointerException - If the record is null
    • getRecord

      public final Record getRecord()
      Gets the current state of the record that is being edited on the form
      Returns:
      The record being edited or null, if no record is being edited
    • setValue

      public Form setValue(String fieldName, Object value)
      Sets the value of a form item. The method sets the value of the form item that was specified. The new value will also be set in the form record. If the form item is not found, the value is only set in the record.
      Parameters:
      fieldName - The name of the field or form item.
      value - The new value to be set to the specified item or field. Must be in the correct format
      Returns:
      The form component
      Throws:
      NullPointerException - If the field name is null
    • setOriginalValue

      public Form setOriginalValue(String fieldName, Object value)
      Sets the original value of a form item. The item is specified by its name. If not found, the method won't do anything.
      Parameters:
      fieldName - The name of the form item
      value - The original value, in the format of the specified field
      Returns:
      The form component
    • getOriginalValue

      public Object getOriginalValue(String fieldName)
      Gets the original value of the specified form item. If not found, the method will look for the attribute with the same name in the record, and return its value.
      Parameters:
      fieldName - The name of the form item or field
      Returns:
      The original value. If the form item is not found, it will look for it in the record. If not found there either, or cannot be defined, it will return with null
    • getValue

      public Object getValue(String fieldName)
      Gets the actual value of a form item. The method will look for the specified form item first. If not found, it will look in the record, for the attribute with the specified name.
      Parameters:
      fieldName - The name of the form item or field
      Returns:
      The actual value. If the form item is not found, it will look for it in the record. If not found there either, or if it has a null value, it will return with null
    • getValueAsLong

      public Long getValueAsLong(String fieldName)
      Gets the value of a form item in a Long format. The method will look for the specified form item first. It will return the form item value, if it's a Number. If not, it will return with null. If the form item is not found, the method will look in the current record for an attribute of the specified name. If found, then it will return with its value, in a Long format, if it is a Number, or if it is a text value that can be converted into Long.
      Parameters:
      fieldName - The name of the form item or field.
      Returns:
      The specified form item's actual value as Long, or null if not found, or if its value is null
      Throws:
      ParseException - If no form item is found with the specified name, but an attribute in the record is found, but its value is not a Number or it can't be converted to Long
    • getValueAsString

      public String getValueAsString(String fieldName)
      Gets the value of a form item in a String format. The method will look for the specified form item first. It will return the form item value. If the form item is not found, the method will look in the current record for an attribute of the specified name. If found, then it will return with its value, in a String format. IF not found at all, it will return with null.
      Parameters:
      fieldName - The name of the form item or field.
      Returns:
      The specified form item's actual value as String, or null if not found, or if its value is null
    • getValueAsInteger

      public Integer getValueAsInteger(String fieldName)
      Gets the value of a form item in an Integer format. The method will look for the specified form item first. It will return the form item value, if it's a Number. If not, it will return with null. If the form item is not found, the method will look in the current record for an attribute of the specified name. If found, then it will return with its value, in an Integer format, if it is a Number, or if it is a text value that can be converted into Integer. If this also fails, it will return with an error
      Parameters:
      fieldName - The name of the form item or field.
      Returns:
      The specified form item's actual value as an Integer, or null if not found, or if its value is null
      Throws:
      ParseException - If no form item is found with the specified name, but an attribute in the record is found, but its value is not a Number or it can't be converted to Integer
    • getValueAsDouble

      public Double getValueAsDouble(String fieldName)
      Gets the value of a form item in a Double format. The method will look for the specified form item first. It will return the form item value, if it's a Number. If not, it will return with null. If the form item is not found, the method will look in the current record for an attribute of the specified name. If found, then it will return with its value, in a Double format, if it is a Number, or if it is a text value that can be converted into Double. If this also fails, it will return with an error
      Parameters:
      fieldName - The name of the form item or field.
      Returns:
      The specified form item's actual value as a Double, or null if not found, or if its value is null
      Throws:
      ParseException - If no form item is found with the specified name, but an attribute in the record is found, but its value is not a Number or it can't be converted to Double
    • getValueAsDate

      public Date getValueAsDate(String fieldName)
      Gets the value of a form item in a Date format. The method will look for the specified form item first. It will return the form item value, if it's a Date, if the value is a Date. If it is not, it will return with null. If the form item is not found, the method will look in the current record for an attribute of the specified name. If found, then it will return with its value, in a Date format, if it is a Date, or if it is a text value that can be converted into a Date. If this also fails, it will return with an error.
      Parameters:
      fieldName - The name of the form item or field.
      Returns:
      The specified form item's actual value as a Date, or null if not found, or if its value is null
      Throws:
      ParseException - If no form item is found with the specified name, but an attribute in the record is found, but its value is not a Date or it can't be converted to Date
    • getValueAsFloat

      public Float getValueAsFloat(String fieldName)
      Gets the value of a form item in a Float format. The method will look for the specified form item first. It will return the form item value, if it's a Number. If not, it will return with null. If the form item is not found, the method will look in the current record for an attribute of the specified name. If found, then it will return with its value, in a Float format, if it is a Number, or if it is a text value that can be converted into Float. If this also fails, it will return with an error
      Parameters:
      fieldName - The name of the form item or field.
      Returns:
      The specified form item's actual value as a Float, or null if not found, or if its value is null
      Throws:
      ParseException - If no form item is found with the specified name, but an attribute in the record is found, but its value is not a Number or it can't be converted to Float
    • getValueAsBoolean

      public Boolean getValueAsBoolean(String fieldName)
      Gets the value of a form item in a Boolean format.The method will look for the specified form item first. It will return the form item value, if it's a Boolean. If not, it will return with false. If the form item is not found, the method will look in the current record for an attribute of the specified name. If found, then it will return with its value, in a Boolean format, if it is a Boolean value. If it is not, the method will try to convert it, using the BooleanConverter.parseBoolean(Object) method. If no attribute with the specified name is found, it will return with null.
      Parameters:
      fieldName - The name of the form item or field.
      Returns:
      The specified form item's actual value as a Boolean, or null if not found
    • setFormValidator

      public final Form setFormValidator(FormValidator validator)
      Sets a custom form validator on the form component
      Parameters:
      validator - The instance of the custom form validator class. If null, the previously set validator will be deleted, and the default validator will be used. The default validator only checks for the mandatory fields being filled.
      Returns:
      The form component
    • isValid

      public boolean isValid()
      Determines the form content is valid. Uses the custom validator if one was specified, otherwise it will use the default one. If using the default validator, the form will be valid if the mandatory items are filled out (ie, they do not have If either mandatory item is null, then the form will be invalid.
      Returns:
      If true, the form is valid, otherwise false
    • getFormItem

      public final FormItem<?,?> getFormItem(String fieldName)
      Gets the specified form item component, specified by its name.
      Parameters:
      fieldName - The name of the form item
      Returns:
      The name with the specified name or null, if not found
    • getFieldNames

      public final List<String> getFieldNames()
      Gets the name of every form item on the form.
      Returns:
      A list of every form item that is on the form. If there are none, the list will be empty
    • submit

      public final Form submit()
      Submits the form
      Returns:
      The form component
    • save

      public Record save() throws SaveException, DataAccessException
      Saves the form's current state to the database
      Returns:
      The saved form. The returned record's automatically filled fields, and the fields that get their values from the sequence are filled out.
      Throws:
      SaveException - If the form has no DataDescriptor set, or if an error was encountered during the save
      DataAccessException - If the user has no rights to modify the data
    • save

      public Record save(Transaction transaction) throws SaveException, DataAccessException
      Saves the form within the specified database transaction
      Parameters:
      transaction - The opened database transaction
      Returns:
      The saved form. The returned record's automatically filled fields, and the fields that get their values from the sequence are filled out.
      Throws:
      SaveException - If the form has no DataDescriptor set, or if an error was encountered during the save
      DataAccessException - If the user has no rights to modify the data
    • rebuild

      public Form rebuild()
      Returns:
      The form component
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<Form>
      Returns:
      If the componentwas drawn, true, otherwise false
    • isModified

      public final boolean isModified()
      Determines if any of the form items were modified by the user
      Returns:
      If true, the items were modified, otherwise false
    • setFormChangeHandler

      public final Form setFormChangeHandler(FormChangeHandler handler)
      Sets the form change event handler implementation
      Parameters:
      handler - The form change event handler implementation
      Returns:
      The form component
    • recalcAutoCalculateFields

      public final Form recalcAutoCalculateFields()
      Recalculates the fields on the form. A filed will be recalculated, if it has a calculation implementation
      Returns:
      The form component
    • getFormItems

      public final List<FormItem<?,?>> getFormItems()
      Gets a list of every form item
      Returns:
      A list of every form item component. If there are none, the list will be empty
    • setLabelPosition

      public final Form setLabelPosition(FormItemLabelPosition position)
      Sets the label position of the form items. Applies to every form item label. The default position is the FormItemLabelPosition.LEFT, meaning it will be on the left side of the input field.
      Parameters:
      position - The form item label position. The usable values can be found in the FormItemLabelPosition enum. If null, the default one will be used
      Returns:
      The form component
    • getLabelPosition

      public final FormItemLabelPosition getLabelPosition()
      Gets the form item label position
      Returns:
      The form item label position
    • addComponent

      public Form addComponent(Component<?> component)
      Description copied from class: Component
      Adds the specified component as a subcomponent, and redraws the component immediately
      Overrides:
      addComponent in class Component<Form>
      Parameters:
      component - The component to be added
      Returns:
      The component
    • addBlock

      public final Form addBlock(String blockName, String blockTitle)
      Creates a form block on the form
      Parameters:
      blockName - The name of the block, must be unique within the form
      blockTitle - The title of the block. If null, no title will be displayed
      Returns:
      The form component
      Throws:
      NullPointerException - If the name is null
      UnsupportedOperationException - If the set builder class does not support blocks
    • getBlock

      public final FormBlock getBlock(String name)
      Gets the specified block, by using its name
      Parameters:
      name - The name of the block
      Returns:
      The block with the specified name or null, if not found
      Throws:
      UnsupportedOperationException - If the set builder class does not support blocks
    • addColumn

      public final Form addColumn(String columnName)
      Creates a form column on the form
      Parameters:
      columnName - The name of the column, must be unique within the form
      Returns:
      The form component
      Throws:
      NullPointerException - If the name is null
      UnsupportedOperationException - If the set builder class does not support columns
    • getColumn

      public final FormColumn getColumn(String columnName)
      Gets a column, specified by its name
      Parameters:
      columnName - The name of the column
      Returns:
      The column with the specified name or null, if not found
      Throws:
      UnsupportedOperationException - If the set builder class does not support columns
    • addTabPage

      public final Form addTabPage(String tabPageName, Icon icon, String title)
      Creates a tab page on the form
      Parameters:
      tabPageName - The name of the tab page, that must be unique within the form
      icon - The icon of the tab. The icons can be found in the Icon enum. If null, no icon will be used
      title - The title of the tab. If null, no title will be used
      Returns:
      The form component
      Throws:
      NullPointerException - If the name is null
      UnsupportedOperationException - If the set builder class does not support tabs
    • getTabPage

      public final TabPage getTabPage(String tabPageName)
      Gets a tab, specified by its name
      Parameters:
      tabPageName - The name of the tab
      Returns:
      The tab with the specified name or null, if not found
      Throws:
      UnsupportedOperationException - If the set builder class does not support tabs
    • setTabType

      public Form setTabType(TabType tabType)
      Sets the type of the tabs, that are used on the form. By default this is the TabType.DEFAULT type. This method only functions if the form has a builder class that supports the use of tabs
      Parameters:
      tabType - The tab type. The usable types can be found in the TabType enum
      Returns:
      The form component
    • setHierarchy

      public Form setHierarchy(ComplexBuilderHierarchy hierachy)
      Sets the builder hierarchy (used when using a complex form builder). The default hierarchy is the ComplexBuilderHierarchy.TAB_BLOCK_COLUMN.
      Parameters:
      hierachy - The hierarchy to be used by the form. The usable hierarchies can be found in the ComplexBuilderHierarchy enum. If null, the default hierarchy will be used.
      Returns:
      The form component
      Throws:
      UnsupportedOperationException - If the complex form builder is not used
    • removeAllComponents

      public Form removeAllComponents()
      Every component cannot be removed from the form
      Overrides:
      removeAllComponents in class Component<Form>
      Returns:
      The component
      Throws:
      UnsupportedOperationException - Every time the method is called