T
- The attribute value typepublic abstract class Attribute<T> extends 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 String |
defaultValue |
protected String |
name |
Constructor and Description |
---|
Attribute(String name)
Constructs a state/property ARIA attribute with name
name and null default value. |
Attribute(String name,
String defaultValue)
Constructs a state/property ARIA attribute with name
name and defaultValue . |
Modifier and Type | Method and Description |
---|---|
String |
get(Element element)
Gets the HTML attribute value for the attribute with name
name for element
element |
String |
getName()
Gets the property/state name
|
protected abstract 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.
|
public Attribute(String name, String defaultValue)
name
and defaultValue
.name
- State/Property namedefaultValue
- Default valuespublic Attribute(String name)
name
and null default value.name
- State/Property namepublic String get(Element element)
name
for element
element
element
- HTML elementelement
public 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 elementCopyright © 2018. All rights reserved.