net.sourceforge.spedit.core
Class XMLTextWrapper
java.lang.Object
|
+--net.sourceforge.spedit.core.XMLTextWrapper
- All Implemented Interfaces:
- Element, TreeNode, XMLNode
- public class XMLTextWrapper
- extends Object
- implements Element, XMLNode, TreeNode
The XMLStringWrapper
class wraps an XMLString
so
as to it becomes usable in the Swing document model. As XMLString are
mutable, the wrapper contains a reference to its attached XMLString and
vice-versa.
element
protected XMLText element
parent
protected XMLElement parent
XMLTextWrapper
public XMLTextWrapper(XMLText element)
getElementCount
public int getElementCount()
- Specified by:
getElementCount
in interface Element
getElement
public Element getElement(int index)
- Specified by:
getElement
in interface Element
getElementIndex
public int getElementIndex(int offset)
- Specified by:
getElementIndex
in interface Element
getInformation
public XMLInformation getInformation()
- Specified by:
getInformation
in interface XMLNode
setInformation
public void setInformation(XMLInformation info)
- Specified by:
setInformation
in interface XMLNode
hasInformation
public boolean hasInformation()
- Specified by:
hasInformation
in interface XMLNode
getAllowsChildren
public boolean getAllowsChildren()
- Specified by:
getAllowsChildren
in interface TreeNode
children
public Enumeration children()
- Specified by:
children
in interface TreeNode
getChildAt
public TreeNode getChildAt(int childIndex)
- Specified by:
getChildAt
in interface TreeNode
getChildCount
public int getChildCount()
- Specified by:
getChildCount
in interface TreeNode
getIndex
public int getIndex(TreeNode node)
- Specified by:
getIndex
in interface TreeNode
getParent
public TreeNode getParent()
- Specified by:
getParent
in interface TreeNode
getStartOffset
public int getStartOffset()
- Fetches the offset from the beginning of the document that this
element begins at.
- Specified by:
getStartOffset
in interface Element
getEndOffset
public int getEndOffset()
- Fetches the offset from the beginning of the document that this
element ends at.
- Specified by:
getEndOffset
in interface Element
getLength
public int getLength()
- Returns the length of this element, int terms of text.
This is simply the difference between
getEndOffset()
and getStartOffset()
.
getAttributes
public AttributeSet getAttributes()
- Fetches the collection of attributes this element contains.
- Specified by:
getAttributes
in interface Element
getDocument
public Document getDocument()
- Fetches the document associated with this element.
- Specified by:
getDocument
in interface Element
getName
public String getName()
- Returns the name of the given text element.
- Specified by:
getName
in interface Element
getContent
public String getContent()
getWholeText
public String getWholeText()
- Specified by:
getWholeText
in interface XMLNode
getWholeText
public String getWholeText(int start,
int end)
- Specified by:
getWholeText
in interface XMLNode
getParentElement
public Element getParentElement()
- Returns the parents Element, which can be null if the Element is a
root.
- Specified by:
getParentElement
in interface Element
isLeaf
public boolean isLeaf()
- Always return true as every wrapped Text element can have no children.
- Specified by:
isLeaf
in interface Element
toString
public String toString()
- Overrides:
toString
in class Object