|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectto.etc.domui.component.form.FormBuilderBase
to.etc.domui.component.form.GenericFormBuilder
to.etc.domui.component.form.GenericTableFormBuilder
to.etc.domui.component.form.TabularFormBuilder
public class TabularFormBuilder
This is a helper class to generate tabular forms. It lays out the form by creating a table and adding labels and input controls in separate table cells in a row. If nothing else is done this creates a form in the layout of:
First name | |
Last name | |
Address |
ModelBindings
instance containing the bindings of the
created components to their class instance and properties. After use you can discard the FormBuilder,
provided you retain the bindings if you need them.
A formbuilder is highly stateful during use.
There are ways to play around with the layout by using format directives before fields are added. Usually layout directives take effect for the next control that is added. There are two kinds of layout directives. Permanent ones change the settting, well, permanently until it is explicitly changed again. Permanent layout directives start with "set" in the call. There are also temporary layout directives, these have no "set" in their name. These take effect for the next the control or the next run of controls if they are added with a single call to the form builder, for instance using addProps(String... names). When the control or controls are added the layout directive returns to it's default setting.
Field Summary |
---|
Fields inherited from class to.etc.domui.component.form.FormBuilderBase |
---|
LOG |
Constructor Summary | |
---|---|
TabularFormBuilder()
|
|
TabularFormBuilder(java.lang.Class<T> clz,
IReadOnlyModel<T> mdl)
|
|
TabularFormBuilder(T instance)
|
Method Summary | |
---|---|
void |
addContent(NodeBase label,
NodeBase[] control,
boolean editable)
|
void |
addControl(NodeBase label,
NodeBase labelnode,
NodeBase[] list,
boolean mandatory,
boolean editable,
PropertyMetaModel<?> pmm)
|
void |
addControl(java.lang.String label,
NodeBase labelnode,
NodeBase[] list,
boolean mandatory,
boolean editable,
PropertyMetaModel<?> pmm)
Adds a control plus a label at the current location. |
protected IControl<?>[] |
addListOfProperties(boolean editable,
java.lang.String... names)
Handle placement of a list of property names, all obeying the current mode in effect. |
TabularFormBuilder |
append()
Append the next field, then return to the current mode. |
TabularFormBuilder |
col(int x)
Add the next fields in a set to the specified column. |
TabularFormBuilder |
colspan(int cells)
Sets the colspan for the next component set. |
NodeContainer |
finish()
Reset variables after finish. |
TabularFormBuilder |
into()
Add the next pair into the last cell of the last row added, then return to the current mode. |
TabularFormBuilder |
into(java.lang.String separator)
Add the next pair into the last cell of the last row added using the specified string to separate them, then return to the current mode. |
protected void |
modeAddAppend(NodeBase l,
NodeBase[] c,
boolean editable)
This "appends" the new set to the "current" row. |
protected void |
modeAddNormal(NodeBase l,
NodeBase[] c,
boolean editable)
Adds a node normally. |
protected void |
modeAppendInto(NodeBase l,
NodeBase[] c,
boolean editable)
Appends the control to the last cell of the last row used. |
TabularFormBuilder |
norm()
Add the next field in "normal" mode, then return to the current mode. |
TabularFormBuilder |
setCol(int x)
Make column(x) the "current" column where things are added to, until another call is done. |
void |
setModeAppend()
|
void |
setModeAppendInto()
|
void |
setModeAppendInto(java.lang.String sepa)
|
void |
setModeNorm()
Sets the default mode to NORMAL, causing each field to occupy it's own row containing 2 cells for label and input control. |
Methods inherited from class to.etc.domui.component.form.GenericTableFormBuilder |
---|
addCell, addCell, addRow, addRowAndCell, addRowAndCell, getLastUsedRow, getTable, getTBody, internalClearLocation, newBody, onBodyAdded, onRowAdded, onTableAdded, reset, row, selectRow, setLastUsedCell, setLastUsedRow, setTable, setTBody, table, tbody |
Methods inherited from class to.etc.domui.component.form.GenericFormBuilder |
---|
addContent, addContent, addDisplayProp, addDisplayProp, addDisplayProp, addDisplayProps, addLabelAndControl, addLabelAndControl, addProp, addProp, addProp, addProp, addProp, addProp, addProp, addPropertyAndControl, addPropertyControl, addProps |
Methods inherited from class to.etc.domui.component.form.FormBuilderBase |
---|
createControlFor, createControlFor, getBindings, getBuilder, getClassMeta, getContext, getControlLabelFactory, getCurrentInputClass, getModel, resolveProperty, rights, setBindings, setClassModel, setContext, setControlLabelFactory, setInstance, setMetaModel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TabularFormBuilder()
public TabularFormBuilder(java.lang.Class<T> clz, IReadOnlyModel<T> mdl)
public TabularFormBuilder(T instance)
Method Detail |
---|
public NodeContainer finish()
finish
in class GenericTableFormBuilder
protected IControl<?>[] addListOfProperties(boolean editable, java.lang.String... names)
addListOfProperties
in class GenericFormBuilder
public void addControl(java.lang.String label, NodeBase labelnode, NodeBase[] list, boolean mandatory, boolean editable, PropertyMetaModel<?> pmm)
addControl
in class GenericFormBuilder
label
- labelnode
- The node to connect the Label to (for=)mandatory
- editable
- T when the node is editable, needed by the label factorypublic void addControl(NodeBase label, NodeBase labelnode, NodeBase[] list, boolean mandatory, boolean editable, PropertyMetaModel<?> pmm)
addControl
in class GenericFormBuilder
public void addContent(NodeBase label, NodeBase[] control, boolean editable)
addContent
in class GenericFormBuilder
public TabularFormBuilder norm()
public TabularFormBuilder append()
public TabularFormBuilder into()
public TabularFormBuilder into(java.lang.String separator)
public TabularFormBuilder col(int x)
x
-
public TabularFormBuilder setCol(int x)
x
-
public TabularFormBuilder colspan(int cells)
cells
-
public void setModeNorm()
public void setModeAppend()
public void setModeAppendInto()
public void setModeAppendInto(java.lang.String sepa)
protected void modeAddNormal(NodeBase l, NodeBase[] c, boolean editable)
l
- c
- protected void modeAddAppend(NodeBase l, NodeBase[] c, boolean editable)
l
- c
- protected void modeAppendInto(NodeBase l, NodeBase[] c, boolean editable)
l
- c
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |