|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.document.PlainTextElement
public class PlainTextElement
This class is an implementation of the StructuredDocument interface using simple text
Field Summary | |
---|---|
protected PlainTextDocument |
doc
|
protected String |
name
|
protected PlainTextElement |
parent
|
protected String |
val
|
Constructor Summary | |
---|---|
protected |
PlainTextElement(PlainTextDocument doc,
String name)
Creates new PlainTextElement |
protected |
PlainTextElement(PlainTextDocument doc,
String name,
String val)
Creates new PlainTextElement |
Method Summary | |
---|---|
String |
addAttribute(Attribute newAttrib)
Adds an attribute with the given name and value. |
String |
addAttribute(String name,
String value)
Adds an attribute with the given name and value. |
void |
appendChild(PlainTextElement element)
Add a child element to this element. |
boolean |
equals(Object element)
|
Attribute |
getAttribute(String name)
Returns a single attribute which matches the name provided. |
Enumeration |
getAttributes()
Returns an enumerations of the attributes associated with this object. |
Enumeration |
getChildren()
Returns an enumeration of the immediate children of this element. |
Enumeration<PlainTextElement> |
getChildren(Object key)
Returns an enumeration of the immediate children of this element who match the specified key. |
Enumeration<PlainTextElement> |
getChildren(String name)
Returns an enumeration of the immediate children of this element whose name match the specified string. |
String |
getKey()
Get the name associated with an element. |
String |
getName()
Get the name associated with an element. |
PlainTextElement |
getParent()
Get the parent element of this element. |
StructuredTextDocument |
getRoot()
Get the root document element of the hierarchy this element belongs to. |
String |
getTextValue()
Get the value (if any) associated with an element. |
String |
getValue()
Get the value (if any) associated with an element. |
protected void |
printNice(Writer into,
int indent,
boolean recurse)
Write the contents of this element and optionally its children. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PlainTextDocument doc
protected PlainTextElement parent
protected final String name
protected final String val
Constructor Detail |
---|
protected PlainTextElement(PlainTextDocument doc, String name)
protected PlainTextElement(PlainTextDocument doc, String name, String val)
Method Detail |
---|
public boolean equals(Object element)
equals
in class Object
public StructuredTextDocument getRoot()
getRoot
in interface Element<PlainTextElement>
getRoot
in interface TextElement<PlainTextElement>
public String getKey()
getKey
in interface Element<PlainTextElement>
getKey
in interface TextElement<PlainTextElement>
public String getValue()
getValue
in interface Element<PlainTextElement>
getValue
in interface TextElement<PlainTextElement>
public PlainTextElement getParent()
null
is returned. If this
element is the root element of the Document then it returns itself. ie.,
this == this.getParent()
.
getParent
in interface Element<PlainTextElement>
public Enumeration getChildren()
getChildren
in interface Element<PlainTextElement>
public String getName()
getName
in interface TextElement<PlainTextElement>
public String getTextValue()
getTextValue
in interface TextElement<PlainTextElement>
public void appendChild(PlainTextElement element)
StructuredDocument.createElement(Object)
or
StructuredDocument.createElement(Object, Object)
.
appendChild
in interface Element<PlainTextElement>
element
- The element to be added as a child.public Enumeration<PlainTextElement> getChildren(Object key)
getChildren
in interface Element<PlainTextElement>
key
- The key which will be matched against.
public Enumeration<PlainTextElement> getChildren(String name)
getChildren
in interface TextElement<PlainTextElement>
name
- The name which will be matched against.
protected void printNice(Writer into, int indent, boolean recurse) throws IOException
into
- The java.io.Writer that the output will be sent to.indent
- the number of tabs which will be inserted before each
line.recurse
- if true then also print the children of this element.
IOException
public String addAttribute(String name, String value)
addAttribute
in interface Attributable
name
- name of the attribute.value
- value for the attribute.
public String addAttribute(Attribute newAttrib)
addAttribute
in interface Attributable
newAttrib
- new attribute.
public Enumeration getAttributes()
getAttributes
in interface Attributable
public Attribute getAttribute(String name)
getAttribute
in interface Attributable
name
- the attribute name
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |