|
|||||||||
| 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
org.xwiki.gwt.dom.client.Element
public class Element
Extends the element implementation provided by GWT to add useful methods. All of them should be removed as soon as they make their way into GWT's API.
| Field Summary | |
|---|---|
static java.lang.String |
CLASS_NAME_SEPARATOR
The class attribute is a space-separated list of CSS class names. |
static java.lang.String |
INNER_HTML_PLACEHOLDER
The text used in an element's meta data as a place holder for that element's outer HTML. |
static java.lang.String |
META_DATA_ATTR
The name of the DOM attribute storing the HTML of the meta data. |
static java.lang.String |
META_DATA_REF
The name of the JavaScript property storing the reference to the meta data. NOTE: We can't use the same name as for META_DATA_ATTR because IE stores attribute values as JavaScript
properties of DOM element objects. |
| Fields inherited from class com.google.gwt.dom.client.Node |
|---|
DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE |
| Constructor Summary | |
|---|---|
protected |
Element()
Default constructor. |
| Method Summary | |
|---|---|
void |
addClassName(java.lang.String className)
Adds a new CSS class name to this element's class attribute. |
static Element |
as(com.google.gwt.dom.client.Node node)
Casts a Node to an instance of this type. |
DocumentFragment |
extractContents()
Places all the children of this element in a document fragment and returns it. NOTE: The element will remain empty after this method call. |
com.google.gwt.core.client.JsArrayString |
getAttributeNames()
|
java.lang.String |
getComputedStyleProperty(java.lang.String propertyName)
Returns the value of the specified CSS property for this element as it is computed by the browser before the element is displayed. |
DocumentFragment |
getMetaData()
|
boolean |
hasAttribute(java.lang.String attrName)
|
boolean |
hasAttributes()
|
boolean |
hasClassName(java.lang.String className)
|
boolean |
mustBeEmpty()
|
void |
removeClassName(java.lang.String className)
Removes a CSS class name form this element's class attribute. |
void |
setMetaData(DocumentFragment metaData)
Sets the meta data of this element. |
void |
unwrap()
Replaces this element with its child nodes. |
void |
wrap(com.google.gwt.dom.client.Node node)
Wraps the passed node and takes its place in its parent. |
java.lang.String |
xGetAttribute(java.lang.String name)
Get the value for the specified attribute in cross browser manner. |
java.lang.String |
xGetInnerHTML()
|
java.lang.String |
xGetInnerText()
We need this method because Element.getInnerText() includes commented text in the output. |
java.lang.String |
xGetString()
|
void |
xSetAttribute(java.lang.String name,
java.lang.String value)
Sets the value for the specified attribute in a cross browser manner. |
void |
xSetInnerHTML(java.lang.String html)
Set inner HTML in cross browser manner and notify the owner document. |
| Methods inherited from class com.google.gwt.dom.client.Element |
|---|
getAbsoluteLeft, getAbsoluteTop, getAttribute, getClassName, getDir, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getParentElement, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTagName, getTitle, isOrHasChild, removeAttribute, scrollIntoView, setAttribute, setClassName, setDir, setId, setInnerHTML, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyString, setScrollLeft, setScrollTop, setTitle |
| Methods inherited from class com.google.gwt.dom.client.Node |
|---|
appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, removeChild, replaceChild, setNodeValue |
| Methods inherited from class com.google.gwt.core.client.JavaScriptObject |
|---|
cast, createArray, createFunction, createObject, equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String INNER_HTML_PLACEHOLDER
public static final java.lang.String META_DATA_REF
META_DATA_ATTR because IE stores attribute values as JavaScript
properties of DOM element objects.
public static final java.lang.String META_DATA_ATTR
public static final java.lang.String CLASS_NAME_SEPARATOR
class attribute is a space-separated list of CSS class names.
| Constructor Detail |
|---|
protected Element()
| Method Detail |
|---|
public static Element as(com.google.gwt.dom.client.Node node)
Node to an instance of this type.
node - the instance to be casted to this type.
Element.public final com.google.gwt.core.client.JsArrayString getAttributeNames()
http://code.google.com/p/google-web-toolkit/issues/detail?id=3054public final java.lang.String getComputedStyleProperty(java.lang.String propertyName)
fontWeight) and it is used like this object.style.propertyJSName = value. The CSS
name has dash style (font-weight) and it is used like this propertyCSSName: value;.
propertyName - the script name of the CSS property whose value is returned.
public final void xSetInnerHTML(java.lang.String html)
html - the html to set.DOMUtils#setInnerHTML(Element, String)},
http://code.google.com/p/google-web-toolkit/issues/detail?id=3146public final java.lang.String xGetInnerHTML()
Element.getInnerHTML()public final java.lang.String xGetString()
Element.getString()public final DocumentFragment extractContents()
public final void unwrap()
public final void wrap(com.google.gwt.dom.client.Node node)
node - the node to wrappublic final DocumentFragment getMetaData()
public final void setMetaData(DocumentFragment metaData)
metaData - a document fragment with additional information regarding this element.public final boolean mustBeEmpty()
public final java.lang.String xGetAttribute(java.lang.String name)
name - the name of the attribute
DOMUtils.getAttribute(Element, String)
public final void xSetAttribute(java.lang.String name,
java.lang.String value)
name - the name of the attributevalue - the value of the attributepublic final java.lang.String xGetInnerText()
Element.getInnerText() includes commented text in the output.
Element.getInnerText(),
http://code.google.com/p/google-web-toolkit/issues/detail?id=3275public final boolean hasAttribute(java.lang.String attrName)
attrName - a string representing the name of an attribute
http://code.google.com/p/google-web-toolkit/issues/detail?id=2852public final boolean hasAttributes()
true if this element has any attribute, false otherwisepublic final boolean hasClassName(java.lang.String className)
className - a String representing the CSS class to look for
true if this element's class attribute contains the given class name, false
otherwisepublic final void addClassName(java.lang.String className)
class attribute. The class attribute is a
space-separated list of CSS class names.
className - a String representing the CSS class to be appended to this element's class
attributeElement.setClassName(String)public final void removeClassName(java.lang.String className)
class attribute. The class attribute is a
space-separated list of CSS class names.
className - a String representing the CSS class to be removed from this element's class
attributeElement.setClassName(String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||