|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.module.sitemesh.html.CustomTag
public class CustomTag
A CustomTag provides a mechanism to manipulate the contents of a Tag. The standard Tag implementations are immutable, however CustomTag allows a copy to be taken of an immutable Tag that can then be manipulated.
Tag
Field Summary | |
---|---|
private int |
attributeCount
|
private java.lang.String[] |
attributes
|
private java.lang.String |
name
|
private int |
type
|
Fields inherited from interface com.opensymphony.module.sitemesh.html.Tag |
---|
CLOSE, CLOSE_MAGIC_COMMENT, EMPTY, OPEN, OPEN_MAGIC_COMMENT |
Constructor Summary | |
---|---|
CustomTag(java.lang.String name,
int type)
Type of tag: <blah> - Tag.OPEN </blah> - Tag.CLOSE <blah/> - Tag.EMPTY |
|
CustomTag(Tag tag)
Create a CustomTag based on an existing Tag - this takes a copy of the Tag. |
Method Summary | |
---|---|
int |
addAttribute(java.lang.String name,
java.lang.String value)
Add a new attribute. |
boolean |
equals(java.lang.Object o)
|
int |
getAttributeCount()
Number of attributes in tag. |
int |
getAttributeIndex(java.lang.String name,
boolean caseSensitive)
Determine which attribute has the specified name. |
java.lang.String |
getAttributeName(int index)
Get name of attribute. |
java.lang.String |
getAttributeValue(int index)
Get value of an attribute. |
java.lang.String |
getAttributeValue(java.lang.String name,
boolean caseSensitive)
Get value of an attribute. |
java.lang.String |
getContents()
Get the complete tag in its original form, preserving original formatting. |
java.lang.String |
getName()
Name of tag (ie. |
int |
getType()
Type of tag: <blah> - Tag.OPEN </blah> - Tag.CLOSE <blah/> - Tag.EMPTY |
private void |
growAttributes()
|
boolean |
hasAttribute(java.lang.String name,
boolean caseSensitive)
Determine if an attribute is present. |
int |
hashCode()
|
void |
removeAttribute(int attributeIndex)
Remove an attribute. |
void |
removeAttribute(java.lang.String name,
boolean caseSensitive)
Change the value of an attribute, or add an attribute if it does not already exist. |
void |
setAttributeName(int attributeIndex,
java.lang.String name)
Change the name of an existing attribute. |
void |
setAttributeValue(int attributeIndex,
java.lang.String value)
Change the value of an existing attribute. |
void |
setAttributeValue(java.lang.String name,
boolean caseSensitive,
java.lang.String value)
Change the value of an attribute, or add an attribute if it does not already exist. |
void |
setName(java.lang.String name)
Change the name of the attribute. |
void |
setType(int type)
Change the type of the tag. |
java.lang.String |
toString()
|
void |
writeTo(CharArray out)
Write out the complete tag in its original form, preserving original formatting. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String[] attributes
private int attributeCount
private java.lang.String name
private int type
Constructor Detail |
---|
public CustomTag(java.lang.String name, int type)
public CustomTag(Tag tag)
Method Detail |
---|
public java.lang.String getContents()
Tag
getContents
in interface Tag
Tag.writeTo(com.opensymphony.module.sitemesh.html.util.CharArray)
public void writeTo(CharArray out)
Tag
writeTo
in interface Tag
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int getAttributeCount()
Tag
getAttributeCount
in interface Tag
public int getAttributeIndex(java.lang.String name, boolean caseSensitive)
Tag
getAttributeIndex
in interface Tag
public java.lang.String getAttributeName(int index)
Tag
getAttributeName
in interface Tag
public java.lang.String getAttributeValue(int index)
Tag
getAttributeValue
in interface Tag
public java.lang.String getAttributeValue(java.lang.String name, boolean caseSensitive)
Tag
getAttributeValue
in interface Tag
public boolean hasAttribute(java.lang.String name, boolean caseSensitive)
Tag
hasAttribute
in interface Tag
public java.lang.String getName()
Tag
getName
in interface Tag
public int getType()
getType
in interface Tag
public void setName(java.lang.String name)
public void setType(int type)
private void growAttributes()
public int addAttribute(java.lang.String name, java.lang.String value)
name
- Name of attribute to change.value
- New value of attribute or null for an HTML style empty attribute.
public void setAttributeValue(java.lang.String name, boolean caseSensitive, java.lang.String value)
name
- Name of attribute to change.caseSensitive
- Whether the name should be treated as case sensitive when searching for an existing value.value
- New value of attribute or null for an HTML style empty attribute.public void setAttributeName(int attributeIndex, java.lang.String name)
public void setAttributeValue(int attributeIndex, java.lang.String value)
public void removeAttribute(int attributeIndex)
public void removeAttribute(java.lang.String name, boolean caseSensitive)
name
- Name of attribute to remove.caseSensitive
- Whether the name should be treated as case sensitive.
|
www.opensymphony.com/sitemesh/ | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |