Class ComplexFormBuilder
- All Implemented Interfaces:
BlockedForm
,ColumnedForm
,ComplexForm
,TabbedForm
,FormBuilder
Complex form builder class
With the use of this builder class, a complex form can be built. The form can have tabs, blocks and columns. The hierarchy of the items can also be set. The form items will always be displayed in the bottom level element of the hierarchy. The look of the form will depend on the hierarchy types, that can be the following:
ComplexBuilderHierarchy.TAB_BLOCK_COLUMN
This is the default display hierarchy. The tabs will be on the top-level, which means that there will be tab labels on the top, that the user can click on, to change tabs and their contents. By default, the first tab, and its contents, are displayed.
The next level is the blocks, which will have the width to fill out the tab. The columns will be within these blocks, also having the width, to fill out the block. The individual form items will be displayed in these columns, with the width of the columns, under each other.ComplexBuilderHierarchy.TAB_COLUMN_BLOCK
In this hierarchy, the tabs will be on the top-level, which means that there will be tab labels on the top, that the user can click on, to change tabs and their contents. By default, the first tab, and its contents, are displayed.
The next level is the column, which will have uniform width, so the columns together will have the width of the tab. The next level is the blocks, which will fill out the columns, and within the blocks, the form items will be displayed.ComplexBuilderHierarchy.BLOCK_COLUMN_TAB
In this hierarchy, the blocks will be on the top-level. The blocks will be under each other, with the width of the form. The columns will be within the blocks, having the width to fill out the block. The tabs will be within the columns, with the tab labels visible. The tabs will have the same width as the columns. The form items will be within the tabs, under each other.ComplexBuilderHierarchy.BLOCK_TAB_COLUMN
In this hierarchy, the blocks will be on the top level. The blocks will be under each other, with the width of the form. The tabs will be within the blocks, with the tab labels. The first tab and its contents are displayed. The tabs will have the width of the block. The next level is the column, which will have uniform width, so the columns together will have the width of the tab. The form items will be inside the columns, and they will have the width of the columns, under each other.ComplexBuilderHierarchy.COLUMN_BLOCK_TAB
In this hierarchy the columns will be on the top-level. The columns will have the width of the form, and they will fill out the form. The next level is the blocks, which will fill out the columns. The tabs will be within the blocks, with the tab labels. The first tab and its contents are displayed. The tabs will have the width of the block. The form items will be within the tabs, under each other.ComplexBuilderHierarchy.COLUMN_TAB_BLOCK
In this hierarchy the columns will be on the top-level. The columns will have the width of the form, and they will fill out the form. The tabs will be within the columns, with the tab labels visible. The tabs will have the same width as the columns. The next level is the blocks, which will fill out the columns, and within the blocks, the form items will be displayed.
The tabs, columns and blocks that are to be used must be created, through the form component, before it is drawn, by using the Form.addTabPage(String, Icon, String)
,
Form.addBlock(String, String)
or Form.addColumn(String)
methods.
For the form to be displayed properly, the items must be parameterized correctly, by specifying their placements. This can be done by specifying it directly through code using the form item parameters, or by using the DataDescriptor column's column parameters. These parameters must be specified, so that the form items can be displayed.
MetaParamName.TAB_NAME
- Name of the tab where the form item is to be displayedMetaParamName.BLOCK_NAME
- Name of the block where the form item is to be displayedMetaParamName.FORM_COLUMN
- Name of the column where the form item is to be displayed
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
Fields inherited from interface com.jbstrap.ui.components.form.builders.interfaces.BlockedForm
UNNAMED_BLOCK
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionComponent<?>
Builds a formfinal FormBlock
createBlock
(String name, String title) Creates a form block component, with the specified name and titlefinal FormColumn
createColumn
(String name) Creates a column with the specified namefinal TabPage
createTabpage
(String name, Icon icon, String title) Creates a tab page, with the specified name, icon and labelGets the block component, specified by its nameGets the column component, specified by its nameGets the hierarchy used by the form buildergetTabpage
(String name) Gets the tab page component, specified by its namevoid
setHierarchy
(ComplexBuilderHierarchy hierachia) Sets the hierarchy to be used by the form.void
setTabType
(TabType tabType) Sets the tab type to be used on the form.
-
Constructor Details
-
ComplexFormBuilder
public ComplexFormBuilder()
-
-
Method Details
-
createTabpage
Creates a tab page, with the specified name, icon and label- Specified by:
createTabpage
in interfaceTabbedForm
- Parameters:
name
- The name of the tab, must be unique within the formicon
- The tab icon. The usable icons can be found in theIcon
enum. Ifnull
, no icon will be used.title
- The tab title. Ifnull
, none will be used.- Returns:
- The created component
- Throws:
NullPointerException
- If the name isnull
-
getTabpage
Gets the tab page component, specified by its name- Specified by:
getTabpage
in interfaceTabbedForm
- Parameters:
name
- The name of the tab- Returns:
- The tabpage with the specified name or
null
, if not found
-
createBlock
Creates a form block component, with the specified name and title- Specified by:
createBlock
in interfaceBlockedForm
- Parameters:
name
- The name of the block, must be unique within the formtitle
- The title of form block. Ifnull
, no title will be used- Returns:
- The created form block component
- Throws:
NullPointerException
- If the name isnull
-
getBlock
Gets the block component, specified by its name- Specified by:
getBlock
in interfaceBlockedForm
- Parameters:
name
- The name of the block- Returns:
- The block with the specified name or
null
, if not found
-
createColumn
Creates a column with the specified name- Specified by:
createColumn
in interfaceColumnedForm
- Parameters:
name
- The name of the column, must be unique within the form- Returns:
- The created form column component
- Throws:
NullPointerException
- If the name isnull
-
getColumn
Gets the column component, specified by its name- Specified by:
getColumn
in interfaceColumnedForm
- Parameters:
name
- The name of the column- Returns:
- The column with the specified name or
null
if not found
-
setTabType
Sets the tab type to be used on the form. By default theTabType.DEFAULT
type is used- Specified by:
setTabType
in interfaceTabbedForm
- Parameters:
tabType
- The tab type. The usable types can be found in theTabType
enum
-
setHierarchy
Sets the hierarchy to be used by the form. The default hierarchy is theComplexBuilderHierarchy.TAB_BLOCK_COLUMN
.- Specified by:
setHierarchy
in interfaceComplexForm
- Parameters:
hierachia
- The hierarchy type to be used. The usable types can be found in theComplexBuilderHierarchy
enum
-
getHierarchy
Gets the hierarchy used by the form builder- Specified by:
getHierarchy
in interfaceComplexForm
- Returns:
- The hierarchy type
-
buildForm
Description copied from interface:FormBuilder
Builds a form- Specified by:
buildForm
in interfaceFormBuilder
- Parameters:
formItems
- A list containing the form items- Returns:
- The built form content
-