net.sf.click.extras.control
Class HtmlForm

java.lang.Object
  extended bynet.sf.click.control.AbstractControl
      extended bynet.sf.click.control.AbstractContainer
          extended bynet.sf.click.control.Form
              extended bynet.sf.click.extras.control.HtmlForm
All Implemented Interfaces:
Container, Control, Serializable

public class HtmlForm
extends Form

Provides an HTML Form control to create composite based forms:   <form method='post'>.

Form uses an HTML Table to layout its fields and controls. HtmlForm 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 HtmlForm is used to provide a custom layout.

Please note, for most cases Form is the better option as it provides automatic layout and error reporting.

Author:
Bob Schellink
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.click.control.Form
actionURL, ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, buttonAlign, buttonList, buttonStyle, columns, defaultFieldSize, disabled, enctype, error, errorsAlign, errorsPosition, errorsStyle, fieldList, fieldStyle, fieldWidths, FOCUS_JAVASCRIPT, FORM_NAME, HTML_IMPORTS, javaScriptValidation, labelAlign, labelsPosition, labelStyle, method, MULTIPART_FORM_DATA, POSITION_BOTTOM, POSITION_LEFT, POSITION_MIDDLE, POSITION_TOP, readonly, SUBMIT_CHECK, validate
 
Fields inherited from class net.sf.click.control.AbstractContainer
controlMap, controls
 
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
HtmlForm()
          Create an html form with no name.
HtmlForm(String name)
          Create an html form with the given name.
 
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.
protected  int getFormSizeEst(List formFields)
           
 boolean onProcess()
           
 void render(HtmlStringBuffer buffer)
          Render the HTML representation of the form and all its child controls to the specified buffer.
protected  void renderChildren(HtmlStringBuffer buffer)
           
protected  void renderContent(HtmlStringBuffer buffer)
           
protected  void renderTagBegin(String tagName, HtmlStringBuffer buffer)
           
 
Methods inherited from class net.sf.click.control.Form
add, add, clearErrors, clearValues, copyFrom, copyFrom, copyTo, copyTo, endTag, getActionURL, getButtonAlign, getButtonList, getButtonStyle, getColumns, getControlSizeEst, getDefaultFieldSize, getEnctype, getError, getErrorFields, getErrorsAlign, getErrorsPosition, getErrorsStyle, getField, getFieldList, getFields, getFieldStyle, getFieldValue, getFieldWidths, getHtmlImports, getJavaScriptValidation, getLabelAlign, getLabelsPosition, getLabelStyle, getMethod, getTag, getValidate, hasPostError, insert, isDisabled, isFormSubmission, isReadonly, isValid, onDestroy, onSubmitCheck, onSubmitCheck, onSubmitCheck, performSubmitCheck, remove, removeField, removeFields, renderButtons, renderControls, renderErrors, renderFields, renderFocusJavaScript, renderHeader, renderTagEnd, renderValidationJavaScript, setActionURL, setButtonAlign, setButtonStyle, setColumns, setDefaultFieldSize, setDisabled, setEnctype, setError, setErrorsAlign, setErrorsPosition, setErrorsStyle, setFieldStyle, setJavaScriptValidation, setLabelAlign, setLabelsPosition, setLabelStyle, setListener, setMethod, setName, setReadonly, setValidate, startTag, validate
 
Methods inherited from class net.sf.click.control.AbstractContainer
contains, getControl, getControlMap, getControls, hasControls, onInit, onRender, renderTagEnd, toString
 
Methods inherited from class net.sf.click.control.AbstractControl
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getId, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, onDeploy, registerActionEvent, removeStyleClass, setActionListener, setAttribute, setId, setParent, 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, setParent
 

Constructor Detail

HtmlForm

public HtmlForm(String name)
Create an html form with the given name.

Parameters:
name - the name of the form

HtmlForm

public HtmlForm()
Create an html form with no name.

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 form
width - the width of the field in table columns
Returns:
the field added to this form
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 form
width - the width of the control in table columns
Returns:
the control added to this form
Throws:
UnsupportedOperationException - if invoked

onProcess

public boolean onProcess()
Returns:
true to continue Page event processing or false otherwise
See Also:
Control.onProcess().

render

public void render(HtmlStringBuffer buffer)
Render the HTML representation of the form and all its child controls to the specified buffer.

Parameters:
buffer - the specified buffer to render the control's output to
See Also:
AbstractControl.render(net.sf.click.util.HtmlStringBuffer)

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)

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

getFormSizeEst

protected int getFormSizeEst(List formFields)
Parameters:
formFields - the list of form fields
Returns:
the estimated rendered control size in characters
See Also:
AbstractControl.getControlSizeEst()