Project JXTA

net.jxta.impl.document
Class PlainTextElement

java.lang.Object
  |
  +--net.jxta.impl.document.TextElementCommon
        |
        +--net.jxta.impl.document.PlainTextElement
Direct Known Subclasses:
PlainTextDocument

public class PlainTextElement
extends TextElementCommon

This class is an implementation of the StructuredDocument interface using simple text

Since:
JXTA 1.0

Field Summary
protected  PlainTextDocument doc
           
protected  java.lang.String name
           
protected  net.jxta.document.Element parent
           
protected  java.lang.String val
           
 
Constructor Summary
protected PlainTextElement(PlainTextDocument doc, java.lang.String name)
          Creates new PlainTextElement
protected PlainTextElement(PlainTextDocument doc, java.lang.String name, java.lang.String val)
          Creates new PlainTextElement
 
Method Summary
 void appendChild(net.jxta.document.TextElement element)
          Add a child element to this element
 boolean equals(java.lang.Object element)
          Tests two elements for equality.
 java.util.Enumeration getChildren()
          Returns an enumeration of the immediate children of this element
 java.util.Enumeration getChildren(java.lang.String name)
          Returns an enumeration of the immediate children of this element whose name match the specified string.
 java.lang.String getName()
           
 net.jxta.document.Element getParent()
          Get the parent of this element.
 net.jxta.document.StructuredDocument getRoot()
          Get the root element of the hierarchy this element belongs to.
 java.lang.String getTextValue()
           
protected  void printNice(java.io.Writer into, int indent, boolean recurse)
          Write the contents of this element and optionally its children.
 
Methods inherited from class net.jxta.impl.document.TextElementCommon
appendChild, getChildren, getKey, getValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

protected PlainTextDocument doc

parent

protected net.jxta.document.Element parent

name

protected final java.lang.String name

val

protected final java.lang.String val
Constructor Detail

PlainTextElement

protected PlainTextElement(PlainTextDocument doc,
                           java.lang.String name)
Creates new PlainTextElement

PlainTextElement

protected PlainTextElement(PlainTextDocument doc,
                           java.lang.String name,
                           java.lang.String val)
Creates new PlainTextElement
Method Detail

equals

public boolean equals(java.lang.Object element)
Tests two elements for equality.
Overrides:
equals in class java.lang.Object
Parameters:
element - the element to be compared against.
Returns:
true if the elements are equal (by whatever definition of equality is appropriate) otherwise false

getRoot

public net.jxta.document.StructuredDocument getRoot()
Get the root element of the hierarchy this element belongs to.
Returns:
StructuredDocument root of this element's hierarchy.
Since:
JXTA 1.0

getParent

public net.jxta.document.Element getParent()
Get the parent of this element. If the element has not been inserted into the Document then null is returned. If this element is the root of the Document then it returns itself.
Returns:
Element parent of this element
Since:
JXTA 1.0

getChildren

public java.util.Enumeration getChildren()
Returns an enumeration of the immediate children of this element
Returns:
Enumeration An enumeration containing all of the children of this element.
Since:
JXTA 1.0

getName

public java.lang.String getName()

getTextValue

public java.lang.String getTextValue()

appendChild

public void appendChild(net.jxta.document.TextElement element)
Add a child element to this element
Parameters:
element - the element to be added as a child

getChildren

public java.util.Enumeration getChildren(java.lang.String name)
Returns an enumeration of the immediate children of this element whose name match the specified string.
Parameters:
name - The name which will be matched against.
Returns:
An enumeration containing all of the children of this element.

printNice

protected void printNice(java.io.Writer into,
                         int indent,
                         boolean recurse)
Write the contents of this element and optionally its children. The writing is done to a provided java.io.Writer. The writing can optionally be indented
Parameters:
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.

Project JXTA