NextApp Echo
App Container 1.0.5

nextapp.echoservlet.html
Class ElementContent

java.lang.Object
  extended bynextapp.echoservlet.html.ElementContent
All Implemented Interfaces:
Renderable, java.io.Serializable

public class ElementContent
extends java.lang.Object
implements Renderable, java.io.Serializable

A representation of an Elements content.

See Also:
Serialized Form

Field Summary
private  java.util.List contents
           
 
Fields inherited from interface nextapp.echoservlet.html.Renderable
INDENT_STRING
 
Constructor Summary
ElementContent()
          Creates a new Element Content object.
 
Method Summary
 void add(int index, Renderable child)
          Adds a child element to this element at the specified index.
 void add(Renderable child)
          Adds a child element to this element.
 void addHtml(int index, java.lang.String html)
          Adds raw HTML to the body of the tag at the specified index.
 void addHtml(java.lang.String html)
          Adds raw HTML to the body of the tag.
 void addText(int index, java.lang.String text, boolean encodeNewLines)
          Adds plain text to the tag at the specified index.
 void addText(java.lang.String text, boolean encodeNewLines)
          Adds plain text to the tag.
 int indexOf(java.lang.Object child)
          Returns the index of the specified object if it is a child of this ElementContent object.
 void render(java.io.PrintWriter pw, int depth, boolean whitespaceRelevant)
          Renders the renderable object to the given PrintWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contents

private java.util.List contents
Constructor Detail

ElementContent

public ElementContent()
Creates a new Element Content object.

Method Detail

add

public void add(Renderable child)
Adds a child element to this element.

Parameters:
child - The child element to be added.

add

public void add(int index,
                Renderable child)
Adds a child element to this element at the specified index.

Parameters:
index - The index at which to add the child.
child - The child element to be added.

addHtml

public void addHtml(java.lang.String html)
Adds raw HTML to the body of the tag. The given HTML string will not be encoded.

Parameters:
html - A string of encoded HTML.

addHtml

public void addHtml(int index,
                    java.lang.String html)
Adds raw HTML to the body of the tag at the specified index. The given HTML string will not be encoded.

Parameters:
index - The index at which to add the HTML.
html - A string of encoded HTML.

addText

public void addText(java.lang.String text,
                    boolean encodeNewLines)
Adds plain text to the tag. This text will automatically be encoded into valid HTML.

Parameters:
text - A string of unencoded text that will be encoded to HTML.
encodeNewLines - A flag indicating whether the encoding should translate newline characters to <br> elements.

addText

public void addText(int index,
                    java.lang.String text,
                    boolean encodeNewLines)
Adds plain text to the tag at the specified index. This text will automatically be encoded into valid HTML.

Parameters:
index - The index at which to add the text.
text - A string of unencoded text that will be encoded to HTML.
encodeNewLines - A flag indicating whether the encoding should translate newline characters to <br> elements.

indexOf

public int indexOf(java.lang.Object child)
Returns the index of the specified object if it is a child of this ElementContent object. If the object is not found, -1 is returned.

Parameters:
child - The child object whose index is desired.
Returns:
The index of the specified object.

render

public void render(java.io.PrintWriter pw,
                   int depth,
                   boolean whitespaceRelevant)
Description copied from interface: Renderable
Renders the renderable object to the given PrintWriter.

Specified by:
render in interface Renderable
Parameters:
pw - The PrintWriter to render to.
depth - The indentation depth that should be applied to the element being rendered.
whitespaceRelevant - A flag that indicates whether the containing element is sensitive to white space.
See Also:
Renderable.render(PrintWriter, int, boolean)

NextApp Echo
App Container 1.0.5