Class BlockedFormBuilder

java.lang.Object
com.jbstrap.ui.components.form.builders.BlockedFormBuilder
All Implemented Interfaces:
BlockedForm, FormBuilder

public class BlockedFormBuilder extends Object implements FormBuilder, BlockedForm

Blocked form builder class

This class builds blocked forms. This means that the form items will be placed into blocks. The blocks will be placed under each other, in the order they were added to the form. A title is displayed on the top of the blocks. Under the title, the form items will be placed. They will have the width of the block.

The individual blocks can be created through the form component, by using the Form.addBlock(String, String) method. Form items can be added to the blocks with the use of parameters. The parameters can be specified through code, directly for the form item component, or through a DataDescriptor column, by using the MetaParamName.BLOCK_NAME parameter.

If the form has a form item that is not assigned to the block, the form item is displayed in a separate block, with the title "Unnamed".

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

    • BlockedFormBuilder

      public BlockedFormBuilder()
      Creates a blocked form builder class
  • Method Details

    • createBlock

      public final FormBlock createBlock(String name, String title)
      Creates a form block with the specified name
      Specified by:
      createBlock in interface BlockedForm
      Parameters:
      name - The name of the form block, has to be unique within the form component
      title - The form title. If null, no title will be used
      Returns:
      The created form block component
      Throws:
      NullPointerException - If the name is null
    • buildForm

      public Component<?> buildForm(List<FormItem<?,?>> formItems)
      Description copied from interface: FormBuilder
      Builds a form
      Specified by:
      buildForm in interface FormBuilder
      Parameters:
      formItems - A list containing the form items
      Returns:
      The built form content
    • getBlock

      public FormBlock getBlock(String name)
      Gets the block, specified by its name
      Specified by:
      getBlock in interface BlockedForm
      Parameters:
      name - The name of the block
      Returns:
      The form block that has the specified name, or null, if not found