|
SimpleServlets v5.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.simpleservlets.htmlobjects.GenericHTMLElement
public class GenericHTMLElement
Core implementation of HTMLElement. This class can be used
directly for HTML support which is not present in HTMLObjects.
GenericHTMLElement can be used as a superclass, or it can
be instantiated directly.
| Field Summary |
|---|
| Fields inherited from interface com.simpleservlets.htmlobjects.HTMLElement |
|---|
ZERO_LEN_ARRAY |
| Constructor Summary | |
|---|---|
GenericHTMLElement()
|
|
GenericHTMLElement(String name)
|
|
GenericHTMLElement(String name,
boolean safeToWrapWithWhitespace)
|
|
GenericHTMLElement(String name,
HTMLElement parent)
|
|
GenericHTMLElement(String name,
HTMLElement parent,
boolean safeToWrapWithWhitespace)
|
|
| Method Summary | |
|---|---|
HTMLElement |
add(HTMLElement element)
Add the specified child element to this container. |
HTMLString |
add(String text)
Convenience method to wrap the specified text in an HTMLString
and call HTMLElement.add(HTMLElement). |
HTMLElement |
addSibling(HTMLElement element)
Add the specified element to this element's parent. |
HTMLString |
addSibling(String text)
Convenience method to wrap the specified text in an HTMLString
and call addSibling(HTMLElement). |
HTMLAttribute[] |
getAttributes()
Returns an array of all of the attributes. |
HTMLElement[] |
getChildren()
Returns an array of all of the children of this element. |
String |
getName()
Returns the tag name for this element. |
HTMLElement |
getParent()
Returns the current parent element of this element (may be null). |
boolean |
hasAttributes()
Returns true if this element has any attributes set. |
boolean |
hasChildren()
Returns true if there are currently any children nested within this element. |
boolean |
isSafeToWrapWithWhitespace()
Returns true if is is safe to add whitespace before and after this element. |
void |
removeAllAttributes()
Removes all of the attributes. |
void |
removeAllChildren()
Removes all of the children. |
boolean |
removeAttribute(String attName)
Attempts to remove the attribute with the specified name. |
boolean |
removeChild(int index)
Attempts to remove the child HTMLElement at the specified index. |
void |
setAttribute(HTMLAttribute attribute)
Adds or replaces the specified attribute to the list of attributes. |
void |
setAttribute(String name)
Sets the specified attribute potentially replacing anything that was previously stored for the same name. |
void |
setAttribute(String name,
double value)
Sets the specified attribute potentially replacing anything that was previously stored for the same name. |
void |
setAttribute(String name,
int value)
Sets the specified attribute potentially replacing anything that was previously stored for the same name. |
void |
setAttribute(String name,
Object value)
Sets the specified attribute potentially replacing anything that was previously stored for the same name. |
void |
setAttribute(String name,
String value)
Sets the specified attribute potentially replacing anything that was previously stored for the same name. |
void |
setAttribute(String name,
Value value)
Sets the specified attribute potentially replacing anything that was previously stored for the same name. |
void |
setAttributeGroup(HTMLAttribute[] attributeGroup)
Sets ALL the specified attributes potentially replacing anything that was previously stored for the same name(s). |
void |
setParent(HTMLElement parent)
Changes or initially sets the parent element for this element. |
protected void |
setSafeToWrapWithWhitespace(boolean extraWhitespaceIsHarmless)
Widen to public on subclasses where it is appropriate to be able to set this value externally. |
void |
setStyle(String styleName)
Used to add the attribute class with the specified value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GenericHTMLElement(String name,
HTMLElement parent,
boolean safeToWrapWithWhitespace)
public GenericHTMLElement(String name,
HTMLElement parent)
public GenericHTMLElement(String name,
boolean safeToWrapWithWhitespace)
public GenericHTMLElement(String name)
public GenericHTMLElement()
| Method Detail |
|---|
public String getName()
HTMLElement
getName in interface HTMLElementpublic boolean hasAttributes()
HTMLElement
hasAttributes in interface HTMLElementpublic HTMLAttribute[] getAttributes()
HTMLElement
getAttributes in interface HTMLElementpublic void setAttribute(HTMLAttribute attribute)
setAttribute in interface HTMLElement
public void setAttribute(String name,
String value)
HTMLElementHTMLAttribute.HTMLAttribute(String, String)).
setAttribute in interface HTMLElement
public void setAttribute(String name,
Value value)
HTMLElementHTMLAttribute.HTMLAttribute(String, Value)).
setAttribute in interface HTMLElement
public void setAttribute(String name,
Object value)
HTMLElementHTMLAttribute.HTMLAttribute(String, Object)).
setAttribute in interface HTMLElement
public void setAttribute(String name,
int value)
HTMLElementHTMLAttribute.HTMLAttribute(String, int)).
setAttribute in interface HTMLElement
public void setAttribute(String name,
double value)
HTMLElementHTMLAttribute.HTMLAttribute(String, double)).
setAttribute in interface HTMLElementpublic void setAttribute(String name)
HTMLElementHTMLAttribute.HTMLAttribute(String)).
setAttribute in interface HTMLElementpublic void setAttributeGroup(HTMLAttribute[] attributeGroup)
HTMLElement
setAttributeGroup in interface HTMLElementpublic void setStyle(String styleName)
HTMLElement
setStyle in interface HTMLElementpublic boolean removeAttribute(String attName)
HTMLElement
removeAttribute in interface HTMLElementattName - the name of the attribute to remove
public void removeAllAttributes()
HTMLElement
removeAllAttributes in interface HTMLElementpublic boolean hasChildren()
HTMLElement
hasChildren in interface HTMLElementpublic HTMLElement[] getChildren()
HTMLElement
getChildren in interface HTMLElementpublic HTMLElement add(HTMLElement element)
HTMLElement
add in interface HTMLElementelement - the element to add.
null is ignored (and returned).
public HTMLString add(String text)
HTMLElementHTMLString
and call HTMLElement.add(HTMLElement).
Only adds the specified text if it is not null and has a
length greater than 0. The value returned is the HTMLString
created, or null if the passed text was null or zero-length.
add in interface HTMLElement
public HTMLElement addSibling(HTMLElement element)
throws HTMLException
HTMLElementgetParent().add(element);
addSibling in interface HTMLElementelement - the element to add.
null is ignored (and returned).
HTMLException - if there is no parent container at
the moment (if getParent() returns null). This is a
RuntimeException, so callers are not required to
use a try/catch block.
public HTMLString addSibling(String text)
throws HTMLException
HTMLElementHTMLString
and call addSibling(HTMLElement).
Only adds the specified text if it is not null and has a
length greater than 0. The value returned is the HTMLString
created, or null if the passed text was null or zero-length.
addSibling in interface HTMLElementHTMLException - if there is no parent container at
the moment (if getParent() returns null). This is a
RuntimeException, so callers are not required to
use a try/catch block.public boolean removeChild(int index)
HTMLElementHTMLElement.getChildren().
removeChild in interface HTMLElementindex - value from 0 to (getChildren().length - 1)
public void removeAllChildren()
HTMLElement
removeAllChildren in interface HTMLElementpublic void setParent(HTMLElement parent)
HTMLElement
setParent in interface HTMLElementpublic HTMLElement getParent()
HTMLElement
getParent in interface HTMLElementpublic boolean isSafeToWrapWithWhitespace()
HTMLElement
isSafeToWrapWithWhitespace in interface HTMLElementprotected void setSafeToWrapWithWhitespace(boolean extraWhitespaceIsHarmless)
|
SimpleServlets v5.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||