|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnextapp.echoservlet.html.Element
public class Element
A representation of an HTML element designed to reside in a hierarchy of elements (an HTML document) and be rendered with good performance.
Field Summary |
---|
Fields inherited from interface nextapp.echoservlet.html.Renderable |
---|
INDENT_STRING |
Constructor Summary | |
---|---|
Element()
|
|
Element(java.lang.String name)
Creates a new Element of the specified name with a required closing tag. |
|
Element(java.lang.String name,
boolean closingTagRequired)
Creates a new Element of the specified name and closing tag requirement. |
Method Summary | |
---|---|
void |
add(int index,
Renderable child)
Adds a renderable object to the element at a specified index. |
void |
add(Renderable child)
Adds a renderable object to the element. |
void |
addAttribute(java.lang.String attr)
Adds a null attribute to the element. |
void |
addAttribute(java.lang.String attr,
int value)
Adds an integer attribute to the element. |
void |
addAttribute(java.lang.String attr,
java.lang.String value)
Adds the a text attribute to the element. |
void |
addElement(Element child)
Deprecated. The add() method with the equivalent signature should now be used. |
void |
addElement(int index,
Element child)
Deprecated. The add() method with the equivalent signature should now be used. |
void |
addElementContent(ElementContent content)
Deprecated. The add() method with the equivalent signature should now be used. |
void |
addElementContent(int index,
ElementContent content)
Deprecated. The add() method with the equivalent signature should now be used. |
void |
addHtml(int index,
java.lang.String html)
Adds raw HTML to the body of the element at a specified index. |
void |
addHtml(java.lang.String html)
Adds raw HTML to the body of the element. |
void |
addText(int index,
java.lang.String text,
boolean encodeNewLines)
Adds plain text to the body of the element at a specified index. |
void |
addText(java.lang.String text)
Adds plain text to the body of the element. |
void |
addText(java.lang.String text,
boolean encodeNewLines)
Adds plain text to the body of the element. |
static Element |
allocate(java.lang.String name)
|
static Element |
allocate(java.lang.String name,
boolean closingTagRequired)
|
java.lang.String |
getAttribute(java.lang.String name)
Returns the value of the given attribute. |
ElementContent |
getContents()
|
static long |
getCreationCount()
|
java.lang.String |
getName()
Returns the name of the element. |
int |
indexOf(java.lang.Object child)
Returns the index of the specified object if it is a child of this Element. |
boolean |
isSticky()
Determines whether the elment is "sticky" Sticky elements will be rendered immediately after and adjacent to the previous element (without whitespace). |
static void |
releaseElements()
|
void |
removeAttribute(java.lang.String name)
|
void |
render(java.io.PrintWriter pw)
Renders this element and its children to a PrintWriter. |
void |
render(java.io.PrintWriter pw,
int depth,
boolean parentWhitespaceRelevant)
Renders this element and its children to a PrintWriter. |
void |
renderAsStyleAttribute(java.io.PrintWriter pw)
|
protected void |
reset()
|
void |
setClosingTagRequired(boolean closingTagRequired)
Sets whether the element requires an explicit closing tag. |
void |
setSticky(boolean sticky)
Sets whether the element is "sticky" Sticky elements will be rendered immediately after and adjacent to the previous element (without whitespace). |
void |
setWhitespaceRelevant(boolean whitespaceRelevant)
Sets whether the rendering of this element is adversely effected by white space. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Element()
public Element(java.lang.String name)
name
- The name of the element.public Element(java.lang.String name, boolean closingTagRequired)
name
- The name of the element.closingTagRequired
- Specifies whether a closing tag should be applied if no child
elements or content is added to the element.Method Detail |
---|
protected void reset()
public void add(Renderable child)
child
- The renderable object to add to the element.public void add(int index, Renderable child)
index
- The index at which to add the renderable.child
- The renderable object to add to the element.public void addAttribute(java.lang.String attr)
attr
- The name of the attribute.public void addAttribute(java.lang.String attr, int value)
attr
- The name of the attribute.value
- The value of the attribute.public void addAttribute(java.lang.String attr, java.lang.String value)
attr
- The name of the attribute.value
- The value of the attribute.public void addElement(Element child)
child
- The child element to add to the element.public void addElement(int index, Element child)
index
- The index at which to add the child element.child
- The child element to add to the element.public void addElementContent(ElementContent content)
ElementContent
object to this
element.
content
- The content to add.public void addElementContent(int index, ElementContent content)
ElementContent
object to this element
at a specified index.
index
- The index at which to add the element content.content
- The content to add.public void addHtml(java.lang.String html)
html
- Encoded HTML content to be added to this element.public void addHtml(int index, java.lang.String html)
index
- The index at which to add the HTML.html
- Encoded HTML content to be added to this element.public void addText(java.lang.String text)
public void addText(java.lang.String text, boolean encodeNewLines)
text
- Unencoded text to be added as HTML to the body of the element.encodeNewLines
- A flag indicating if new line characters should be translated
to <BR>s.public void addText(int index, java.lang.String text, boolean encodeNewLines)
index
- The index at which to add the text.text
- Unencoded text to be added as HTML to the body of the element.encodeNewLines
- A flag indicating if new line characters should be translated
to <BR>s.public java.lang.String getAttribute(java.lang.String name)
name
- The name of the attribute.
public java.lang.String getName()
public int indexOf(java.lang.Object child)
child
- The child object whose index is desired.
public boolean isSticky()
public void render(java.io.PrintWriter pw)
pw
- The print writer to render the element to.public void render(java.io.PrintWriter pw, int depth, boolean parentWhitespaceRelevant)
render
in interface Renderable
pw
- The print writer to render the element to.depth
- The indentation depth to indent the element to.parentWhitespaceRelevant
- A flag indicating whether the parent element had the
WhitespaceRelevant property set.public void renderAsStyleAttribute(java.io.PrintWriter pw)
public void setClosingTagRequired(boolean closingTagRequired)
closingTagRequired
- True if the tag should be explicitly closed event if it has no
child elements. False if the tag should be explicitly closed
only when it has child elements.public void setSticky(boolean sticky)
sticky
- True if the element should be sticky.public void setWhitespaceRelevant(boolean whitespaceRelevant)
whitespaceRelevant
- True if this tag is sensitive to whitespace inside it.public ElementContent getContents()
public void removeAttribute(java.lang.String name)
public static long getCreationCount()
public static Element allocate(java.lang.String name)
public static Element allocate(java.lang.String name, boolean closingTagRequired)
public static void releaseElements()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |