Class WEmailField

    • Constructor Detail

      • WEmailField

        public WEmailField()
    • 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:
        doHandleRequest in class AbstractInput
        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:
        getRequestValue in interface Input
        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 by DataBound.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:
        getValue in interface Input
        Overrides:
        getValue in class AbstractInput
        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.
      • setSuggestions

        public final void setSuggestions​(WSuggestions suggestions)
        Set the WSuggestions for this email field.
        Parameters:
        suggestions - the WSuggestions for 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:
        setPlaceholder in interface Placeholderable
        Parameters:
        placeholder - The text to set as the placeholder.
      • getPlaceholder

        public String getPlaceholder()
        Get the placeholder text, if explicitly set.
        Specified by:
        getPlaceholder in interface Placeholderable
        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:
        validateComponent in class AbstractInput
        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.
      • 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:
        getComponentModel in class AbstractInput
        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:
        getOrCreateComponentModel in class AbstractInput
        Returns:
        the model for this component
      • setAutocomplete

        public void setAutocomplete​(Email value)
        Description copied from interface: AutocompleteableEmail
        Set the autocomplete attribute to a specific "email" value. Currently only value "email" is supported.
        Specified by:
        setAutocomplete in interface AutocompleteableEmail
        Parameters:
        value - the auto-fill hint value
      • getAutocomplete

        public String getAutocomplete()
        Specified by:
        getAutocomplete in interface Autocompleteable
        Returns:
        the value of the autocomplete attribute applied to the current field.
      • addAutocompleteSection

        public void addAutocompleteSection​(String sectionName)
        Description copied from interface: Autocompleteable
        Pre-pend an autocomplete section to the value of an autocomplete attribute for the current field.
        Specified by:
        addAutocompleteSection in interface Autocompleteable
        Parameters:
        sectionName - the name of the section being the part which would replace the asterisk in the form section-*