net.sf.click.extras.control
Class HtmlForm
java.lang.Object
net.sf.click.control.AbstractControl
net.sf.click.control.AbstractContainer
net.sf.click.control.Form
net.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
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 |
Constructor Summary |
HtmlForm()
Create an html form with no name. |
HtmlForm(String name)
Create an html form with the given name. |
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.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 |
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.
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 formwidth
- 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 formwidth
- 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 renderbuffer
- 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()