T
- The attribute value typepublic abstract class Attribute<T>
extends java.lang.Object
Class representing ARIA state/property attribute. Contains methods for setting, getting,
removing ARIA attributes for an HTML Element
.
For more details about ARIA states and properties check the W3C ARIA documentation Supported States and Properties .
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
defaultValue |
protected java.lang.String |
name |
Constructor and Description |
---|
Attribute(java.lang.String name)
Constructs a state/property ARIA attribute with name
name and null default value. |
Attribute(java.lang.String name,
java.lang.String defaultValue)
Constructs a state/property ARIA attribute with name
name and defaultValue . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
get(Element element)
Gets the HTML attribute value for the attribute with name
name for element
element |
java.lang.String |
getName()
Gets the property/state name
|
protected abstract java.lang.String |
getSingleValue(T value)
Gets the string representation of
value to be set as an attribute value
to an HTML element. |
void |
remove(Element element)
Removes the state/property attribute for element
element . |
void |
set(Element element,
T... values)
Sets the state/property
value for the HTML element element . |
void |
setDefault(Element element)
Sets the state/property value to the defaultValue if not null.
|
protected final java.lang.String name
protected java.lang.String defaultValue
public Attribute(java.lang.String name, java.lang.String defaultValue)
name
and defaultValue
.name
- State/Property namedefaultValue
- Default valuespublic Attribute(java.lang.String name)
name
and null default value.name
- State/Property namepublic java.lang.String get(Element element)
name
for element
element
element
- HTML elementelement
public java.lang.String getName()
public void remove(Element element)
element
.element
- HTM elementpublic void set(Element element, T... values)
value
for the HTML element element
.element
- HTML elementvalues
- Attribute valuepublic void setDefault(Element element)
element
- HTML elementprotected abstract java.lang.String getSingleValue(T value)
value
to be set as an attribute value
to an HTML element.value
- The item to be stringifiedvalue