com.gargoylesoftware.htmlunit.html
Class ClickableElement

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.StyledElement
                      extended by com.gargoylesoftware.htmlunit.html.ClickableElement
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
FocusableElement, HtmlAddress, HtmlBlockQuote, HtmlBody, HtmlCaption, HtmlCenter, HtmlDefinitionDescription, HtmlDefinitionList, HtmlDefinitionTerm, HtmlDeletedText, HtmlDivision, HtmlFieldSet, HtmlForm, HtmlHeader1, HtmlHeader2, HtmlHeader3, HtmlHeader4, HtmlHeader5, HtmlHeader6, HtmlHorizontalRule, HtmlImage, HtmlInlineQuotation, HtmlInsertedText, HtmlLabel, HtmlLegend, HtmlLink, HtmlListItem, HtmlMap, HtmlMenu, HtmlNoFrames, HtmlNoScript, HtmlObject, HtmlOption, HtmlOptionGroup, HtmlOrderedList, HtmlParagraph, HtmlPreformattedText, HtmlSpan, HtmlTable, HtmlTableCell, HtmlTableColumn, HtmlTableColumnGroup, HtmlTableRow, HtmlTextDirection, HtmlUnorderedList, TableRowGroup, UnknownHtmlElement

public abstract class ClickableElement
extends StyledElement

Intermediate base class for "clickable" HTML elements. As defined HTML 4.01 documentation, this class is a base class for all HTML elements except these: applet, base, basefront, bdo, br, font, frame, frameset, head, html, iframe, isindex, meta, param, script, style, and title.

Version:
$Revision: 2132 $
Author:
David K. Taylor, Mike Bowler, Jun Chen, Christian Sell, David D. Kilzer, Marc Guillemot, Ahmed Ashour
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
HtmlElement.ChildElementsIterator, HtmlElement.MapEntryWrappingIterator
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.DomNode
DomNode.ChildIterator, DomNode.DescendantElementsIterator
 
Field Summary
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY, TAB_INDEX_OUT_OF_BOUNDS
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
ATTRIBUTE_NODE, COMMENT_NODE, DOCUMENT_NODE, ELEMENT_NODE, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED, TEXT_NODE
 
Constructor Summary
protected ClickableElement(String namespaceURI, String qualifiedName, HtmlPage page, Map attributes)
          Create an instance
 
Method Summary
 Page click()
          Simulate clicking this element.
 Page click(boolean shiftKey, boolean ctrlKey, boolean altKey)
          Simulate clicking this element.
 Page click(com.gargoylesoftware.htmlunit.javascript.host.Event event)
          INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Simulate clicking this element.
 Page dblClick()
          Simulate double clicking this element, note that click() is called first.
 Page dblClick(boolean shiftKey, boolean ctrlKey, boolean altKey)
          Simulate double clicking this element, note that click(boolean, boolean, boolean) is called first.
protected  Page doClickAction(Page defaultPage)
          This method will be called if there either wasn't an onclick handler or there was but the result of that handler wasn't false.
 String getLangAttribute()
          Return the value of the attribute "lang".
 String getOnClickAttribute()
          Return the value of the attribute "onclick".
 String getOnDblClickAttribute()
          Return the value of the attribute "ondblclick".
 String getOnKeyDownAttribute()
          Return the value of the attribute "onkeydown".
 String getOnKeyPressAttribute()
          Return the value of the attribute "onkeypress".
 String getOnKeyUpAttribute()
          Return the value of the attribute "onkeyup".
 String getOnMouseDownAttribute()
          Return the value of the attribute "onmousedown".
 String getOnMouseMoveAttribute()
          Return the value of the attribute "onmousemove".
 String getOnMouseOutAttribute()
          Return the value of the attribute "onmouseout".
 String getOnMouseOverAttribute()
          Return the value of the attribute "onmouseover".
 String getOnMouseUpAttribute()
          Return the value of the attribute "onmouseup".
 String getTextDirectionAttribute()
          Return the value of the attribute "dir".
 String getXmlLangAttribute()
          Return the value of the attribute "xml:lang".
protected  boolean isStateUpdateFirst()
          Return true if the state update should be done before onclick event handling.
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.StyledElement
getClassAttribute, getIdAttribute, getStyleAttribute, getTitleAttribute, isRenderedVisible
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.HtmlElement
addHtmlAttributeChangeListener, appendChildIfNoneExists, assertNotEmpty, blur, cloneDomNode, cloneNode, fireEvent, fireEvent, fireHtmlAttributeAdded, fireHtmlAttributeRemoved, fireHtmlAttributeReplaced, focus, getAttribute, getAttributeEntriesIterator, getAttributeNS, getAttributeValue, getChildElementsIterator, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getEventHandler, getHtmlElementById, getHtmlElementsByAttribute, getHtmlElementsByTagName, getHtmlElementsByTagNames, getId, getNodeName, getNodeType, getOneHtmlElementByAttribute, getTabIndex, getTagName, hasAttribute, hasAttributeNS, hasAttributes, hasHtmlElementWithId, isAttributeDefined, isEmptyXmlTagExpanded, isSubmittableByEnter, keyDown, keyDown, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, notImplemented, preventDefault, printOpeningTagContentAsXml, printXml, removeAttribute, removeAttributeNS, removeChild, removeEventHandler, removeHtmlAttributeChangeListener, rightClick, rightClick, setAttribute, setAttributeNS, setAttributeValue, setAttributeValue, setEventHandler, setEventHandler, setId, toString, type, type, type, type
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNamespaceNode
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode
addDomChangeListener, addPropertyChangeListener, appendChild, appendDomChild, asText, asXml, fireNodeAdded, fireNodeDeleted, firePropertyChange, getAllHtmlChildElements, getByXPath, getChildIterator, getChildrenAsText, getEndColumnNumber, getEndLineNumber, getFirstByXPath, getFirstChild, getFirstDomChild, getLastChild, getLastDomChild, getLog, getNativePage, getNextDomSibling, getNextSibling, getNodeValue, getPage, getParentDomNode, getParentNode, getPreviousDomSibling, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, insertBefore, isAncestorOf, isTrimmedText, notifyIncorrectness, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, reduceWhitespace, remove, removeAllChildren, removeDomChangeListener, removePropertyChangeListener, replace, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClickableElement

protected ClickableElement(String namespaceURI,
                           String qualifiedName,
                           HtmlPage page,
                           Map attributes)
Create an instance

Parameters:
namespaceURI - the URI that identifies an XML namespace.
qualifiedName - The qualified name of the element type to instantiate
page - The page that contains this element
attributes - the initial attributes
Method Detail

click

public Page click()
           throws IOException
Simulate clicking this element.

Returns:
The page that occupies this window after this element is clicked. It may be the same window or it may be a freshly loaded one.
Throws:
IOException - If an IO error occurs

click

public Page click(boolean shiftKey,
                  boolean ctrlKey,
                  boolean altKey)
           throws IOException
Simulate clicking this element.

Parameters:
shiftKey - true if SHIFT is pressed
ctrlKey - true if CTRL is pressed
altKey - true if ALT is pressed
Returns:
The page that occupies this window after this element is clicked. It may be the same window or it may be a freshly loaded one.
Throws:
IOException - If an IO error occurs

click

public Page click(com.gargoylesoftware.htmlunit.javascript.host.Event event)
           throws IOException
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Simulate clicking this element.

Parameters:
event - the click event used.
Returns:
The page that occupies this window after this element is clicked. It may be the same window or it may be a freshly loaded one.
Throws:
IOException - If an IO error occurs

dblClick

public Page dblClick()
              throws IOException
Simulate double clicking this element, note that click() is called first.

Returns:
The page that occupies this window after this element is double clicked. It may be the same window or it may be a freshly loaded one.
Throws:
IOException - If an IO error occurs

dblClick

public Page dblClick(boolean shiftKey,
                     boolean ctrlKey,
                     boolean altKey)
              throws IOException
Simulate double clicking this element, note that click(boolean, boolean, boolean) is called first.

Parameters:
shiftKey - true if SHIFT is pressed
ctrlKey - true if CTRL is pressed
altKey - true if ALT is pressed
Returns:
The page that occupies this window after this element is double clicked. It may be the same window or it may be a freshly loaded one.
Throws:
IOException - If an IO error occurs

doClickAction

protected Page doClickAction(Page defaultPage)
                      throws IOException
This method will be called if there either wasn't an onclick handler or there was but the result of that handler wasn't false. This is the default behavior of clicking the element. The default implementation returns the current page - subclasses requiring different behavior (like HtmlSubmitInput) will override this method.

Parameters:
defaultPage - The default page to return if the action does not load a new page.
Returns:
The page that is currently loaded after execution of this method
Throws:
IOException - If an IO error occurred

getLangAttribute

public final String getLangAttribute()
Return the value of the attribute "lang". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "lang" or an empty string if that attribute isn't defined.

getXmlLangAttribute

public final String getXmlLangAttribute()
Return the value of the attribute "xml:lang". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "xml:lang" or an empty string if that attribute isn't defined.

getTextDirectionAttribute

public final String getTextDirectionAttribute()
Return the value of the attribute "dir". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "dir" or an empty string if that attribute isn't defined.

getOnClickAttribute

public final String getOnClickAttribute()
Return the value of the attribute "onclick". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onclick" or an empty string if that attribute isn't defined.

getOnDblClickAttribute

public final String getOnDblClickAttribute()
Return the value of the attribute "ondblclick". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "ondblclick" or an empty string if that attribute isn't defined.

getOnMouseDownAttribute

public final String getOnMouseDownAttribute()
Return the value of the attribute "onmousedown". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onmousedown" or an empty string if that attribute isn't defined.

getOnMouseUpAttribute

public final String getOnMouseUpAttribute()
Return the value of the attribute "onmouseup". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onmouseup" or an empty string if that attribute isn't defined.

getOnMouseOverAttribute

public final String getOnMouseOverAttribute()
Return the value of the attribute "onmouseover". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onmouseover" or an empty string if that attribute isn't defined.

getOnMouseMoveAttribute

public final String getOnMouseMoveAttribute()
Return the value of the attribute "onmousemove". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onmousemove" or an empty string if that attribute isn't defined.

getOnMouseOutAttribute

public final String getOnMouseOutAttribute()
Return the value of the attribute "onmouseout". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onmouseout" or an empty string if that attribute isn't defined.

getOnKeyPressAttribute

public final String getOnKeyPressAttribute()
Return the value of the attribute "onkeypress". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onkeypress" or an empty string if that attribute isn't defined.

getOnKeyDownAttribute

public final String getOnKeyDownAttribute()
Return the value of the attribute "onkeydown". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onkeydown" or an empty string if that attribute isn't defined.

getOnKeyUpAttribute

public final String getOnKeyUpAttribute()
Return the value of the attribute "onkeyup". Refer to the HTML 4.01 documentation for details on the use of this attribute.

Returns:
The value of the attribute "onkeyup" or an empty string if that attribute isn't defined.

isStateUpdateFirst

protected boolean isStateUpdateFirst()
Return true if the state update should be done before onclick event handling. This is expected to be overridden to return "true" by derived classes like HtmlCheckBoxInput.

Returns:
Return true if state update should be done first.


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