Class HtmlSelectableTextInput

All Implemented Interfaces:
Serializable, Cloneable, DisabledElement, FormFieldWithNameHistory, org.htmlunit.html.impl.SelectableTextInput, SubmittableElement, ValidatableElement, Element, Node
Direct Known Subclasses:
HtmlDateInput, HtmlEmailInput, HtmlNumberInput, HtmlPasswordInput, HtmlTelInput, HtmlTextInput, HtmlTimeInput, HtmlUrlInput

public abstract class HtmlSelectableTextInput extends HtmlInput implements org.htmlunit.html.impl.SelectableTextInput
Abstract parent class to share SelectableTextInput implementation and typing support.
See Also:
  • Method Details

    • setValue

      public void setValue(String newValue)
      Sets the value.
      Overrides:
      setValue in class HtmlInput
      Parameters:
      newValue - the new value
    • doType

      protected void doType(char c, boolean lastType)
      Performs the effective type action, called after the keyPress event and before the keyUp event.
      Overrides:
      doType in class HtmlElement
      Parameters:
      c - the character you with to simulate typing
      lastType - is this the last character to type
    • doType

      protected void doType(int keyCode, boolean lastType)
      Performs the effective type action, called after the keyPress event and before the keyUp event.

      An example of predefined values is KeyboardEvent.DOM_VK_PAGE_DOWN.

      Overrides:
      doType in class HtmlElement
      Parameters:
      keyCode - the key code wish to simulate typing
      lastType - is this the last to type
    • typeDone

      protected void typeDone(String newValue, boolean notifyAttributeChangeListeners)
      Called from DoTypeProcessor.
      Overrides:
      typeDone in class HtmlElement
      Parameters:
      newValue - the new value
      notifyAttributeChangeListeners - to notify the associated HtmlAttributeChangeListeners
    • setText

      public void setText(String text)
      Sets the text in this element.
      Specified by:
      setText in interface org.htmlunit.html.impl.SelectableTextInput
      Parameters:
      text - the text to put in this element
    • getText

      public String getText()
      Returns all of the text in this element.
      Specified by:
      getText in interface org.htmlunit.html.impl.SelectableTextInput
      Returns:
      all of the text in this element
    • select

      public void select()
      Focuses this element and selects all of its text.
      Specified by:
      select in interface org.htmlunit.html.impl.SelectableTextInput
    • getSelectedText

      public String getSelectedText()
      Returns the selected text in this element, or null if there is no selected text in this element.
      Specified by:
      getSelectedText in interface org.htmlunit.html.impl.SelectableTextInput
      Returns:
      the selected text in this element, or null if there is no selected text in this element
    • getSelectionStart

      public int getSelectionStart()
      Returns the start position of the selected text in this element.
      Specified by:
      getSelectionStart in interface org.htmlunit.html.impl.SelectableTextInput
      Returns:
      the start position of the selected text in this element
    • setSelectionStart

      public void setSelectionStart(int selectionStart)
      Sets the start position of the selected text in this element.
      Specified by:
      setSelectionStart in interface org.htmlunit.html.impl.SelectableTextInput
      Parameters:
      selectionStart - the start position of the selected text in this element
    • getSelectionEnd

      public int getSelectionEnd()
      Returns the end position of the selected text in this element.
      Specified by:
      getSelectionEnd in interface org.htmlunit.html.impl.SelectableTextInput
      Returns:
      the end position of the selected text in this element
    • setSelectionEnd

      public void setSelectionEnd(int selectionEnd)
      Sets the end position of the selected text in this element.
      Specified by:
      setSelectionEnd in interface org.htmlunit.html.impl.SelectableTextInput
      Parameters:
      selectionEnd - the end position of the selected text in this element
    • reset

      public void reset()
      Returns the value of this element to the default value or checked state (usually what it was at the time the page was loaded, unless it has been modified via JavaScript).
      Specified by:
      reset in interface SubmittableElement
      Overrides:
      reset in class HtmlInput
      See Also:
    • cloneNode

      public DomNode cloneNode(boolean deep)
      Specified by:
      cloneNode in interface Node
      Overrides:
      cloneNode in class HtmlInput