Class TextArea
- java.lang.Object
-
- org.openidentityplatform.openam.click.control.AbstractControl
-
- org.openidentityplatform.openam.click.control.Field
-
- org.openidentityplatform.openam.click.control.TextArea
-
- All Implemented Interfaces:
Serializable,org.apache.click.Stateful,org.openidentityplatform.openam.click.Control
public class TextArea extends Field
Provides a TextArea control: <textarea></textarea>.Example Text Area <textarea>Rather lengthy text</textarea> TextArea Example
The example below shows how to a TextArea to a Form:TextArea commentsField = new TextArea("comments"); commentsField.setCols(40); commentsField.setRows(6); form.add(commentsField);
The TextArea control will rendered HTML output:<textarea name="comments" rows="6" cols="40"/></textarea>
See also the W3C HTML reference: TEXTAREA- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intcolsThe number of text area columns.protected intmaxLengthThe maximum field length validation constraint.protected intminLengthThe minimum field length validation constraint.protected introwsThe number of text area rows.protected static StringVALIDATE_TEXTAREA_FUNCTIONThe field validation JavaScript function template.-
Fields inherited from class org.openidentityplatform.openam.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.openidentityplatform.openam.click.control.AbstractControl
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles
-
-
Constructor Summary
Constructors Constructor Description TextArea()Create a TextArea with no name defined.TextArea(String name)Construct the TextArea with the given name.TextArea(String name, boolean required)Construct the TextArea with the given name and required status.TextArea(String name, int cols, int rows)Construct the TextArea with the given name, number of columns and number of rows.TextArea(String name, String label)Construct the TextArea with the given name and label.TextArea(String name, String label, boolean required)Construct the TextArea with the given name, label and required status.TextArea(String name, String label, int cols, int rows)Construct the TextArea with the given name, label, number of columns and number of rows.TextArea(String name, String label, int cols, int rows, boolean required)Construct the TextArea with the given name, label, number of columns and number of rows.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCols()Return the number of text area columns.intgetControlSizeEst()Return the estimated rendered control size in characters.intgetMaxLength()Returns the maximum field length validation constraint.intgetMinLength()Returns the minimum field length validation constraint.intgetRows()Return the number of text area rows.StringgetTag()Return the textarea's html tag:textarea.StringgetValidationJavaScript()Return the field JavaScript client side validation function.voidrender(HtmlStringBuffer buffer)Render the HTML representation of the TextArea.voidsetCols(int cols)Set the number of text area columns.voidsetMaxLength(int maxLength)Sets the maximum field length.voidsetMinLength(int minLength)Sets the minimum field length validation constraint.voidsetRows(int rows)Set the number of text area rows.voidvalidate()Validate the TextArea request submission.-
Methods inherited from class org.openidentityplatform.openam.click.control.Field
bindRequestValue, getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, onProcess, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth
-
Methods inherited from class org.openidentityplatform.openam.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, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle, toString
-
-
-
-
Field Detail
-
VALIDATE_TEXTAREA_FUNCTION
protected static final String VALIDATE_TEXTAREA_FUNCTION
The field validation JavaScript function template. The function template arguments are:- 0 - is the field id
- 1 - is the Field required status
- 2 - is the minimum length
- 3 - is the maximum length
- 4 - is the localized error message for required validation
- 5 - is the localized error message for minimum length validation
- 6 - is the localized error message for maximum length validation
- See Also:
- Constant Field Values
-
cols
protected int cols
The number of text area columns. The default number of columns is twenty.
-
maxLength
protected int maxLength
The maximum field length validation constraint. If the value is zero this validation constraint is not applied. The default value is zero.
-
minLength
protected int minLength
The minimum field length validation constraint. If the valid is zero this validation constraint is not applied. The default value is zero.
-
rows
protected int rows
The number of text area rows. The default number of rows is three.
-
-
Constructor Detail
-
TextArea
public TextArea(String name)
Construct the TextArea with the given name. The area will have a default size of 20 cols and 3 rows.- Parameters:
name- the name of the field
-
TextArea
public TextArea(String name, String label)
Construct the TextArea with the given name and label. The area will have a default size of 20 cols and 3 rows.- Parameters:
name- the name of the fieldlabel- the label of the field
-
TextArea
public TextArea(String name, boolean required)
Construct the TextArea with the given name and required status. The area will have a default size of 20 cols and 3 rows.- Parameters:
name- the name of the fieldrequired- the field required status
-
TextArea
public TextArea(String name, String label, boolean required)
Construct the TextArea with the given name, label and required status. The area will have a default size of 20 cols and 3 rows.- Parameters:
name- the name of the fieldlabel- the label of the fieldrequired- the field required status
-
TextArea
public TextArea(String name, int cols, int rows)
Construct the TextArea with the given name, number of columns and number of rows.- Parameters:
name- the name of the fieldcols- the number of text area colsrows- the number of text area rows
-
TextArea
public TextArea(String name, String label, int cols, int rows)
Construct the TextArea with the given name, label, number of columns and number of rows.- Parameters:
name- the name of the fieldlabel- the label of the fieldcols- the number of text area colsrows- the number of text area rows
-
TextArea
public TextArea(String name, String label, int cols, int rows, boolean required)
Construct the TextArea with the given name, label, number of columns and number of rows.- Parameters:
name- the name of the fieldlabel- the label of the fieldcols- the number of text area colsrows- the number of text area rowsrequired- the field required status
-
TextArea
public TextArea()
Create a TextArea with no name defined.Please note the control's name must be defined before it is valid.
-
-
Method Detail
-
getTag
public String getTag()
Return the textarea's html tag:textarea.- Overrides:
getTagin classAbstractControl- Returns:
- this controls html tag
- See Also:
AbstractControl.getTag()
-
getCols
public int getCols()
Return the number of text area columns.- Returns:
- the number of text area columns
-
setCols
public void setCols(int cols)
Set the number of text area columns. The default number of columns is 20.- Parameters:
cols- set the number of text area columns.
-
getMaxLength
public int getMaxLength()
Returns the maximum field length validation constraint. If themaxLengthproperty is greater than zero, the Field values length will be validated against this constraint when processed.- Returns:
- the maximum field length validation constraint
-
setMaxLength
public void setMaxLength(int maxLength)
Sets the maximum field length. If themaxLengthproperty is greater than zero, the Field values length will be validated against this constraint when processed.- Parameters:
maxLength- the maximum field length validation constraint
-
getMinLength
public int getMinLength()
Returns the minimum field length validation constraint. If theminLengthproperty is greater than zero, the Field values length will be validated against this constraint when processed.- Returns:
- the minimum field length validation constraint
-
setMinLength
public void setMinLength(int minLength)
Sets the minimum field length validation constraint. If theminLengthproperty is greater than zero, the Field values length will be validated against this constraint when processed.- Parameters:
minLength- the minimum field length validation constraint
-
getRows
public int getRows()
Return the number of text area rows.- Returns:
- the number of text area rows
-
setRows
public void setRows(int rows)
Set the number of text area rows. The default number of rows is 3.- Parameters:
rows- set the number of text area rows
-
getControlSizeEst
public int getControlSizeEst()
Description copied from class:AbstractControlReturn the estimated rendered control size in characters.- Overrides:
getControlSizeEstin classAbstractControl- Returns:
- the estimated rendered control size in characters
- See Also:
AbstractControl.getControlSizeEst()
-
render
public void render(HtmlStringBuffer buffer)
Render the HTML representation of the TextArea.- Specified by:
renderin interfaceorg.openidentityplatform.openam.click.Control- Overrides:
renderin classAbstractControl- Parameters:
buffer- the specified buffer to render the control's output to- See Also:
AbstractControl.toString()
-
validate
public void validate()
Validate the TextArea request submission.A field error message is displayed if a validation error occurs. These messages are defined in the resource bundle:
org.apache.click.control.MessageProperties
Error message bundle key names include:
- field-maxlength-error
- field-minlength-error
- field-required-error
-
getValidationJavaScript
public String getValidationJavaScript()
Return the field JavaScript client side validation function.The function name must follow the format
validate_[id], where the id is the DOM element id of the fields focusable HTML element, to ensure the function has a unique name.- Overrides:
getValidationJavaScriptin classField- Returns:
- the field JavaScript client side validation function
-
-