![JAR search and dependency download from the Maven repository](/logo.png)
js.template.xhtml.CssClass Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of js-xhtml-template Show documentation
Show all versions of js-xhtml-template Show documentation
Reference implementation for j(s)-lib template API, declarative, natural and based on X(HT)ML language.
The newest version!
package js.template.xhtml;
import java.util.ArrayList;
import java.util.List;
import js.dom.Element;
import js.util.Strings;
/**
* Element CSS class wrapper.
*
* @author Iulian Rotaru
*/
final class CssClass extends AttrImpl
{
private static final String ATTR_CLASS = "class";
private List classNames;
protected CssClass(Element element)
{
super(ATTR_CLASS);
classNames = Strings.split(element.getAttr(ATTR_CLASS));
if(this.classNames == null) {
this.classNames = new ArrayList();
}
}
protected void add(String className)
{
if(!this.classNames.contains(className)) {
this.classNames.add(className);
}
}
protected void remove(String className)
{
this.classNames.remove(className);
}
@Override
public String getValue()
{
return Strings.join(classNames);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy