com.gargoylesoftware.htmlunit.html
Class HtmlTextInput

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.DomNode
      extended by com.gargoylesoftware.htmlunit.html.DomNamespaceNode
          extended by com.gargoylesoftware.htmlunit.html.DomElement
              extended by com.gargoylesoftware.htmlunit.html.HtmlElement
                  extended by com.gargoylesoftware.htmlunit.html.HtmlInput
                      extended by com.gargoylesoftware.htmlunit.html.HtmlTextInput
All Implemented Interfaces:
DisabledElement, FormFieldWithNameHistory, SelectableTextInput, SubmittableElement, Serializable, Cloneable, Element, Node

public class HtmlTextInput
extends HtmlInput
implements SelectableTextInput

Wrapper for the HTML element "input" with type="text".

Version:
$Revision: 5301 $
Author:
Mike Bowler, David K. Taylor, Christian Sell, Daniel Gredler, Ahmed Ashour, Marc Guillemot
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
HtmlElement.ChildElementsIterator
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.DomNode
DomNode.ChildIterator, DomNode.DescendantElementsIterator<T extends DomNode>
 
Field Summary
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.HtmlInput
TAG_NAME
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
TAB_INDEX_OUT_OF_BOUNDS
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomElement
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
AS_TEXT_BLANK, AS_TEXT_BLOCK_SEPARATOR, AS_TEXT_NEW_LINE, AS_TEXT_TAB, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Method Summary
protected  Object clone()
          
protected  void doType(char c, boolean shiftKey, boolean ctrlKey, boolean altKey)
          Performs the effective type action, called after the keyPress event and before the keyUp event.
 void focus()
          Sets the focus on this element.
 String getSelectedText()
          Returns the selected text in this element, or null if there is no selected text in this element.
 int getSelectionEnd()
          Returns the end position of the selected text in this element.
 int getSelectionStart()
          Returns the start position of the selected text in this element.
 String getText()
          Returns all of the text in this element.
protected  boolean isSubmittableByEnter()
          Returns true if clicking Enter (ASCII 10, or '\n') should submit the enclosed form (if any).
 void select()
          Focuses this element and selects all of its text.
 void setAttributeNS(String namespaceURI, String qualifiedName, String attributeValue)
          Sets the value of the specified attribute.
 void setSelectionEnd(int selectionEnd)
          Sets the end position of the selected text in this element.
 void setSelectionStart(int selectionStart)
          Sets the start position of the selected text in this element.
 void setText(String text)
          Sets the text in this element.
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.HtmlInput
click, getAcceptAttribute, getAccessKeyAttribute, getAlignAttribute, getAltAttribute, getCheckedAttribute, getDefaultValue, getDisabledAttribute, getMaxLengthAttribute, getNameAttribute, getOnBlurAttribute, getOnChangeAttribute, getOnFocusAttribute, getOnSelectAttribute, getOriginalName, getPreviousNames, getReadOnlyAttribute, getSizeAttribute, getSrcAttribute, getSubmitKeyValuePairs, getTabIndexAttribute, getTypeAttribute, getUseMapAttribute, getValueAttribute, isChecked, isDefaultChecked, isDisabled, isReadOnly, reset, setChecked, setDefaultChecked, setDefaultValue, setDefaultValue, setReadOnly, setValueAttribute
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
addHtmlAttributeChangeListener, appendChildIfNoneExists, blur, checkChildHierarchy, click, click, click, dblClick, dblClick, doClickAction, fireEvent, fireEvent, fireHtmlAttributeAdded, fireHtmlAttributeRemoved, fireHtmlAttributeReplaced, getCanonicalXPath, getChildElements, getElementById, getElementsByAttribute, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getEventTargetElement, getHtmlElementsByTagName, getHtmlElementsByTagNames, getId, getLangAttribute, getNodeName, getOnClickAttribute, getOnDblClickAttribute, getOneHtmlElementByAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getTabIndex, getTextDirectionAttribute, getXmlLangAttribute, hasEventHandlers, hasHtmlElementWithId, isAttributeCaseSensitive, isStateUpdateFirst, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, preventDefault, removeAttribute, removeChild, removeEventHandler, removeHtmlAttributeChangeListener, rightClick, rightClick, setEventHandler, setEventHandler, setId, toString, type, type, type, type
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomElement
cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributesMap, getElementsByTagName, getElementsByTagNameNS, getNodeType, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, hasAttributes, isEmptyXmlTagExpanded, namespaces, printOpeningTagContentAsXml, printXml, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNamespaceNode
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode
addDomChangeListener, appendChild, asText, asXml, compareDocumentPosition, fireNodeAdded, fireNodeDeleted, getAllHtmlChildElements, getAncestors, getBaseURI, getByXPath, getChildNodes, getChildren, getDescendants, getEndColumnNumber, getEndLineNumber, getFeature, getFirstByXPath, getFirstChild, getHtmlElementDescendants, getIndex, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getPage, getParentNode, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, getTextContent, getUserData, hasChildNodes, insertBefore, insertBefore, isAncestorOf, isAncestorOfAny, isBlock, isDefaultNamespace, isDisplayed, isEqualNode, isSameNode, isSupported, isTrimmedText, lookupNamespaceURI, lookupPrefix, mayBeDisplayed, normalize, notifyIncorrectness, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, remove, removeAllChildren, removeChild, removeDomChangeListener, replace, replaceChild, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.gargoylesoftware.htmlunit.html.impl.SelectableTextInput
getPage
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Method Detail

doType

protected void doType(char c,
                      boolean shiftKey,
                      boolean ctrlKey,
                      boolean altKey)
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
shiftKey - true if SHIFT is pressed during the typing
ctrlKey - true if CTRL is pressed during the typing
altKey - true if ALT is pressed during the typing

isSubmittableByEnter

protected boolean isSubmittableByEnter()
Returns true if clicking Enter (ASCII 10, or '\n') should submit the enclosed form (if any). The default implementation returns false.

Overrides:
isSubmittableByEnter in class HtmlElement
Returns:
true if clicking Enter should submit the enclosed form (if any)

select

public void select()
Focuses this element and selects all of its text.

Specified by:
select in interface 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 SelectableTextInput
Returns:
the selected text in this element, or null if there is no selected text in this element

getText

public String getText()
Returns all of the text in this element.

Specified by:
getText in interface SelectableTextInput
Returns:
all of the text in this element

setText

public void setText(String text)
Sets the text in this element.

Specified by:
setText in interface SelectableTextInput
Parameters:
text - the text to put in this element

getSelectionStart

public int getSelectionStart()
Returns the start position of the selected text in this element.

Specified by:
getSelectionStart in interface 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 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 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 SelectableTextInput
Parameters:
selectionEnd - the end position of the selected text in this element

setAttributeNS

public void setAttributeNS(String namespaceURI,
                           String qualifiedName,
                           String attributeValue)
Sets the value of the specified attribute. This method may be overridden by subclasses which are interested in specific attribute value changes, but such methods must invoke super.setAttributeValue(), and should consider the value of the cloning parameter when deciding whether or not to execute custom logic.

Specified by:
setAttributeNS in interface Element
Overrides:
setAttributeNS in class HtmlInput
Parameters:
namespaceURI - the URI that identifies an XML namespace
qualifiedName - the qualified name of the attribute
attributeValue - the value of the attribute

focus

public void focus()
Sets the focus on this element.

Specified by:
focus in interface SelectableTextInput
Overrides:
focus in class HtmlElement

clone

protected Object clone()
                throws CloneNotSupportedException

Overrides:
clone in class Object
Throws:
CloneNotSupportedException


Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.