Package com.google.gwt.aria.client
Class Attribute<T>
java.lang.Object
com.google.gwt.aria.client.Attribute<T>
- Type Parameters:
T
- The attribute value type
- Direct Known Subclasses:
AriaValueAttribute
,PrimitiveValueAttribute
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 .
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the HTML attribute value for the attribute with namename
for elementelement
getName()
Gets the property/state nameprotected abstract String
getSingleValue
(T value) Gets the string representation ofvalue
to be set as an attribute value to an HTML element.void
Removes the state/property attribute for elementelement
.void
Sets the state/propertyvalue
for the HTML elementelement
.void
setDefault
(Element element) Sets the state/property value to the defaultValue if not null.
-
Field Details
-
name
-
defaultValue
-
-
Constructor Details
-
Attribute
Constructs a state/property ARIA attribute with namename
anddefaultValue
.- Parameters:
name
- State/Property namedefaultValue
- Default values
-
Attribute
Constructs a state/property ARIA attribute with namename
and null default value.- Parameters:
name
- State/Property name
-
-
Method Details
-
get
Gets the HTML attribute value for the attribute with namename
for elementelement
- Parameters:
element
- HTML element- Returns:
- The attribute value for
element
-
getName
Gets the property/state name- Returns:
- The attribute name
-
remove
Removes the state/property attribute for elementelement
.- Parameters:
element
- HTM element
-
set
Sets the state/propertyvalue
for the HTML elementelement
.- Parameters:
element
- HTML elementvalues
- Attribute value
-
setDefault
Sets the state/property value to the defaultValue if not null. If a list of default values is set, every default value is converted to string and the string values are concatenated in a string token list. There is an assertion checking whether the default is null. Note that the asserts are enabled during development and testing but they will be stripped in production mode.- Parameters:
element
- HTML element
-
getSingleValue
Gets the string representation ofvalue
to be set as an attribute value to an HTML element.- Parameters:
value
- The item to be stringified- Returns:
- the stringified representation of
value
-