|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.idom.impl.AbstractItem
public abstract class AbstractItem
A semi-implemented item for leaf vertices. A leaf item is a item without any children. For cores having child cores, use Group.
Important methods that the deriving might want to override.
Item,
Serialized Form| Field Summary |
|---|
| Fields inherited from interface org.zkoss.idom.Item |
|---|
FIND_BY_PREFIX, FIND_BY_REGEX, FIND_BY_TAGNAME, FIND_IGNORE_CASE, FIND_RECURSIVE |
| Constructor Summary | |
|---|---|
protected |
AbstractItem()
Constructor. |
| Method Summary | |
|---|---|
Node |
appendChild(Node newChild)
|
Object |
clone()
Clones this object (a deep cloning not including contents contained in Textual nodes). |
Node |
cloneNode(boolean deep)
|
short |
compareDocumentPosition(Node other)
|
Item |
detach()
Detach this item from its parent. |
boolean |
equals(Object o)
Overriding this method is prohibited. |
NamedNodeMap |
getAttributes()
|
String |
getBaseURI()
|
NodeList |
getChildNodes()
|
Document |
getDocument()
Gets the document that owns this item. |
Object |
getFeature(String feature,
String version)
|
Node |
getFirstChild()
|
Node |
getLastChild()
|
String |
getLocalName()
|
Locator |
getLocator()
Gets the locator of this item. |
String |
getNamespaceURI()
|
Node |
getNextSibling()
|
String |
getNodeName()
|
String |
getNodeValue()
|
Document |
getOwnerDocument()
|
Group |
getParent()
Gets the parent item. |
Node |
getParentNode()
|
String |
getPrefix()
|
Node |
getPreviousSibling()
|
String |
getText()
Gets the text of this item, or null if it is neither Textual
nor Element. |
String |
getTextContent()
|
Object |
getUserData(String key)
|
boolean |
hasAttributes()
|
boolean |
hasChildNodes()
|
int |
hashCode()
Overriding this method is prohibited. |
Node |
insertBefore(Node newChild,
Node refChild)
|
boolean |
isDefaultNamespace(String namespaceURI)
|
boolean |
isEqualNode(Node arg)
|
boolean |
isSameNode(Node other)
|
boolean |
isSupported(String feature,
String version)
|
String |
lookupNamespaceURI(String prefix)
|
String |
lookupPrefix(String namespaceURI)
|
protected static boolean |
match(Namespaceable vtx,
String namespace,
String name,
Pattern ptn,
int mode)
Tests whether a namespaceable item matches the criteria. |
void |
normalize()
|
Node |
removeChild(Node oldChild)
|
Node |
replaceChild(Node newChild,
Node oldChild)
|
void |
setLocator(Locator loc)
Sets the locator of this item. |
void |
setName(String name)
Sets the name of the item. |
void |
setNodeValue(String nodeValue)
|
void |
setParent(Group parent)
Sets the parent item. |
void |
setPrefix(String prefix)
|
void |
setText(String text)
Sets the text of this item. |
void |
setTextContent(String textContent)
|
Object |
setUserData(String key,
Object data,
UserDataHandler handler)
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.zkoss.idom.Item |
|---|
getName |
| Methods inherited from interface org.w3c.dom.Node |
|---|
getNodeType |
| Constructor Detail |
|---|
protected AbstractItem()
| Method Detail |
|---|
protected static boolean match(Namespaceable vtx,
String namespace,
String name,
Pattern ptn,
int mode)
public void setName(String name)
Item
setName in interface ItemNamespaceable.setTagName(java.lang.String)public String getText()
ItemTextual
nor Element.
For Element, the text is the concatenation of all its textual
children, including Text, CDATA, and Binary.
Besides String-type value, some item, e.g., Binary, allows any type of objects. Caller could test whether a item implements the Binable interface, and use Binable.getValue instead. For binable vertices, getText is actually getValue().toString().
The returned value is neither trimmed nor normalized.
getText in interface Itempublic void setText(String text)
Item
setText in interface Itempublic Document getDocument()
Item
getDocument in interface Itempublic Item detach()
ItemBecause each item can belong to at most one parent at a time, it is important to detach it first, before added to another tree -- even if it is the same tree/parent.
It has the similar effect as:
getParent().getChildren().remove(this).
Naming reason: we don't call this method as getChildren() to be compatible with the naming style of Attributable.attributes -- which is limited to org.w3c.dom.Attr.getAttributes. Also, it doesn't have the setter and it is "live", so it 'seem' better to call it getChildren().
detach in interface Itempublic final Group getParent()
Item
getParent in interface Itempublic void setParent(Group parent)
ItemDO NOT call this method. It is used internally. Instead, use detach or thru getChildren().
setParent in interface Itempublic final Locator getLocator()
Item
getLocator in interface Itempublic final void setLocator(Locator loc)
ItemUnlike other methods, it won't change the modification flag.
setLocator in interface Itemloc - the locator; null if not availablepublic String getNodeName()
getNodeName in interface Nodepublic String getNodeValue()
getNodeValue in interface Nodepublic void setNodeValue(String nodeValue)
setNodeValue in interface Nodepublic Document getOwnerDocument()
getOwnerDocument in interface Nodepublic final Node cloneNode(boolean deep)
cloneNode in interface Nodepublic final Node getParentNode()
getParentNode in interface Nodepublic final Node getPreviousSibling()
getPreviousSibling in interface Nodepublic final Node getNextSibling()
getNextSibling in interface Nodepublic NodeList getChildNodes()
getChildNodes in interface Nodepublic Node getFirstChild()
getFirstChild in interface Nodepublic Node getLastChild()
getLastChild in interface Nodepublic boolean hasChildNodes()
hasChildNodes in interface Node
public Node insertBefore(Node newChild,
Node refChild)
insertBefore in interface Node
public Node replaceChild(Node newChild,
Node oldChild)
replaceChild in interface Nodepublic Node removeChild(Node oldChild)
removeChild in interface Nodepublic Node appendChild(Node newChild)
appendChild in interface Nodepublic final void normalize()
normalize in interface Node
public final boolean isSupported(String feature,
String version)
isSupported in interface Nodepublic String getNamespaceURI()
getNamespaceURI in interface Nodepublic String getPrefix()
getPrefix in interface Nodepublic String getLocalName()
getLocalName in interface Nodepublic void setPrefix(String prefix)
setPrefix in interface Nodepublic NamedNodeMap getAttributes()
getAttributes in interface Nodepublic boolean hasAttributes()
hasAttributes in interface Nodepublic String getBaseURI()
getBaseURI in interface Node
public short compareDocumentPosition(Node other)
throws DOMException
compareDocumentPosition in interface NodeDOMException
public String getTextContent()
throws DOMException
getTextContent in interface NodeDOMException
public void setTextContent(String textContent)
throws DOMException
setTextContent in interface NodeDOMExceptionpublic boolean isSameNode(Node other)
isSameNode in interface Nodepublic String lookupPrefix(String namespaceURI)
lookupPrefix in interface Nodepublic boolean isDefaultNamespace(String namespaceURI)
isDefaultNamespace in interface Nodepublic String lookupNamespaceURI(String prefix)
lookupNamespaceURI in interface Nodepublic boolean isEqualNode(Node arg)
isEqualNode in interface Node
public Object getFeature(String feature,
String version)
getFeature in interface Node
public Object setUserData(String key,
Object data,
UserDataHandler handler)
setUserData in interface Nodepublic Object getUserData(String key)
getUserData in interface Nodepublic final boolean equals(Object o)
equals in class Objectpublic final int hashCode()
hashCode in class Objectpublic Object clone()
clone in interface Itemclone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||