net.sf.click.extras.control
Class HtmlFieldSet

java.lang.Object
  extended bynet.sf.click.control.AbstractControl
      extended bynet.sf.click.control.Field
          extended bynet.sf.click.control.FieldSet
              extended bynet.sf.click.extras.control.HtmlFieldSet
All Implemented Interfaces:
Container, Control, Serializable

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.

Author:
Bob Schellink
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.click.control.FieldSet
columns, fieldWidths, legend, legendAttributes, showBorder
 
Fields inherited from class net.sf.click.control.Field
disabled, error, focus, form, help, label, readonly, required, tabindex, title, validate, value
 
Fields inherited from class net.sf.click.control.AbstractControl
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles
 
Fields inherited from interface net.sf.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 net.sf.click.control.FieldSet
add, add, contains, getColumns, getControl, getControlMap, getControls, getControlSizeEst, getField, getFieldList, getFields, getFieldWidths, getHtmlImports, getLegend, getLegendAttribute, getLegendAttributes, getShowBorder, getTag, hasControls, hasLegendAttributes, insert, isDisabled, isReadonly, onDestroy, onInit, onProcess, onRender, remove, remove, removeField, renderButtons, renderFields, setActionListener, setColumns, setDisabled, setForm, setLegend, setLegendAttribute, setListener, setReadonly, setShowBorder
 
Methods inherited from class net.sf.click.control.Field
bindRequestValue, getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isHidden, isRequired, isValid, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setHelp, setLabel, setParent, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setValue, setValueObject, setWidth, validate
 
Methods inherited from class net.sf.click.control.AbstractControl
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, onDeploy, registerActionEvent, removeStyleClass, 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 net.sf.click.Control
getContext, getId, getMessages, getName, getParent, onDeploy, 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.

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.

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().

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(net.sf.click.util.HtmlStringBuffer). The size of buffer is determined by FieldSet.getControlSizeEst().

Returns:
the HTML representation of this control
See Also:
Object.toString()

renderTagBegin

protected void renderTagBegin(String tagName,
                              HtmlStringBuffer buffer)
Parameters:
tagName - the name of the tag to render
buffer - the buffer to append the output to
See Also:
AbstractControl.renderTagBegin(java.lang.String, net.sf.click.util.HtmlStringBuffer)

renderTagEnd

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

renderContent

protected void renderContent(HtmlStringBuffer buffer)
Parameters:
buffer - the buffer to append the output to
See Also:
AbstractContainer.renderContent(net.sf.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()