|
GWT 2.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.core.client.JavaScriptObject
com.google.gwt.dom.client.Node
com.google.gwt.dom.client.Element
public class Element
All HTML element interfaces derive from this class.
Field Summary |
---|
Fields inherited from class com.google.gwt.dom.client.Node |
---|
DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE |
Constructor Summary | |
---|---|
protected |
Element()
|
Method Summary | |
---|---|
void |
addClassName(java.lang.String className)
Adds a name to this element's class property. |
static Element |
as(JavaScriptObject o)
Assert that the given Node is an Element and automatically
typecast it. |
static Element |
as(Node node)
Assert that the given Node is an Element and automatically
typecast it. |
void |
blur()
Removes keyboard focus from this element. |
void |
dispatchEvent(NativeEvent evt)
Dispatched the given event with this element as its target. |
void |
focus()
Gives keyboard focus to this element. |
int |
getAbsoluteBottom()
Gets an element's absolute bottom coordinate in the document's coordinate system. |
int |
getAbsoluteLeft()
Gets an element's absolute left coordinate in the document's coordinate system. |
int |
getAbsoluteRight()
Gets an element's absolute right coordinate in the document's coordinate system. |
int |
getAbsoluteTop()
Gets an element's absolute top coordinate in the document's coordinate system. |
java.lang.String |
getAttribute(java.lang.String name)
Retrieves an attribute value by name. |
java.lang.String |
getClassName()
The class attribute of the element. |
int |
getClientHeight()
Returns the inner height of an element in pixels, including padding but not the horizontal scrollbar height, border, or margin. |
int |
getClientWidth()
Returns the inner width of an element in pixels, including padding but not the vertical scrollbar width, border, or margin. |
java.lang.String |
getDir()
Specifies the base direction of directionally neutral text and the directionality of tables. |
NodeList<Element> |
getElementsByTagName(java.lang.String name)
Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are encountered in a preorder traversal of this Element tree. |
Element |
getFirstChildElement()
The first child of element this element. |
java.lang.String |
getId()
The element's identifier. |
java.lang.String |
getInnerHTML()
All of the markup and content within a given element. |
java.lang.String |
getInnerText()
The text between the start and end tags of the object. |
java.lang.String |
getLang()
Language code defined in RFC 1766. |
Element |
getNextSiblingElement()
The element immediately following this element. |
int |
getOffsetHeight()
The height of an element relative to the layout. |
int |
getOffsetLeft()
The number of pixels that the upper left corner of the current element is offset to the left within the offsetParent node. |
Element |
getOffsetParent()
Returns a reference to the object which is the closest (nearest in the containment hierarchy) positioned containing element. |
int |
getOffsetTop()
The number of pixels that the upper top corner of the current element is offset to the top within the offsetParent node. |
int |
getOffsetWidth()
The width of an element relative to the layout. |
boolean |
getPropertyBoolean(java.lang.String name)
Gets a boolean property from this element. |
double |
getPropertyDouble(java.lang.String name)
Gets a double property from this element. |
int |
getPropertyInt(java.lang.String name)
Gets an integer property from this element. |
JavaScriptObject |
getPropertyJSO(java.lang.String name)
Gets a JSO property from this element. |
java.lang.Object |
getPropertyObject(java.lang.String name)
Gets an object property from this element. |
java.lang.String |
getPropertyString(java.lang.String name)
Gets a property from this element. |
int |
getScrollHeight()
The height of the scroll view of an element. |
int |
getScrollLeft()
The number of pixels that an element's content is scrolled from the left. |
int |
getScrollTop()
The number of pixels that an element's content is scrolled from the top. |
int |
getScrollWidth()
The width of the scroll view of an element. |
java.lang.String |
getString()
Gets a string representation of this element (as outer HTML). |
Style |
getStyle()
Gets this element's Style object. |
int |
getTabIndex()
The index that represents the element's position in the tabbing order. |
java.lang.String |
getTagName()
Gets the element's full tag name, including the namespace-prefix if present. |
java.lang.String |
getTitle()
The element's advisory title. |
boolean |
hasAttribute(java.lang.String name)
Determines whether an element has an attribute with a given name. |
boolean |
hasTagName(java.lang.String tagName)
Determines whether this element has the given tag name. |
static boolean |
is(JavaScriptObject o)
Determines whether the given JavaScriptObject can be cast to an
Element . |
static boolean |
is(Node node)
Determine whether the given Node can be cast to an Element . |
void |
removeAttribute(java.lang.String name)
Removes an attribute by name. |
void |
removeClassName(java.lang.String className)
Removes a name from this element's class property. |
void |
replaceClassName(java.lang.String oldClassName,
java.lang.String newClassName)
Replace one class name with another. |
void |
scrollIntoView()
Scrolls this element into view. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Adds a new attribute. |
void |
setClassName(java.lang.String className)
The class attribute of the element. |
void |
setDir(java.lang.String dir)
Specifies the base direction of directionally neutral text and the directionality of tables. |
void |
setId(java.lang.String id)
The element's identifier. |
void |
setInnerHTML(java.lang.String html)
All of the markup and content within a given element. |
void |
setInnerText(java.lang.String text)
The text between the start and end tags of the object. |
void |
setLang(java.lang.String lang)
Language code defined in RFC 1766. |
void |
setPropertyBoolean(java.lang.String name,
boolean value)
Sets a boolean property on this element. |
void |
setPropertyDouble(java.lang.String name,
double value)
Sets a double property on this element. |
void |
setPropertyInt(java.lang.String name,
int value)
Sets an integer property on this element. |
void |
setPropertyJSO(java.lang.String name,
JavaScriptObject value)
Sets a JSO property on this element. |
void |
setPropertyObject(java.lang.String name,
java.lang.Object value)
Sets an object property on this element. |
void |
setPropertyString(java.lang.String name,
java.lang.String value)
Sets a property on this element. |
void |
setScrollLeft(int scrollLeft)
The number of pixels that an element's content is scrolled to the left. |
void |
setScrollTop(int scrollTop)
The number of pixels that an element's content is scrolled to the top. |
void |
setTabIndex(int tabIndex)
The index that represents the element's position in the tabbing order. |
void |
setTitle(java.lang.String title)
The element's advisory title. |
Methods inherited from class com.google.gwt.dom.client.Node |
---|
appendChild, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, isOrHasChild, removeChild, removeFromParent, replaceChild, setNodeValue |
Methods inherited from class com.google.gwt.core.client.JavaScriptObject |
---|
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Element()
Method Detail |
---|
public static Element as(JavaScriptObject o)
Node
is an Element
and automatically
typecast it.
public static Element as(Node node)
Node
is an Element
and automatically
typecast it.
public static boolean is(JavaScriptObject o)
JavaScriptObject
can be cast to an
Element
. A null
object will cause this method to
return false
.
public static boolean is(Node node)
Node
can be cast to an Element
.
A null
node will cause this method to return
false
.
public final void addClassName(java.lang.String className)
className
- the class name to be addedsetClassName(String)
public final void blur()
public final void dispatchEvent(NativeEvent evt)
uncaught exception handler
as usual.
evt
- the event to be dispatchedpublic final void focus()
public final int getAbsoluteBottom()
public final int getAbsoluteLeft()
public final int getAbsoluteRight()
public final int getAbsoluteTop()
public final java.lang.String getAttribute(java.lang.String name)
Element
and its specific subclasses to retrieve attributes and
properties.
name
- The name of the attribute to retrieve
public final java.lang.String getClassName()
public final int getClientHeight()
public final int getClientWidth()
public final java.lang.String getDir()
public final NodeList<Element> getElementsByTagName(java.lang.String name)
name
- The name of the tag to match on. The special value "*" matches
all tags
public final Element getFirstChildElement()
public final java.lang.String getId()
public final java.lang.String getInnerHTML()
public final java.lang.String getInnerText()
public final java.lang.String getLang()
public final Element getNextSiblingElement()
public final int getOffsetHeight()
public final int getOffsetLeft()
public final Element getOffsetParent()
public final int getOffsetTop()
public final int getOffsetWidth()
public final boolean getPropertyBoolean(java.lang.String name)
name
- the name of the property to be retrieved
public final double getPropertyDouble(java.lang.String name)
name
- the name of the property to be retrieved
public final int getPropertyInt(java.lang.String name)
name
- the name of the property to be retrieved
public final JavaScriptObject getPropertyJSO(java.lang.String name)
name
- the name of the property to be retrieved
public final java.lang.Object getPropertyObject(java.lang.String name)
name
- the name of the property to be retrieved
public final java.lang.String getPropertyString(java.lang.String name)
name
- the name of the property to be retrieved
public final int getScrollHeight()
public final int getScrollLeft()
If the element is in RTL mode, this method will return a negative value of the number of pixels scrolled from the right.
public final int getScrollTop()
public final int getScrollWidth()
public final java.lang.String getString()
JavaScriptObject.toString()
because it is final in
JavaScriptObject
.
public final Style getStyle()
Style
object.
public final int getTabIndex()
public final java.lang.String getTagName()
public final java.lang.String getTitle()
public final boolean hasAttribute(java.lang.String name)
Note that IE, prior to version 8, will return false-positives for names that collide with element properties (e.g., style, width, and so forth).
name
- the name of the attribute
true
if this element has the specified attributepublic final boolean hasTagName(java.lang.String tagName)
tagName
- the tag name, including namespace-prefix (if present)
true
if the element has the given tag namepublic final void removeAttribute(java.lang.String name)
public final void removeClassName(java.lang.String className)
className
- the class name to be addedsetClassName(String)
public final void replaceClassName(java.lang.String oldClassName, java.lang.String newClassName)
oldClassName
- the class name to be replacednewClassName
- the class name to replace itpublic final void scrollIntoView()
This method crawls up the DOM hierarchy, adjusting the scrollLeft and scrollTop properties of each scrollable element to ensure that the specified element is completely in view. It adjusts each scroll position by the minimum amount necessary.
public final void setAttribute(java.lang.String name, java.lang.String value)
name
- The name of the attribute to create or altervalue
- Value to set in string formpublic final void setClassName(java.lang.String className)
public final void setDir(java.lang.String dir)
public final void setId(java.lang.String id)
public final void setInnerHTML(java.lang.String html)
public final void setInnerText(java.lang.String text)
public final void setLang(java.lang.String lang)
public final void setPropertyBoolean(java.lang.String name, boolean value)
name
- the name of the property to be setvalue
- the new property valuepublic final void setPropertyDouble(java.lang.String name, double value)
name
- the name of the property to be setvalue
- the new property valuepublic final void setPropertyInt(java.lang.String name, int value)
name
- the name of the property to be setvalue
- the new property valuepublic final void setPropertyJSO(java.lang.String name, JavaScriptObject value)
name
- the name of the property to be setvalue
- the new property valuepublic final void setPropertyObject(java.lang.String name, java.lang.Object value)
name
- the name of the property to be setvalue
- the new property valuepublic final void setPropertyString(java.lang.String name, java.lang.String value)
name
- the name of the property to be setvalue
- the new property valuepublic final void setScrollLeft(int scrollLeft)
public final void setScrollTop(int scrollTop)
public final void setTabIndex(int tabIndex)
public final void setTitle(java.lang.String title)
|
GWT 2.2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |