Class WTextArea
-
- All Implemented Interfaces:
AjaxTarget
,AjaxTrigger
,Autocompleteable
,AutocompleteableDate
,AutocompleteableEmail
,AutocompleteableMultiline
,AutocompleteableNumeric
,AutocompleteablePassword
,AutocompleteablePhone
,AutocompleteableText
,AutocompleteableURL
,BeanAware
,BeanBound
,BeanProviderBound
,DataBound
,Diagnosable
,Disableable
,Input
,Labelable
,Mandatable
,Placeholderable
,SubordinateTarget
,SubordinateTrigger
,WComponent
,WebComponent
,Serializable
public class WTextArea extends WTextField implements AutocompleteableMultiline
A WTextArea is a wcomponent used to display a html textarea. It is very much like WTextField except that it has multiple lines of input. Use the "setRows" method to define the number of lines displayed. Since 2015 this component may also be put into Rich Text Editor mode.
- Since:
- 1.0.0
- Author:
- James Gifford, Jonathan Austin, Rick Brown, Mark Reeves
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WTextArea.TextAreaModel
TextAreaModel holds Extrinsic state management of the field.-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.WTextField
WTextField.TextFieldModel
-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractInput
AbstractInput.InputModel
-
Nested classes/interfaces inherited from class com.github.bordertech.wcomponents.AbstractWComponent
AbstractWComponent.WComponentRef
-
-
Field Summary
-
Fields inherited from interface com.github.bordertech.wcomponents.WComponent
DEFAULT_APPLICATION_ID, DEFAULT_INTERNAL_ID, DEFAULT_NO_ID, ID_CONTEXT_SEPERATOR, ID_FRAMEWORK_ASSIGNED_SEPERATOR, ID_VALIDATION_PATTERN
-
-
Constructor Summary
Constructors Constructor Description WTextArea()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected WTextArea.TextAreaModel
getComponentModel()
Returns the effective component model for this component.Object
getData()
The data for this WTextArea.protected WTextArea.TextAreaModel
getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified.int
getRows()
boolean
isRichTextArea()
boolean
isSanitizeOnOutput()
protected WTextArea.TextAreaModel
newComponentModel()
Creates a new TextAreaModel.protected String
sanitizeInputText(String text)
protected String
sanitizeOutputText(String text)
void
setAutocomplete(Multiline value)
Set the autocomplete attribute to indicate auto-fill of a multi-line field.void
setData(Object data)
Set data in this component.void
setFullStreetAddressAutocomplete(AddressType value)
Set the autocomplete attribute to indicate auto-fill of a multi-line street address of a given address type (shipping or billing).void
setRichTextArea(boolean richTextArea)
Pass true to put the field into rich text mode.void
setRows(int rows)
Sets the number of rows of text that are visible without scrolling.void
setSanitizeOnOutput(boolean sanitize)
Pass true if you need to run the HTML sanitizer on any output.-
Methods inherited from class com.github.bordertech.wcomponents.WTextField
addAutocompleteSection, clearAutocomplete, doHandleRequest, getAutocomplete, getColumns, getMaxLength, getMinLength, getPattern, getPlaceholder, getRequestValue, getSuggestions, getText, getValue, setAddressAutocomplete, setAutocomplete, setAutocomplete, setAutocomplete, setAutocomplete, setAutocomplete, setAutocomplete, setAutocomplete, setAutocomplete, setAutocompleteOff, setColumns, setMaxLength, setMinLength, setPattern, setPhoneSegmentAutocomplete, setPlaceholder, setSuggestions, setText, validateComponent
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractInput
addValidator, beforeHandleRequest, createMandatoryDiagnostic, doHandleChanged, getActionCommand, getActionObject, getActionOnChange, getDefaultSubmitButton, getDiagnostics, getValidators, getValueAsString, handleRequest, isChangedInLastRequest, isCurrentAjaxTrigger, isDisabled, isEmpty, isMandatory, isPresent, isReadOnly, setActionObject, setActionOnChange, setChangedInLastRequest, setDefaultSubmitButton, setDisabled, setMandatory, setMandatory, setReadOnly, showErrorIndicatorsForComponent, showIndicatorsForComponent, showWarningIndicatorsForComponent, toString
-
Methods inherited from class com.github.bordertech.wcomponents.WBeanComponent
addBeanToScratchMap, doUpdateBeanValue, getBean, getBeanFromScratchMap, getBeanId, getBeanProperty, getBeanProvider, getBeanScratchMap, getBeanValue, isBeanInScratchMap, isChanged, isSearchAncestors, isUseRequestScopeScratchMap, removeBeanFromScratchMap, resetData, setBean, setBeanId, setBeanProperty, setBeanProvider, setSearchAncestors, updateBeanValue
-
Methods inherited from class com.github.bordertech.wcomponents.AbstractWComponent
addHtmlClass, addHtmlClass, addNotify, afterPaint, assertAddSupported, beforePaint, createErrorDiagnostic, createErrorDiagnostic, forward, getAccessibleText, getAttribute, getBaseUrl, getDefaultModel, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getScratchMap, getTabIndex, getTag, getTemplate, getTemplateMarkUp, getToolTip, hasNoComponentModel, hasTabIndex, initialiseComponentModel, invokeLater, invokeLaters, isDebugStructure, isDefaultState, isFlagSet, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, paintComponent, preparePaint, preparePaintComponent, removeAttribute, removeComponentModel, removeHtmlClass, removeHtmlClass, removeNotify, replaceWComponent, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFlag, setFocussed, setHidden, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContext, tidyUpUIContextForTree, validate, writeReplace
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.Autocompleteable
addAutocompleteSection, clearAutocomplete, getAutocomplete, isAutocompleteOff, setAutocompleteOff
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableDate
setBirthdayAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableEmail
setEmailAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableMultiline
setFullStreetAddressAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteablePhone
setFullPhoneAutocomplete, setFullPhoneAutocomplete, setLocalPhoneAutocomplete, setLocalPhoneAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableURL
setUrlAutocomplete
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanAware
getBean, getBeanProperty, getBeanValue, setBeanProperty
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanBound
isSearchAncestors, setBean
-
Methods inherited from interface com.github.bordertech.wcomponents.BeanProviderBound
getBeanId, setBeanId, setBeanProvider
-
Methods inherited from interface com.github.bordertech.wcomponents.WComponent
addHtmlClass, addHtmlClass, forward, getAccessibleText, getAttribute, getBaseUrl, getEnvironment, getHeaders, getHtmlClass, getHtmlClasses, getId, getIdName, getInternalId, getLabel, getName, getParent, getTabIndex, getTag, getToolTip, handleRequest, hasTabIndex, invokeLater, isDefaultState, isHidden, isInitialised, isLocked, isTracking, isTrackingEnabled, isValidate, isVisible, paint, preparePaint, removeAttribute, removeHtmlClass, removeHtmlClass, reset, serviceRequest, setAccessibleText, setAttribute, setEnvironment, setFocussed, setHtmlClass, setHtmlClass, setIdName, setInitialised, setLocked, setTag, setToolTip, setTrackingEnabled, setValidate, setVisible, showErrorIndicators, showWarningIndicators, tidyUpUIContextForTree, validate
-
-
-
-
Method Detail
-
getData
public Object getData()
The data for this WTextArea. If the text area is not rich text its output is XML escaped so we can ignore sanitization. If the text area is a rich text area then we check the sanitizeOnOutput flag as sanitization is rather resource intensive.- Specified by:
getData
in interfaceDataBound
- Overrides:
getData
in classWBeanComponent
- Returns:
- The data for this WTextArea.
-
setData
public void setData(Object data)
Set data in this component. If the WTextArea is a rich text input we need to sanitize the input.- Specified by:
setData
in interfaceDataBound
- Overrides:
setData
in classWBeanComponent
- Parameters:
data
- The input data
-
getRows
public int getRows()
- Returns:
- the number of rows of text that are visible without scrolling.
-
setRows
public void setRows(int rows)
Sets the number of rows of text that are visible without scrolling.- Parameters:
rows
- the number of rows.
-
isRichTextArea
public boolean isRichTextArea()
- Returns:
- true if the field is in rich text mode.
-
setRichTextArea
public void setRichTextArea(boolean richTextArea)
Pass true to put the field into rich text mode.- Parameters:
richTextArea
- the number of rows
-
setSanitizeOnOutput
public void setSanitizeOnOutput(boolean sanitize)
Pass true if you need to run the HTML sanitizer on any output. This is only needed if the textarea is rich text as in other cases the output will be XML encoded.- Parameters:
sanitize
- true if output sanitization is required.
-
isSanitizeOnOutput
public boolean isSanitizeOnOutput()
- Returns:
- true if this text area is to be sanitized on output.
-
sanitizeOutputText
protected String sanitizeOutputText(String text)
- Parameters:
text
- the output text to sanitize- Returns:
- the sanitized text
-
sanitizeInputText
protected String sanitizeInputText(String text)
- Parameters:
text
- the input text to sanitize- Returns:
- the sanitized text
-
setAutocomplete
public void setAutocomplete(Multiline value)
Description copied from interface:AutocompleteableMultiline
Set the autocomplete attribute to indicate auto-fill of a multi-line field.- Specified by:
setAutocomplete
in interfaceAutocompleteableMultiline
- Parameters:
value
- the type of multiline field being autofilled: currently only one value - "street-address"
-
setFullStreetAddressAutocomplete
public void setFullStreetAddressAutocomplete(AddressType value)
Description copied from interface:AutocompleteableMultiline
Set the autocomplete attribute to indicate auto-fill of a multi-line street address of a given address type (shipping or billing).- Specified by:
setFullStreetAddressAutocomplete
in interfaceAutocompleteableMultiline
- Parameters:
value
- the type of multiline field being autofilled: currently only one value - "street-address"
-
newComponentModel
protected WTextArea.TextAreaModel newComponentModel()
Creates a new TextAreaModel.- Overrides:
newComponentModel
in classWTextField
- Returns:
- a new TextAreaModel
-
getComponentModel
protected WTextArea.TextAreaModel getComponentModel()
Returns the effective component model for this component. Subclass may override this method to narrow the return type to their specific model type.- Overrides:
getComponentModel
in classWTextField
- Returns:
- the effective component model
-
getOrCreateComponentModel
protected WTextArea.TextAreaModel getOrCreateComponentModel()
Retrieves the model for this component so that it can be modified. If this method is called during request processing, and a session specific model does not yet exist, then a new model is created. Subclasses may override this method to narrow the return type to their specific model type.- Overrides:
getOrCreateComponentModel
in classWTextField
- Returns:
- the model for this component
-
-