org.apache.click.extras.control
Class HtmlFieldSet

java.lang.Object
  extended by org.apache.click.control.AbstractControl
      extended by org.apache.click.control.Field
          extended by org.apache.click.control.FieldSet
              extended by org.apache.click.extras.control.HtmlFieldSet
All Implemented Interfaces:
Serializable, Control, Container, Stateful

public class HtmlFieldSet
extends FieldSet

Provides an HTML FieldSet container to create composite based fieldsets:   <fieldset>.

FieldSet uses an HTML Table to layout its fields and controls. HtmlFieldSet on the other hand does not provide a layout and instead relies on the developer to compose a layout programmatically.

This allows developers to provide a more flexible and CSS friendly layout.

You can read more about programmatic layout here.

Also see this example of how HtmlFieldSet is used to provide a custom layout.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.click.control.FieldSet
columns, controlMap, controls, fieldList, fieldWidths, legend, legendAttributes, showBorder
 
Fields inherited from class org.apache.click.control.Field
disabled, error, focus, form, help, label, labelStyle, labelStyleClass, parentStyleClassHint, parentStyleHint, readonly, required, tabindex, title, trim, validate, value
 
Fields inherited from class org.apache.click.control.AbstractControl
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles
 
Fields inherited from interface org.apache.click.Control
CONTROL_MESSAGES
 
Constructor Summary
HtmlFieldSet()
          Create a HtmlFieldSet with no name defined.
HtmlFieldSet(String name)
          Create a HtmlFieldSet with the given name.
HtmlFieldSet(String name, String legend)
          Create a HtmlFieldSet with the given name and legend.
 
Method Summary
 Control add(Control control, int width)
          This method is not supported and throws an UnsupportedOperationException if invoked.
 Field add(Field field, int width)
          This method is not supported and throws an UnsupportedOperationException if invoked.
 void render(HtmlStringBuffer buffer)
          Render the HTML representation of the FieldSet.
protected  void renderChildren(HtmlStringBuffer buffer)
          Render this fieldset children to the specified buffer.
protected  void renderContent(HtmlStringBuffer buffer)
           
protected  void renderTagBegin(String tagName, HtmlStringBuffer buffer)
           
protected  void renderTagEnd(String tagName, HtmlStringBuffer buffer)
           
 String toString()
          Returns the HTML representation of the FieldSet.
 
Methods inherited from class org.apache.click.control.FieldSet
add, add, contains, getColumns, getControl, getControlMap, getControls, getControlSizeEst, getField, getFieldList, getFields, getFieldWidths, getLegend, getLegendAttribute, getLegendAttributes, getShowBorder, getState, getTag, hasControls, hasLegendAttributes, insert, isDisabled, isReadonly, onDestroy, onInit, onProcess, onRender, remove, remove, removeField, removeState, renderButtons, renderFields, replace, restoreState, saveState, setColumns, setDisabled, setForm, setLegend, setLegendAttribute, setReadonly, setShowBorder, setState
 
Methods inherited from class org.apache.click.control.Field
bindRequestValue, getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isHidden, isRequired, isTrim, isValid, setError, setErrorMessage, setErrorMessage, setFocus, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setRequired, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth, validate
 
Methods inherited from class org.apache.click.control.AbstractControl
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, removeBehavior, removeStyleClass, setActionListener, setAttribute, setId, setName, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.click.Control
getBehaviors, getContext, getHeadElements, getId, getMessages, getName, getParent, hasBehaviors, isAjaxTarget, onDeploy, setListener, setName, setParent
 

Constructor Detail

HtmlFieldSet

public HtmlFieldSet(String name)
Create a HtmlFieldSet with the given name.

Parameters:
name - the fieldset name element value

HtmlFieldSet

public HtmlFieldSet(String name,
                    String legend)
Create a HtmlFieldSet with the given name and legend.

Parameters:
name - the fieldset name
legend - the fieldset legend element value

HtmlFieldSet

public HtmlFieldSet()
Create a HtmlFieldSet with no name defined.

Please note the control's name must be defined before it is valid.

Method Detail

add

public Field add(Field field,
                 int width)
This method is not supported and throws an UnsupportedOperationException if invoked.

Overrides:
add in class FieldSet
Parameters:
field - the field to add to the fieldSet
width - the width of the field in table columns
Returns:
the field added to this fieldSet
Throws:
UnsupportedOperationException - if invoked

add

public Control add(Control control,
                   int width)
This method is not supported and throws an UnsupportedOperationException if invoked.

Overrides:
add in class FieldSet
Parameters:
control - the control to add to the fieldSet
width - the width of the control in table columns
Returns:
the control added to this fieldSet
Throws:
UnsupportedOperationException - if invoked

render

public void render(HtmlStringBuffer buffer)
Render the HTML representation of the FieldSet.

The size of buffer is determined by FieldSet.getControlSizeEst().

Specified by:
render in interface Control
Overrides:
render in class FieldSet
Parameters:
buffer - the specified buffer to render the control's output to

toString

public String toString()
Returns the HTML representation of the FieldSet.

The rendering of the FieldSet is delegated to render(org.apache.click.util.HtmlStringBuffer). The size of buffer is determined by FieldSet.getControlSizeEst().

Overrides:
toString in class FieldSet
Returns:
the HTML representation of this control
See Also:
Object.toString()

renderTagBegin

protected void renderTagBegin(String tagName,
                              HtmlStringBuffer buffer)
Overrides:
renderTagBegin in class Field
Parameters:
tagName - the name of the tag to render
buffer - the buffer to append the output to
See Also:
AbstractControl.renderTagBegin(java.lang.String, org.apache.click.util.HtmlStringBuffer)

renderTagEnd

protected void renderTagEnd(String tagName,
                            HtmlStringBuffer buffer)
Overrides:
renderTagEnd in class AbstractControl
Parameters:
tagName - the name of the tag to close
buffer - the buffer to append the output to
See Also:
AbstractControl.renderTagEnd(java.lang.String, org.apache.click.util.HtmlStringBuffer).

renderContent

protected void renderContent(HtmlStringBuffer buffer)
Parameters:
buffer - the buffer to append the output to
See Also:
AbstractContainer.renderContent(org.apache.click.util.HtmlStringBuffer)

renderChildren

protected void renderChildren(HtmlStringBuffer buffer)
Render this fieldset children to the specified buffer.

Parameters:
buffer - the buffer to append the output to
See Also:
FieldSet.getControls()