Class TabbedFormBuilder

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

public class TabbedFormBuilder extends Object implements FormBuilder, TabbedForm

Tabpage based form builder class

With the use of the builder class, a form can be created, in which the individual form items will be placed in individual tabs. The tab labels will be on the top of the form, lined up. By default the first tab will be chosen, and its form items will be displayed. If the users chooses another tab, then the currently displayed form items will disappear, and the items form the newly selected tab will be displayed. The tab pages will be displayed in the full width of the form. The individual items will also have the width of the tab, and they will be under each other.

The tabs can be created through the form component, by using the Form.addTabPage(String, Icon, String) method. The individual form items can be added through parameters. The parameter can be specified through code, directly to the component, or through a DataDescriptor column, by specifying the MetaParamName.TAB_NAME parameter.

Author:
JBStrap
See Also:
  • Constructor Details

    • TabbedFormBuilder

      public TabbedFormBuilder()
  • Method Details

    • createTabpage

      public final TabPage createTabpage(String name, Icon icon, String title)
      Creates a tabpage on the form, with the specified name, icon and title.
      Specified by:
      createTabpage in interface TabbedForm
      Parameters:
      name - The name of the tab, must be unique within the form
      icon - The tab icon. The usable icons can be found in the Icon enum. If null, no icon will be used.
      title - The tab title. If null, none will be used.
      Returns:
      The created 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
    • getTabpage

      public TabPage getTabpage(String name)
      Gets a tab page component, specified by its name
      Specified by:
      getTabpage in interface TabbedForm
      Parameters:
      name - The name of the tab page to be queried
      Returns:
      The corresponding tab page, or null, if not found
    • setTabType

      public void setTabType(TabType tabType)
      Sets the type of the tabs. By default the TabType.DEFAULT type is used.
      Specified by:
      setTabType in interface TabbedForm
      Parameters:
      tabType - The type to be used. Usable types can be found in the TabType enum.