org.displaytag.util
public class: MultipleHtmlAttribute [javadoc |
source]
java.lang.Object
org.displaytag.util.MultipleHtmlAttribute
All Implemented Interfaces:
Cloneable
Object used to contain html multiple attribute value (for the "class" attribute).
- author:
Fabrizio
- Giustina
- version:
$
- Revision: 1081 $ ($Author: fgiust $)
Constructor: |
public MultipleHtmlAttribute(String attributeValue) {
this.attributeSet = new LinkedHashSet();
addAllAttributesFromArray(StringUtils.split(attributeValue));
}
Constructor for MultipleHtmlAttribute. Parameters:
attributeValue - String
|
Method from org.displaytag.util.MultipleHtmlAttribute Detail: |
public void addAttributeValue(String attributeValue) {
// don't add if empty
if (!StringUtils.isEmpty(attributeValue))
{
this.attributeSet.add(attributeValue);
}
}
Adds a value to the attribute. |
protected Object clone() {
MultipleHtmlAttribute clone;
try
{
clone = (MultipleHtmlAttribute) super.clone();
}
catch (CloneNotSupportedException e)
{
// should never happen
throw new UnhandledException(e);
}
// copy attributes
clone.addAllAttributesFromArray((String[]) this.attributeSet.toArray(new String[this.attributeSet.size()]));
return clone;
}
|
public boolean isEmpty() {
return attributeSet.isEmpty();
}
Return true if this MultipleHtmlValue doesn't store any value. |
public String toString() {
StringBuffer buffer = new StringBuffer();
Iterator iterator = this.attributeSet.iterator();
while (iterator.hasNext())
{
// apend next value
buffer.append(iterator.next());
if (iterator.hasNext())
{
// append a space if there are more
buffer.append(' ");
}
}
return buffer.toString();
}
Returns the list of attributes separated by a space. |