|
||||||||||
| 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 |
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 | |
|---|---|
static Element |
as(com.google.gwt.dom.client.Node node)
Casts a Node to an instance of this type. |
boolean |
canHaveChildren()
|
void |
ensureEditable()
Ensures this element can be edited in design mode. |
Element |
expandInnerMetaData()
Expands inner elements with meta data. |
com.google.gwt.dom.client.Node |
expandMetaData(boolean deep)
Expands the meta data of this element and its descendants. |
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()
|
Attribute |
getAttributeNode(java.lang.String attributeName)
|
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 |
hasAttributes()
|
boolean |
hasClassName(java.lang.String className)
|
void |
removeProperty(java.lang.String propertyName)
Removes a property from this element. |
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()
|
boolean |
xHasAttribute(java.lang.String attributeName)
Checks if this element has the specified attribute. |
void |
xRemoveAttribute(java.lang.String attributeName)
Removes an attribute by name. |
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 |
|---|
addClassName, as, dispatchEvent, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getAttribute, getClassName, getClientHeight, getClientWidth, getDir, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyJSO, getPropertyObject, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTagName, getTitle, hasAttribute, hasTagName, is, is, removeAttribute, removeClassName, replaceClassName, scrollIntoView, setAttribute, setClassName, setDir, setId, setInnerHTML, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyJSO, setPropertyObject, setPropertyString, setScrollLeft, setScrollTop, setTitle |
| 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 |
| 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
| 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 Element expandInnerMetaData()
public final com.google.gwt.dom.client.Node expandMetaData(boolean deep)
deep - true to expand the inner elements with meta data, false otherwise
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 canHaveChildren()
true if HTML Strict DTD specifies that this element can have children, false otherwisepublic 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 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 ensureEditable()
public final void removeProperty(java.lang.String propertyName)
propertyName - the name of the property to be removedElement.setPropertyBoolean(String, boolean),
Element.setPropertyDouble(String, double),
Element.setPropertyInt(String, int),
Element.setPropertyString(String, String)public final boolean xHasAttribute(java.lang.String attributeName)
NOTE: We added this method in order to fix an IE7 bug in Element.removeAttribute(String). It seems that
Node.cloneNode(boolean) doesn't clone the attributes in IE7 but only copies their references to the clone. As
a consequence an attribute can be shared by multiple elements. When we Element.removeAttribute(String) the
specified flag is set to false and thus Element.hasAttribute(String), which uses this flag in
its IE7 implementation, mistakenly reports the attribute as missing from the rest of the elements that share it.
attributeName - the name of an attribute
true if this element has the specified attribute, false otherwiseElement.hasAttribute(String),
http://code.google.com/p/google-web-toolkit/issues/detail?id=4690public final Attribute getAttributeNode(java.lang.String attributeName)
attributeName - the name of an attribute
public final void xRemoveAttribute(java.lang.String attributeName)
We added this method to fix a bug in IE7 which allows shared attribute nodes. Removing a shared attribute affects all the element that share it and also can crash the browser if the attribute is remove twice.
attributeName - the name of the attribute to removexHasAttribute(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||