to.etc.domui.component.form
Class HorizontalFormBuilder

java.lang.Object
  extended by to.etc.domui.component.form.FormBuilderBase
      extended by to.etc.domui.component.form.GenericFormBuilder
          extended by to.etc.domui.component.form.GenericTableFormBuilder
              extended by to.etc.domui.component.form.HorizontalFormBuilder

public class HorizontalFormBuilder
extends GenericTableFormBuilder

EXPERIMENTAL UNSTABLE INTERFACE This builder helps with constructing horizontally-oriented forms, where input fields are put next to each other with their labels on top of each other. This is a replacement for TabularFormBuilder doing much of the same work but generating a different layout.

Author:
Frits Jalvingh Created on Aug 13, 2009

Field Summary
 
Fields inherited from class to.etc.domui.component.form.FormBuilderBase
LOG
 
Constructor Summary
HorizontalFormBuilder()
          Uninitialized form builder.
HorizontalFormBuilder(java.lang.Class<T> clz, IReadOnlyModel<T> mdl)
          Create a form builder using a lazy model and a current type.
HorizontalFormBuilder(T instance)
          Create a form builder to edit the specified, immutable instance (meaning the instance is immutable, not it's properties).
 
Method Summary
 TD addCell()
          Add a new cell to the last-used row.
 TD addCell(int colSpan, int rowSpan)
           
 TD addCell(java.lang.String css, int colSpan, int rowSpan)
           
 void addContent(NodeBase label, NodeBase[] control, boolean editable)
           
protected  void addControl(NodeBase label, NodeBase labelnode, NodeBase[] list, boolean mandatory, boolean editable, PropertyMetaModel<?> pmm)
           
protected  void addControl(java.lang.String label, NodeBase labelnode, NodeBase[] list, boolean mandatory, boolean editable, PropertyMetaModel<?> pmm)
          This is the actual workhorse doing the per-builder actual placement and layouting of a {control, label} pair.
protected  IControl<?>[] addListOfProperties(boolean editable, java.lang.String... names)
          Handle placement of a list of property names, all obeying the current mode in effect.
 HorizontalFormBuilder colSpan(int x)
          Set the colspan for both label and control for all controls added after this call.
 HorizontalFormBuilder controlClass(java.lang.String controlClass)
           
 HorizontalFormBuilder controlColSpan(int x)
          Set the colspan for only the control for all controls added after this call.
 HorizontalFormBuilder controlNowrap()
           
 HorizontalFormBuilder controlRowSpan(int x)
          Set the rowspan for only the control for all controls added after this call.
 HorizontalFormBuilder controlWidth(java.lang.String s)
           
 HorizontalFormBuilder defaultControlClass(java.lang.String defaultControlClass)
           
 HorizontalFormBuilder defaultLabelClass(java.lang.String defaultLabelClass)
           
 NodeContainer finish()
          This finishes off the current table by calculating colspans for all skewed rows.
 void finish(NodeContainer target)
           
 void finish(NodeContainer target, boolean balance)
          Adds the generated tables/table to the target specified.
 TR getEditRow()
           
 TR getLabelRow()
           
protected  void internalClearLocation()
          Called when a new table, body or whatever is made current; it should reset all known positioning information.
 HorizontalFormBuilder labelClass(java.lang.String labelClass)
           
 HorizontalFormBuilder labelColSpan(int x)
          Set the colspan for only the label for all controls added after this call.
 HorizontalFormBuilder labelNowrap()
           
 HorizontalFormBuilder labelRowSpan(int x)
          Set the rowspan for only the label for all controls added after this call.
 HorizontalFormBuilder labelWidth(java.lang.String s)
           
 void nl()
          Start a new row of input fields.
 HorizontalFormBuilder nowrap()
           
protected  void onTableAdded(Table t)
          Called when a new table is added.
 HorizontalFormBuilder rowSpan(int x)
          Set the rowspan for both label and control for all controls added after this call.
 HorizontalFormBuilder tablePerForm()
           
 HorizontalFormBuilder tablePerRow()
           
 HorizontalFormBuilder width(java.lang.String s)
           
 
Methods inherited from class to.etc.domui.component.form.GenericTableFormBuilder
addCell, addRow, addRowAndCell, addRowAndCell, getLastUsedRow, getTable, getTBody, newBody, onBodyAdded, onRowAdded, 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

HorizontalFormBuilder

public HorizontalFormBuilder()
Uninitialized form builder.


HorizontalFormBuilder

public HorizontalFormBuilder(java.lang.Class<T> clz,
                             IReadOnlyModel<T> mdl)
Create a form builder using a lazy model and a current type.

Type Parameters:
T -
Parameters:
clz -
mdl -

HorizontalFormBuilder

public HorizontalFormBuilder(T instance)
Create a form builder to edit the specified, immutable instance (meaning the instance is immutable, not it's properties).

Type Parameters:
T -
Parameters:
instance -
Method Detail

addCell

public TD addCell()
Description copied from class: GenericTableFormBuilder
Add a new cell to the last-used row.

Overrides:
addCell in class GenericTableFormBuilder
Returns:
See Also:
GenericTableFormBuilder.addCell()

addCell

public TD addCell(int colSpan,
                  int rowSpan)

addCell

public TD addCell(java.lang.String css,
                  int colSpan,
                  int rowSpan)

getLabelRow

public TR getLabelRow()
Returns:

getEditRow

public TR getEditRow()

addControl

protected void addControl(java.lang.String label,
                          NodeBase labelnode,
                          NodeBase[] list,
                          boolean mandatory,
                          boolean editable,
                          PropertyMetaModel<?> pmm)
Description copied from class: GenericFormBuilder
This is the actual workhorse doing the per-builder actual placement and layouting of a {control, label} pair.

Specified by:
addControl in class GenericFormBuilder
mandatory - T when the node is mandatory, needed by the label factory
editable - T when the node is editable, needed by the label factory
See Also:
to.etc.domui.component.form.GenericFormBuilder#addControl(java.lang.String, to.etc.domui.dom.html.NodeBase, to.etc.domui.dom.html.NodeBase[], boolean, to.etc.domui.component.meta.PropertyMetaModel)

addControl

protected void addControl(NodeBase label,
                          NodeBase labelnode,
                          NodeBase[] list,
                          boolean mandatory,
                          boolean editable,
                          PropertyMetaModel<?> pmm)
Specified by:
addControl in class GenericFormBuilder

addContent

public void addContent(NodeBase label,
                       NodeBase[] control,
                       boolean editable)
Specified by:
addContent in class GenericFormBuilder

addListOfProperties

protected IControl<?>[] addListOfProperties(boolean editable,
                                            java.lang.String... names)
Description copied from class: GenericFormBuilder
Handle placement of a list of property names, all obeying the current mode in effect.

Specified by:
addListOfProperties in class GenericFormBuilder

onTableAdded

protected void onTableAdded(Table t)
Description copied from class: GenericTableFormBuilder
Called when a new table is added.

Overrides:
onTableAdded in class GenericTableFormBuilder

internalClearLocation

protected void internalClearLocation()
Description copied from class: GenericTableFormBuilder
Called when a new table, body or whatever is made current; it should reset all known positioning information.

Overrides:
internalClearLocation in class GenericTableFormBuilder

nl

public void nl()
Start a new row of input fields.


finish

public NodeContainer finish()
This finishes off the current table by calculating colspans for all skewed rows. This discards the current table!

Overrides:
finish in class GenericTableFormBuilder
Returns:

finish

public void finish(NodeContainer target)

finish

public void finish(NodeContainer target,
                   boolean balance)
Adds the generated tables/table to the target specified.

Parameters:
target -

colSpan

public HorizontalFormBuilder colSpan(int x)
Set the colspan for both label and control for all controls added after this call.

Parameters:
x -
Returns:

rowSpan

public HorizontalFormBuilder rowSpan(int x)
Set the rowspan for both label and control for all controls added after this call.

Parameters:
x -
Returns:

labelColSpan

public HorizontalFormBuilder labelColSpan(int x)
Set the colspan for only the label for all controls added after this call.

Parameters:
x -
Returns:

labelRowSpan

public HorizontalFormBuilder labelRowSpan(int x)
Set the rowspan for only the label for all controls added after this call.

Parameters:
x -
Returns:

controlColSpan

public HorizontalFormBuilder controlColSpan(int x)
Set the colspan for only the control for all controls added after this call.

Parameters:
x -
Returns:

controlRowSpan

public HorizontalFormBuilder controlRowSpan(int x)
Set the rowspan for only the control for all controls added after this call.

Parameters:
x -
Returns:

defaultLabelClass

public HorizontalFormBuilder defaultLabelClass(java.lang.String defaultLabelClass)

defaultControlClass

public HorizontalFormBuilder defaultControlClass(java.lang.String defaultControlClass)

labelClass

public HorizontalFormBuilder labelClass(java.lang.String labelClass)

controlClass

public HorizontalFormBuilder controlClass(java.lang.String controlClass)

tablePerRow

public HorizontalFormBuilder tablePerRow()

tablePerForm

public HorizontalFormBuilder tablePerForm()

labelWidth

public HorizontalFormBuilder labelWidth(java.lang.String s)

controlWidth

public HorizontalFormBuilder controlWidth(java.lang.String s)

labelNowrap

public HorizontalFormBuilder labelNowrap()

controlNowrap

public HorizontalFormBuilder controlNowrap()

nowrap

public HorizontalFormBuilder nowrap()

width

public HorizontalFormBuilder width(java.lang.String s)