|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jdom.Element | +--net.sourceforge.spedit.core.XMLElement
The XMLElement
is a subclass of the JDOM Element class that
allows it to wrapped by XMLElementWrapper
objects.
The interest is that the XMLElement can be used both in a JDOM and in a Swing document model, thus allowing the manipuation with the JDOM API to be reflected visually by the Swing text representation mechanisms.
This class differs in some ways from its JDOM parent, it is a little bit
slower but notifies the containing XMLDocument
of any ongoing
changes, thus allowing to use either the JDOM model or the Swing model for
document content manipulation.
Field Summary | |
protected int |
contentLength
|
static int |
INITIAL_ARRAY_SIZE
|
protected int |
startOffset
|
protected XMLElementWrapper |
wrapper
|
protected XMLAttributes |
xmlAttributes
|
Fields inherited from class org.jdom.Element |
additionalNamespaces, attributes, content, name, namespace, parent |
Constructor Summary | |
XMLElement()
Creates a new XMLElement with the name "default" |
|
XMLElement(String name)
Creates a new XMLElement with the given name and parent. |
|
XMLElement(String name,
org.jdom.Namespace namespace)
Creates a new XMLElement with the given name and parent. |
|
XMLElement(String name,
String uri)
Creates a new XMLElement with the given name and parent. |
|
XMLElement(String name,
String prefix,
String uri)
Creates a new XMLElement with the given name and parent. |
Method Summary | |
org.jdom.Element |
addAttribute(org.jdom.Attribute attr)
|
org.jdom.Element |
addAttribute(String name,
String value)
|
org.jdom.Element |
addContent(org.jdom.CDATA cdata)
|
org.jdom.Element |
addContent(org.jdom.Comment comment)
|
org.jdom.Element |
addContent(org.jdom.Element element)
|
org.jdom.Element |
addContent(org.jdom.EntityRef entity)
|
org.jdom.Element |
addContent(org.jdom.ProcessingInstruction pi)
|
org.jdom.Element |
addContent(String text)
|
org.jdom.Element |
addContent(XMLText text)
|
protected void |
fireInsertEvent(int offset,
String text,
Element elt)
Fires an insertion document event to the containing XMLDocument if it exists. |
List |
getContent()
|
org.jdom.Document |
getDocument()
Returns the document attached to this XMLElement. |
XMLElementWrapper |
getWrapper()
Returns the Wrapper attached to this XMLElement .
|
protected void |
init()
|
boolean |
removeAttribute(String name)
|
boolean |
removeAttribute(String name,
org.jdom.Namespace ns)
|
org.jdom.Element |
setAttribute(org.jdom.Attribute attribute)
|
org.jdom.Element |
setAttribute(String name,
String value)
|
org.jdom.Element |
setAttribute(String name,
String value,
org.jdom.Namespace ns)
|
org.jdom.Element |
setAttributes(List attributes)
|
void |
setDocument(XMLDocument doc)
Sets the parent document of this XMLElement . |
void |
setNewContent(List content)
This method is provided to set a whole new content that includes XMLText nodes in it. |
protected org.jdom.Element |
silentAddContent(XMLText text)
Just the same as the addContent method, but this time no notice is made to the containing document. |
Methods inherited from class org.jdom.Element |
addNamespaceDeclaration, clone, detach, equals, getAdditionalNamespaces, getAttribute, getAttribute, getAttributes, getAttributeValue, getAttributeValue, getChild, getChild, getChildren, getChildren, getChildren, getChildText, getChildText, getChildTextTrim, getChildTextTrim, getCopy, getCopy, getMixedContent, getName, getNamespace, getNamespace, getNamespacePrefix, getNamespaceURI, getParent, getQualifiedName, getSerializedForm, getText, getTextNormalize, getTextTrim, hasChildren, hashCode, hasMixedContent, isRootElement, removeAttribute, removeChild, removeChild, removeChildren, removeChildren, removeChildren, removeContent, removeContent, removeContent, removeContent, removeContent, removeNamespaceDeclaration, setChildren, setContent, setDocument, setMixedContent, setName, setNamespace, setParent, setText, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int INITIAL_ARRAY_SIZE
protected int contentLength
protected int startOffset
protected XMLElementWrapper wrapper
protected XMLAttributes xmlAttributes
Constructor Detail |
public XMLElement()
public XMLElement(String name)
public XMLElement(String name, org.jdom.Namespace namespace)
public XMLElement(String name, String uri)
public XMLElement(String name, String prefix, String uri)
Method Detail |
protected void init()
public org.jdom.Element addAttribute(org.jdom.Attribute attr)
addAttribute
in class org.jdom.Element
public org.jdom.Element addAttribute(String name, String value)
addAttribute
in class org.jdom.Element
public org.jdom.Element setAttribute(org.jdom.Attribute attribute)
setAttribute
in class org.jdom.Element
public org.jdom.Element setAttribute(String name, String value)
setAttribute
in class org.jdom.Element
public org.jdom.Element setAttribute(String name, String value, org.jdom.Namespace ns)
setAttribute
in class org.jdom.Element
public org.jdom.Element setAttributes(List attributes)
setAttributes
in class org.jdom.Element
public boolean removeAttribute(String name)
removeAttribute
in class org.jdom.Element
public boolean removeAttribute(String name, org.jdom.Namespace ns)
removeAttribute
in class org.jdom.Element
public List getContent()
getContent
in class org.jdom.Element
public org.jdom.Element addContent(org.jdom.Element element)
addContent
in class org.jdom.Element
public org.jdom.Element addContent(String text)
addContent
in class org.jdom.Element
public org.jdom.Element addContent(XMLText text)
protected org.jdom.Element silentAddContent(XMLText text)
newContent
method.text
- The XMLText
to be inserted.#newContent
public void setNewContent(List content)
This method is provided to set a whole new content that includes
XMLText
nodes in it. The current implementation (Beta7) of
JDOM does not allow redefine the setContent method, so the actual
is a kind of turnaround.
Note that this method does not notify the document of changes that occured. This is important because every other addition or removal method notifies the containing document. This method allows the wrapper to modify the actual content without duplicating notifications, even allowing optimizations in the notification.
If this seems unclear, just don't use this method
;)
content
- The new content of this XMLElement
public org.jdom.Element addContent(org.jdom.Comment comment)
addContent
in class org.jdom.Element
public org.jdom.Element addContent(org.jdom.EntityRef entity)
addContent
in class org.jdom.Element
public org.jdom.Element addContent(org.jdom.ProcessingInstruction pi)
addContent
in class org.jdom.Element
public org.jdom.Element addContent(org.jdom.CDATA cdata)
addContent
in class org.jdom.Element
protected void fireInsertEvent(int offset, String text, Element elt)
XMLDocument
if it exists. This allows the
XMLElement
to notify the Swing document model of changes
in the textual representation of the JDOM document.offset
- The offset at which the insertion occurs.text
- The actual text that will be inserted.elt
- The element concernced by the change.public XMLElementWrapper getWrapper()
XMLElement
.
This allow to make a bridge between the JDOM and the Swing Document
Model.public org.jdom.Document getDocument()
getDocument
in class org.jdom.Element
public void setDocument(XMLDocument doc)
Sets the parent document of this XMLElement
. This does not
automatically add the XMLElement
to the document.
doc
- The belonging document which whould be an
XMLDocument
instance.
This method has been redefined to make this method public rather than protected.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |