|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.tapestry5.dom.Node
org.apache.tapestry5.dom.Element
public final class Element
An element that will render with a begin tag and attributes, a body, and an end tag. Also acts as a factory for enclosed Element, Text and Comment nodes.
TODO: Support for CDATA nodes. Do we need Entity nodes?
| Method Summary | |
|---|---|
Element |
addClassName(String... className)
Adds one or more CSS class names to the "class" attribute. |
Element |
attribute(String name,
String value)
Adds an attribute to the element, but only if the attribute name does not already exist. |
Element |
attribute(String namespace,
String name,
String value)
Adds a namespaced attribute to the element, but only if the attribute name does not already exist. |
Element |
attributes(String... namesAndValues)
Convenience for invoking attribute(String, String) multiple times. |
CData |
cdata(String content)
Adds an returns a new CDATA node. |
Element |
comment(String text)
Adds the comment and returns this element for further construction. |
Element |
defineNamespace(String namespace,
String namespacePrefix)
Defines a namespace for this element, mapping a URI to a prefix. |
Element |
element(String name,
String... namesAndValues)
Creates and returns a new Element node as a child of this node. |
Element |
elementAt(int index,
String name,
String... namesAndValues)
|
Element |
elementNS(String namespace,
String name)
Creates and returns a new Element within a namespace as a child of this node. |
Element |
find(String path)
Searchs for a child element with a particular name below this element. |
Element |
forceAttributes(String... namesAndValues)
Forces changes to a number of attributes. |
String |
getAttribute(String attributeName)
|
Document |
getDocument()
|
Element |
getElementById(String id)
Tries to find an element under this element (including itself) whose id is specified. |
String |
getName()
|
String |
getNamespace()
Returns the namespace for this element (which is typically a URL). |
protected Map<String,String> |
getNamespaceURIToPrefix()
|
Element |
getParent()
Returns the containing element for this element. |
void |
pop()
Removes an element; the element's children take the place of the node within its container. |
Element |
raw(String text)
Adds the raw text and returns this element for further construction. |
Element |
removeChildren()
Removes all children from this element. |
Text |
text(String text)
Adds and returns a new text node (the text node is returned so that Text.write(String) or [@link Text.writef(String, Object[]) may be invoked . |
| Methods inherited from class org.apache.tapestry5.dom.Node |
|---|
getChildMarkup, getChildren, getContainer, moveAfter, moveBefore, moveToBottom, moveToTop, remove, toMarkup, toString, wrap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public Document getDocument()
getDocument in class Nodepublic Element getParent()
public Element attribute(String name,
String value)
name - the name of the attribute to addvalue - the value for the attribute. A value of null is allowed, and no attribute will be added to the
element.
public Element attribute(String namespace,
String name,
String value)
namespace - the namespace to contain the attribute, or nullname - the name of the attribute to addvalue - the value for the attribute. A value of null is allowed, and no attribute will be added to the
element.public Element attributes(String... namesAndValues)
attribute(String, String) multiple times.
namesAndValues - alternating attribute names and attribute valuespublic Element forceAttributes(String... namesAndValues)
public Element element(String name,
String... namesAndValues)
name - the name of the element to createnamesAndValues - alternating attribute names and attribute values
public Element elementNS(String namespace,
String name)
namespace - namespace to contain the element, or nullname - element name to create within the namespace
public Element elementAt(int index,
String name,
String... namesAndValues)
public Element comment(String text)
public Element raw(String text)
public Text text(String text)
Text.write(String) or [@link Text.writef(String, Object[]) may be invoked .
text - initial text for the node
public CData cdata(String content)
content - the content to be rendered by the node
public Element getElementById(String id)
id - the value of the id attribute of the element being looked for
public Element find(String path)
path -
public String getAttribute(String attributeName)
public String getName()
public Element addClassName(String... className)
className - one or more CSS class names
public Element defineNamespace(String namespace,
String namespacePrefix)
xmlns: attributes (to define
the namespace and prefix) to be rendered.
namespace - URI of the namespacenamespacePrefix - prefix
public String getNamespace()
public void pop()
public Element removeChildren()
protected Map<String,String> getNamespaceURIToPrefix()
getNamespaceURIToPrefix in class Node
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||