com.gargoylesoftware.htmlunit.html
Class HtmlImage

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
                          extended by com.gargoylesoftware.htmlunit.html.HtmlImage
All Implemented Interfaces:
Serializable, Cloneable

public class HtmlImage
extends ClickableElement

Wrapper for the html element "img".

Version:
$Revision: 2132 $
Author:
Mike Bowler, David K. Taylor, Christian Sell, 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
static String TAG_NAME
          the HTML tag represented by this element
 
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
HtmlImage(HtmlPage page, Map attributes)
          Deprecated. You should not directly construct HtmlImage.
 
Method Summary
 Page click()
          Simulate clicking this element.
 Page click(int x, int y)
          Simulate clicking this element at the given position.
protected  Page doClickAction(Page defaultPage)
          Performs the click action on the enclosing A tag (if any).
 String getAlignAttribute()
          Return the value of the attribute "align".
 String getAltAttribute()
          Return the value of the attribute "alt".
 String getBorderAttribute()
          Return the value of the attribute "border".
 String getHeightAttribute()
          Return the value of the attribute "height".
 String getHspaceAttribute()
          Return the value of the attribute "hspace".
 String getIsmapAttribute()
          Return the value of the attribute "ismap".
 String getLongDescAttribute()
          Return the value of the attribute "longdesc".
 String getNameAttribute()
          Return the value of the attribute "name".
 String getSrcAttribute()
          Return the value of the attribute "src".
 String getUseMapAttribute()
          Return the value of the attribute "usemap".
 String getVspaceAttribute()
          Return the value of the attribute "vspace".
 String getWidthAttribute()
          Return the value of the attribute "width".
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.ClickableElement
click, click, dblClick, dblClick, getLangAttribute, getOnClickAttribute, getOnDblClickAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getTextDirectionAttribute, getXmlLangAttribute, isStateUpdateFirst
 
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
 

Field Detail

TAG_NAME

public static final String TAG_NAME
the HTML tag represented by this element

See Also:
Constant Field Values
Constructor Detail

HtmlImage

public HtmlImage(HtmlPage page,
                 Map attributes)
Deprecated. You should not directly construct HtmlImage.

Create an instance of HtmlImage

Parameters:
page - The HtmlPage that contains this element.
attributes - the initial attributes
Method Detail

getSrcAttribute

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

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

getAltAttribute

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

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

getNameAttribute

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

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

getLongDescAttribute

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

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

getHeightAttribute

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

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

getWidthAttribute

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

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

getUseMapAttribute

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

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

getIsmapAttribute

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

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

getAlignAttribute

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

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

getBorderAttribute

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

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

getHspaceAttribute

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

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

getVspaceAttribute

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

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

click

public Page click(int x,
                  int y)
           throws IOException
Simulate clicking this element at the given position. This makes only sense for an image map (currently only server side) where the position matters.

Parameters:
x - the x position of the click
y - the y position of the click
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()
           throws IOException
Simulate clicking this element.

Overrides:
click in class ClickableElement
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

doClickAction

protected Page doClickAction(Page defaultPage)
                      throws IOException
Performs the click action on the enclosing A tag (if any).

Overrides:
doClickAction in class ClickableElement
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


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