Package com.adobe.granite.ui.components
Class Tag
java.lang.Object
com.adobe.granite.ui.components.Tag
A representation of DOM tag. A tag has a name (e.g. div, span) and a set of attributes.
-
Constructor Summary
ConstructorsConstructorDescriptionTag(AttrBuilder attrs) Creates a tag with the given attributes.Tag(String name, AttrBuilder attrs) Creates a tag with the given name and attributes. -
Method Summary
Modifier and TypeMethodDescriptiongetAttrs()Returns the attributes of the tag.getName()Returns the name of the tag (e.g.printlnEnd(Writer out) Println the end tag of this tag (e.g.printlnStart(Writer out) Println the start tag of this tag (e.g.setAttrs(AttrBuilder attrs) Sets attributes of the tag.Sets the name of the tag.
-
Constructor Details
-
Tag
Creates a tag with the given name and attributes.- Parameters:
name- the name of the tagattrs- the attributes
-
Tag
Creates a tag with the given attributes. The name isnullin this case.- Parameters:
attrs- the attributes
-
-
Method Details
-
getName
Returns the name of the tag (e.g. div, span).- Returns:
- the name
-
setName
Sets the name of the tag.- Parameters:
name- the name- Returns:
- the tag
-
getAttrs
Returns the attributes of the tag.- Returns:
- the attributes of the tag
-
setAttrs
Sets attributes of the tag.- Parameters:
attrs- the attributes to set- Returns:
- the tag with the newly set attributes
-
printlnStart
Println the start tag of this tag (e.g."<div class='class1'>"). Note that no escaping/encoding of the name is performed.- Parameters:
out- the writer- Returns:
- the tag
- Throws:
IOException- if there's a problem while printing to the writer
-
printlnEnd
Println the end tag of this tag (e.g. "</div>"). Note that no escaping/encoding of the name is performed.- Parameters:
out- the writer- Returns:
- the tag
- Throws:
IOException- if there's a problem while printing to the writer
-