Class WEmailField
- java.lang.Object
-
- com.github.bordertech.wcomponents.AbstractWComponent
-
- com.github.bordertech.wcomponents.WBeanComponent
-
- com.github.bordertech.wcomponents.AbstractInput
-
- com.github.bordertech.wcomponents.WEmailField
-
- All Implemented Interfaces:
AjaxTarget,AjaxTrigger,Autocompleteable,AutocompleteableEmail,BeanAware,BeanBound,BeanProviderBound,DataBound,Diagnosable,Disableable,Input,Labelable,Mandatable,Placeholderable,SubordinateTarget,SubordinateTrigger,WComponent,WebComponent,Serializable
public class WEmailField extends AbstractInput implements AjaxTrigger, AjaxTarget, SubordinateTrigger, SubordinateTarget, Placeholderable, AutocompleteableEmail
A WEmailField is a wcomponent used to display an email input field. Use the method "getText" to get the text entered into the field by the user.
An email field differs from a text field in the way in which some user agents interact with it. For example, touchscreen devices may display a different soft keyboard from the default layout. In addition, they may present email addresses from the user's address book.
- Since:
- 1.0.0
- Author:
- Yiannis Paschalidis, Jonathan Austin, Mark Reeves
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWEmailField.EmailFieldModelEmailFieldModel holds Extrinsic state management of the field.-
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 WEmailField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAutocompleteSection(String sectionName)Pre-pend anautocompletesection to the value of anautocompleteattribute for the current field.voidclearAutocomplete()Clear theautocompleteattribute.protected booleandoHandleRequest(Request request)Specific handle request processing for an input component is provided here.StringgetAutocomplete()intgetColumns()protected WEmailField.EmailFieldModelgetComponentModel()Returns the effective component model for this component.intgetMaxLength()protected WEmailField.EmailFieldModelgetOrCreateComponentModel()Retrieves the model for this component so that it can be modified.StringgetPlaceholder()Get the placeholder text, if explicitly set.StringgetRequestValue(Request request)Provide the value of the component on the Request.WSuggestionsgetSuggestions()StringgetText()Retrieves the phone field's text.StringgetValue()Provide the value of the component returned byDataBound.getData()in the correct format.protected WEmailField.EmailFieldModelnewComponentModel()Creates a new EmailFieldModel holds Extrinsic state management of the field.voidsetAutocomplete(Email value)Set theautocompleteattribute to a specific "email" value.voidsetAutocompleteOff()Turnautocompleteoff for the current field.voidsetColumns(int columns)Sets the width of the input field in characters.voidsetInvalidEmailAddressErrorMessage(String message)Sets the validation error message.voidsetMaxLength(int maxLength)Set the maximum number of characters that the user can enter into the email field.voidsetPlaceholder(String placeholder)Set placeholder text which will appear in the field if it is editable and has no content.voidsetSuggestions(WSuggestions suggestions)Set theWSuggestionsfor this email field.voidsetText(String text)Sets the text value to be shown in the input field.protected voidvalidateComponent(List<Diagnostic> diags)Override WInput's validateComponent to perform further validation on email addresses.protected voidvalidateEmailAddress(List<Diagnostic> diags)Performs validation of the email address.-
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, getData, isBeanInScratchMap, isChanged, isSearchAncestors, isUseRequestScopeScratchMap, removeBeanFromScratchMap, resetData, setBean, setBeanId, setBeanProperty, setBeanProvider, setData, 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
isAutocompleteOff
-
Methods inherited from interface com.github.bordertech.wcomponents.autocomplete.AutocompleteableEmail
setEmailAutocomplete
-
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
-
doHandleRequest
protected boolean doHandleRequest(Request request)
Specific handle request processing for an input component is provided here.Input components are required to determine if the component has changed in the request, set the component data to the new value (if changed) and return the changed flag.
- Specified by:
doHandleRequestin classAbstractInput- Parameters:
request- the request being responded to.- Returns:
- true if the input component has changed, otherwise return false
-
getRequestValue
public String getRequestValue(Request request)
Provide the value of the component on the Request.If the component is not on the request, the components current value will be provided.
- Specified by:
getRequestValuein interfaceInput- Parameters:
request- the request being responded to.- Returns:
- the value of this component on the Request, or its current state if it is not on the request.
-
getValue
public String getValue()
Provide the value of the component returned byDataBound.getData()in the correct format.If required, this method can convert the data into the correct type and also do any validation before the value is used.
- Specified by:
getValuein interfaceInput- Overrides:
getValuein classAbstractInput- Returns:
- the value of the component returned by
DataBound.getData()in the correct format.
-
getText
public String getText()
Retrieves the phone field's text.- Returns:
- the phone field's text for the given context.
-
setText
public void setText(String text)
Sets the text value to be shown in the input field.- Parameters:
text- the text to display for the given context.
-
getColumns
public int getColumns()
- Returns:
- the width of the input field in characters.
-
setColumns
public void setColumns(int columns)
Sets the width of the input field in characters.- Parameters:
columns- the number of characters to display.
-
getMaxLength
public int getMaxLength()
- Returns:
- the maximum number of characters that the user can enter into the email field.
-
setMaxLength
public final void setMaxLength(int maxLength)
Set the maximum number of characters that the user can enter into the email field.- Parameters:
maxLength- the maximum number of characters to allow.
-
getSuggestions
public WSuggestions getSuggestions()
- Returns:
- the
WSuggestionsfor this email field.
-
setSuggestions
public final void setSuggestions(WSuggestions suggestions)
Set theWSuggestionsfor this email field.- Parameters:
suggestions- theWSuggestionsfor this email field
-
setPlaceholder
public void setPlaceholder(String placeholder)
Set placeholder text which will appear in the field if it is editable and has no content.- Specified by:
setPlaceholderin interfacePlaceholderable- Parameters:
placeholder- The text to set as the placeholder.
-
getPlaceholder
public String getPlaceholder()
Get the placeholder text, if explicitly set.- Specified by:
getPlaceholderin interfacePlaceholderable- Returns:
- The placeholder text, if set.
-
validateComponent
protected void validateComponent(List<Diagnostic> diags)
Override WInput's validateComponent to perform further validation on email addresses.- Overrides:
validateComponentin classAbstractInput- Parameters:
diags- the list into which any validation diagnostics are added.
-
validateEmailAddress
protected void validateEmailAddress(List<Diagnostic> diags)
Performs validation of the email address. This only performs very basic validation - an email address must contain some text, followed by an '@', and then something which resembles a domain/host name.
Subclasses can override this method to perform more specific validation.
- Parameters:
diags- the list into which any validation diagnostics are added.
-
setInvalidEmailAddressErrorMessage
public void setInvalidEmailAddressErrorMessage(String message)
Sets the validation error message.- Parameters:
message- The errorMessage to set, or null to use the default error message.
-
newComponentModel
protected WEmailField.EmailFieldModel newComponentModel()
Creates a new EmailFieldModel holds Extrinsic state management of the field.- Overrides:
newComponentModelin classAbstractInput- Returns:
- a new EmailFieldModel
-
getComponentModel
protected WEmailField.EmailFieldModel 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:
getComponentModelin classAbstractInput- Returns:
- the effective component model
-
getOrCreateComponentModel
protected WEmailField.EmailFieldModel 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:
getOrCreateComponentModelin classAbstractInput- Returns:
- the model for this component
-
setAutocomplete
public void setAutocomplete(Email value)
Description copied from interface:AutocompleteableEmailSet theautocompleteattribute to a specific "email" value. Currently only value "email" is supported.- Specified by:
setAutocompletein interfaceAutocompleteableEmail- Parameters:
value- the auto-fill hint value
-
getAutocomplete
public String getAutocomplete()
- Specified by:
getAutocompletein interfaceAutocompleteable- Returns:
- the value of the
autocompleteattribute applied to the current field.
-
setAutocompleteOff
public void setAutocompleteOff()
Description copied from interface:AutocompleteableTurnautocompleteoff for the current field.- Specified by:
setAutocompleteOffin interfaceAutocompleteable
-
addAutocompleteSection
public void addAutocompleteSection(String sectionName)
Description copied from interface:AutocompleteablePre-pend anautocompletesection to the value of anautocompleteattribute for the current field.- Specified by:
addAutocompleteSectionin interfaceAutocompleteable- Parameters:
sectionName- the name of the section being the part which would replace the asterisk in the formsection-*
-
clearAutocomplete
public void clearAutocomplete()
Description copied from interface:AutocompleteableClear theautocompleteattribute.- Specified by:
clearAutocompletein interfaceAutocompleteable
-
-