Package org.pepstock.charba.client.dom
Class BaseElement
- java.lang.Object
-
- org.pepstock.charba.client.dom.BaseEventTarget
-
- org.pepstock.charba.client.dom.BaseNode
-
- org.pepstock.charba.client.dom.BaseElement
-
- Direct Known Subclasses:
BaseHtmlElement
@JsType(isNative=true, name="Element", namespace="<global>") public abstract class BaseElement extends BaseNode
Base class from which all element objects (objects that represent elements) in a document inherit.
It only has methods and properties common to all kinds of elements.- Author:
- Andrea "Stock" Stocchero
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.pepstock.charba.client.dom.BaseEventTarget
BaseEventTarget.EventListenerCallback
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NamedNodeMap<BaseAttribute>
getAttributes()
Returns a collection of all attribute nodes registered to the specified node.int
getChildElementCount()
Returns the number of children of this element which are elements.int
getClientHeight()
Returns a number representing the inner height of the element.int
getClientLeft()
Returns a number representing the width of the left border of the element.int
getClientTop()
Returns a number representing the width of the top border of the element.int
getClientWidth()
Returns a number representing the inner width of the element.NodeList<BaseElement>
getElementsByTagName(String tagname)
Returns a list containing all descendant elements, of a particular tag name, from the current element.BaseElement
getFirstElementChild()
Returns the first node which is both a child of this element and is also an element, ornull
if there is none.String
getId()
Returns the unique id of the element.String
getInnerHTML()
Returns the markup of the element's content.BaseElement
getLastElementChild()
Returns the last node which is both a child of this element and is an element, ornull
if there is none.BaseElement
getNextElementSibling()
Returns the element immediately following the given one in the tree, ornull
if there's no sibling node.String
getOuterHTML()
Returns the serialized HTML fragment describing the element including its descendants.BaseElement
getPreviousElementSibling()
Returns the element immediately preceding the given one in the tree, ornull
if there is no sibling element.int
getScrollHeight()
Returns a number representing the scroll view height of an element.double
getScrollLeft()
Returns a number representing the left scroll offset of the element.double
getScrollTop()
Returns a number representing number of pixels the top of the document is scrolled vertically.int
getScrollWidth()
Returns a number representing the scroll view width of the element.String
getTagName()
Returns the name of the tag for the given element.boolean
hasAttributes()
Returns a boolean indicating whether the current element has any attributes or not.void
remove()
Removes the element from the children list of its parent.void
setId(String id)
Sets the unique id of the element.void
setInnerHTML(String innerHTML)
Sets the markup of the element's content..-
Methods inherited from class org.pepstock.charba.client.dom.BaseNode
appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, getTextContent, hasChildNodes, insertBefore, removeAllChildren, removeChild, setNodeValue, setTextContent
-
Methods inherited from class org.pepstock.charba.client.dom.BaseEventTarget
addEventListener, removeEventListener
-
-
-
-
Method Detail
-
getChildElementCount
@JsProperty public final int getChildElementCount()
Returns the number of children of this element which are elements.- Returns:
- the number of children of this element which are elements
-
getClientHeight
@JsProperty public final int getClientHeight()
Returns a number representing the inner height of the element.- Returns:
- a number representing the inner height of the element
-
getClientLeft
@JsProperty public final int getClientLeft()
Returns a number representing the width of the left border of the element.- Returns:
- a number representing the width of the left border of the element
-
getClientTop
@JsProperty public final int getClientTop()
Returns a number representing the width of the top border of the element.- Returns:
- a number representing the width of the top border of the element
-
getClientWidth
@JsProperty public final int getClientWidth()
Returns a number representing the inner width of the element.- Returns:
- a number representing the inner width of the element
-
getFirstElementChild
@JsProperty public final BaseElement getFirstElementChild()
Returns the first node which is both a child of this element and is also an element, ornull
if there is none.- Returns:
- the first node which is both a child of this element and is also an element, or
null
if there is none
-
getId
@JsProperty public final String getId()
Returns the unique id of the element.- Returns:
- the unique id of the element
-
setId
@JsProperty public final void setId(String id)
Sets the unique id of the element.- Parameters:
id
- the unique id of the element
-
getInnerHTML
@JsProperty public final String getInnerHTML()
Returns the markup of the element's content.- Returns:
- the markup of the element's content
-
setInnerHTML
@JsProperty public final void setInnerHTML(String innerHTML)
Sets the markup of the element's content..- Parameters:
innerHTML
- the markup of the element's content
-
getOuterHTML
@JsProperty public final String getOuterHTML()
Returns the serialized HTML fragment describing the element including its descendants.- Returns:
- the serialized HTML fragment describing the element including its descendants
-
getLastElementChild
@JsProperty public final BaseElement getLastElementChild()
Returns the last node which is both a child of this element and is an element, ornull
if there is none.- Returns:
- the last node which is both a child of this element and is an element, or
null
if there is none
-
getNextElementSibling
@JsProperty public final BaseElement getNextElementSibling()
Returns the element immediately following the given one in the tree, ornull
if there's no sibling node.- Returns:
- the element immediately following the given one in the tree, or
null
if there's no sibling node
-
getPreviousElementSibling
@JsProperty public final BaseElement getPreviousElementSibling()
Returns the element immediately preceding the given one in the tree, ornull
if there is no sibling element.- Returns:
- the element immediately preceding the given one in the tree, or
null
if there is no sibling element
-
getScrollHeight
@JsProperty public final int getScrollHeight()
Returns a number representing the scroll view height of an element.- Returns:
- a number representing the scroll view height of an element
-
getScrollLeft
@JsProperty public final double getScrollLeft()
Returns a number representing the left scroll offset of the element.- Returns:
- a number representing the left scroll offset of the element
-
getScrollTop
@JsProperty public final double getScrollTop()
Returns a number representing number of pixels the top of the document is scrolled vertically.- Returns:
- a number representing number of pixels the top of the document is scrolled vertically
-
getScrollWidth
@JsProperty public final int getScrollWidth()
Returns a number representing the scroll view width of the element.- Returns:
- a number representing the scroll view width of the element
-
getTagName
@JsProperty public final String getTagName()
Returns the name of the tag for the given element.- Returns:
- the name of the tag for the given element
-
getAttributes
@JsProperty public NamedNodeMap<BaseAttribute> getAttributes()
Returns a collection of all attribute nodes registered to the specified node.- Returns:
- a collection of all attribute nodes registered to the specified node
-
getElementsByTagName
@JsMethod public final NodeList<BaseElement> getElementsByTagName(String tagname)
Returns a list containing all descendant elements, of a particular tag name, from the current element.- Parameters:
tagname
- the qualified name to look for. The special string "*" represents all elements.- Returns:
- a list containing all descendant elements
-
remove
@JsMethod public final void remove()
Removes the element from the children list of its parent.
-
hasAttributes
@JsMethod public final boolean hasAttributes()
Returns a boolean indicating whether the current element has any attributes or not.- Returns:
true
whether the current element has any attributes
-
-