Package org.zkoss.idom.impl
Class AbstractTextual
java.lang.Object
org.zkoss.idom.impl.AbstractItem
org.zkoss.idom.impl.AbstractTextual
- All Implemented Interfaces:
Serializable,Cloneable,CharacterData,Node,Item,Textual
Represents a textual item.
Note: any deriving class's getText shall not return null.
Element.getText uses this class's isPartOfParentText to know whether a child's text shall be concatenated.
- Author:
- tomyeh
- See Also:
-
Field Summary
FieldsFields inherited from interface org.zkoss.idom.Item
FIND_BY_PREFIX, FIND_BY_REGEX, FIND_BY_TAGNAME, FIND_IGNORE_CASE, FIND_RECURSIVEFields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedAbstractTextual(String text) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidappendData(String newData) protected voidChecks whether the text is valid.final voiddeleteData(int offset, int count) final StringgetData()final intgetText()final voidinsertData(int offset, String arg) booleanReturns true if this textual object is allowed to be coalesced with its siblings with the same type (class).booleanbooleanReturns true if this text object is part of the parent's text.final voidreplaceData(int offset, int count, String arg) replaceWholeText(String content) final voidvoidSets the text of this item.split(int offset) Splits at the specified offset into two Textual objects.final TextsplitText(int offset) final StringsubstringData(int offset, int count) toString()Gets the textual representation for debug.Methods inherited from class org.zkoss.idom.impl.AbstractItem
appendChild, clone, cloneNode, compareDocumentPosition, detach, equals, getAttributes, getBaseURI, getChildNodes, getDocument, getFeature, getFirstChild, getLastChild, getLocalName, getLocator, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParent, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, hashCode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, match, normalize, removeChild, replaceChild, setLocator, setName, setNodeValue, setParent, setPrefix, setTextContent, setUserDataMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Field Details
-
_text
The text.
-
-
Constructor Details
-
AbstractTextual
Constructor. -
AbstractTextual
protected AbstractTextual()Constructor.
-
-
Method Details
-
isPartOfParentText
public boolean isPartOfParentText()Returns true if this text object is part of the parent's text. Default: true.- Specified by:
isPartOfParentTextin interfaceTextual
-
isCoalesceable
public boolean isCoalesceable()Returns true if this textual object is allowed to be coalesced with its siblings with the same type (class). It is used by Group.coalesce.Default: false. Right now only Text override it to true.
- Specified by:
isCoalesceablein interfaceTextual
-
split
Description copied from interface:TextualSplits at the specified offset into two Textual objects. The new textual object is inserted right after this one. -
checkText
Checks whether the text is valid. It is usually overridden by the deriving classes to check more specifically. -
getText
Description copied from interface:ItemGets the text of this item, or null if it is neitherTextualnorElement. 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.
- Specified by:
getTextin interfaceItem- Overrides:
getTextin classAbstractItem
-
setText
Description copied from interface:ItemSets the text of this item.- Specified by:
setTextin interfaceItem- Overrides:
setTextin classAbstractItem
-
getLength
public final int getLength()- Specified by:
getLengthin interfaceCharacterData
-
getData
- Specified by:
getDatain interfaceCharacterData
-
setData
- Specified by:
setDatain interfaceCharacterData
-
substringData
- Specified by:
substringDatain interfaceCharacterData
-
appendData
- Specified by:
appendDatain interfaceCharacterData
-
insertData
- Specified by:
insertDatain interfaceCharacterData
-
deleteData
public final void deleteData(int offset, int count) - Specified by:
deleteDatain interfaceCharacterData
-
replaceData
- Specified by:
replaceDatain interfaceCharacterData
-
splitText
-
isElementContentWhitespace
public boolean isElementContentWhitespace() -
getWholeText
-
replaceWholeText
- Throws:
DOMException
-
getTextContent
- Specified by:
getTextContentin interfaceNode- Overrides:
getTextContentin classAbstractItem
-
toString
Gets the textual representation for debug.
-