org.apache.click.extras.control
Class HtmlForm
java.lang.Object
org.apache.click.control.AbstractControl
org.apache.click.control.AbstractContainer
org.apache.click.control.Form
org.apache.click.extras.control.HtmlForm
- All Implemented Interfaces:
- Serializable, Control, Container, Stateful
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.
- See Also:
- Serialized Form
Fields inherited from class org.apache.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, formSubmission, 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 org.apache.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, getHeadElements, getJavaScriptValidation, getLabelAlign, getLabelsPosition, getLabelStyle, getMethod, getState, getTag, getValidate, hasPostError, insert, isDisabled, isFormSubmission, isJavaScriptValidation, isReadonly, isValid, onDestroy, onProcess, onSubmitCheck, onSubmitCheck, onSubmitCheck, performSubmitCheck, remove, removeField, removeFields, removeState, renderButtons, renderControls, renderErrors, renderFields, renderFocusJavaScript, renderHeader, renderTagEnd, renderValidationJavaScript, replace, restoreState, saveState, setActionURL, setButtonAlign, setButtonStyle, setColumns, setDefaultFieldSize, setDisabled, setEnctype, setError, setErrorsAlign, setErrorsPosition, setErrorsStyle, setFieldStyle, setJavaScriptValidation, setLabelAlign, setLabelsPosition, setLabelStyle, setListener, setMethod, setName, setReadonly, setState, setValidate, startTag, validate, validateFileUpload |
Methods inherited from class org.apache.click.control.AbstractControl |
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHtmlImports, getId, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, removeBehavior, 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.
- Overrides:
add
in class Form
- 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.
- Overrides:
add
in class Form
- 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
render
public void render(HtmlStringBuffer buffer)
- Render the HTML representation of the form and all its child
controls to the specified buffer.
- Specified by:
render
in interface Control
- Overrides:
render
in class Form
- Parameters:
buffer
- the specified buffer to render the control's output to- See Also:
AbstractControl.render(org.apache.click.util.HtmlStringBuffer)
renderTagBegin
protected void renderTagBegin(String tagName,
HtmlStringBuffer buffer)
- Overrides:
renderTagBegin
in class AbstractControl
- Parameters:
tagName
- the name of the tag to renderbuffer
- the buffer to append the output to- See Also:
AbstractControl.renderTagBegin(java.lang.String, org.apache.click.util.HtmlStringBuffer)
renderContent
protected void renderContent(HtmlStringBuffer buffer)
- Overrides:
renderContent
in class AbstractContainer
- Parameters:
buffer
- the buffer to append the output to- See Also:
AbstractContainer.renderContent(org.apache.click.util.HtmlStringBuffer)
renderChildren
protected void renderChildren(HtmlStringBuffer buffer)
- Overrides:
renderChildren
in class AbstractContainer
- Parameters:
buffer
- the buffer to append the output to- See Also:
AbstractContainer.renderChildren(org.apache.click.util.HtmlStringBuffer)
getFormSizeEst
protected int getFormSizeEst(List<Field> formFields)
- Overrides:
getFormSizeEst
in class Form
- Parameters:
formFields
- the list of form fields
- Returns:
- the estimated rendered control size in characters
- See Also:
AbstractControl.getControlSizeEst()