GWT 2.0.3

com.google.gwt.user.client.ui
Class Accessibility

java.lang.Object
  extended by com.google.gwt.user.client.ui.Accessibility

public final class Accessibility
extends java.lang.Object

Allows ARIA attributes to be added to widgets so that they can be identified by assistive technologies. Firefox 3, Firefox 2 (via FireVox), and Opera 9.5 are the only released browsers that currently support this feature, but in the near future it will be available in Safari and Internet Explorer 8. Individual screen reader applications may also support ARIA, to varying extents.

A 'role' describes the role a widget plays in a page: i.e. a checkbox widget is assigned a "checkbox" role.

A 'state' describes the current state of the widget. For example, a checkbox widget has the state "checked", which is given a value of "true" or "false" depending on whether it is currently checked or unchecked.

See the MDC page on Accessible DHTML for more information.

Note that although this API is public, the ARIA specification is still somewhat in flux. As a result, this API is subject to change as the specification stabilizes; we will do our best to keep the community updated on changes.


Field Summary
static java.lang.String ROLE_BUTTON
           
static java.lang.String ROLE_MENUBAR
           
static java.lang.String ROLE_MENUITEM
           
static java.lang.String ROLE_TAB
           
static java.lang.String ROLE_TABLIST
           
static java.lang.String ROLE_TABPANEL
           
static java.lang.String ROLE_TREE
           
static java.lang.String ROLE_TREEITEM
           
static java.lang.String STATE_ACTIVEDESCENDANT
           
static java.lang.String STATE_EXPANDED
           
static java.lang.String STATE_HASPOPUP
           
static java.lang.String STATE_LEVEL
           
static java.lang.String STATE_POSINSET
           
static java.lang.String STATE_PRESSED
           
static java.lang.String STATE_SELECTED
           
static java.lang.String STATE_SETSIZE
           
 
Method Summary
static java.lang.String getRole(Element elem)
          Requests the string value of the role with the specified namespace.
static java.lang.String getState(Element elem, java.lang.String stateName)
          Requests the string value of the state with the specified namespace.
static void removeState(Element elem, java.lang.String stateName)
          Removes the state from the given element.
static void setRole(Element elem, java.lang.String roleName)
          Assigns the specified element the specified role and value for that role.
static void setState(Element elem, java.lang.String stateName, java.lang.String stateValue)
          Assigns the specified element the specified state and value for that state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROLE_TREE

public static final java.lang.String ROLE_TREE
See Also:
Constant Field Values

ROLE_TREEITEM

public static final java.lang.String ROLE_TREEITEM
See Also:
Constant Field Values

ROLE_BUTTON

public static final java.lang.String ROLE_BUTTON
See Also:
Constant Field Values

ROLE_TABLIST

public static final java.lang.String ROLE_TABLIST
See Also:
Constant Field Values

ROLE_TAB

public static final java.lang.String ROLE_TAB
See Also:
Constant Field Values

ROLE_TABPANEL

public static final java.lang.String ROLE_TABPANEL
See Also:
Constant Field Values

ROLE_MENUBAR

public static final java.lang.String ROLE_MENUBAR
See Also:
Constant Field Values

ROLE_MENUITEM

public static final java.lang.String ROLE_MENUITEM
See Also:
Constant Field Values

STATE_ACTIVEDESCENDANT

public static final java.lang.String STATE_ACTIVEDESCENDANT
See Also:
Constant Field Values

STATE_POSINSET

public static final java.lang.String STATE_POSINSET
See Also:
Constant Field Values

STATE_SETSIZE

public static final java.lang.String STATE_SETSIZE
See Also:
Constant Field Values

STATE_SELECTED

public static final java.lang.String STATE_SELECTED
See Also:
Constant Field Values

STATE_EXPANDED

public static final java.lang.String STATE_EXPANDED
See Also:
Constant Field Values

STATE_LEVEL

public static final java.lang.String STATE_LEVEL
See Also:
Constant Field Values

STATE_HASPOPUP

public static final java.lang.String STATE_HASPOPUP
See Also:
Constant Field Values

STATE_PRESSED

public static final java.lang.String STATE_PRESSED
See Also:
Constant Field Values
Method Detail

getRole

public static java.lang.String getRole(Element elem)
Requests the string value of the role with the specified namespace.

Parameters:
elem - the element which has the specified role
Returns:
the value of the role, or an empty string if none exists

getState

public static java.lang.String getState(Element elem,
                                        java.lang.String stateName)
Requests the string value of the state with the specified namespace.

Parameters:
elem - the element which has the specified state
stateName - the name of the state
Returns:
the value of the state, or an empty string if none exists

removeState

public static void removeState(Element elem,
                               java.lang.String stateName)
Removes the state from the given element.

Parameters:
elem - the element which has the specified state
stateName - the name of the state to remove

setRole

public static void setRole(Element elem,
                           java.lang.String roleName)
Assigns the specified element the specified role and value for that role.

Parameters:
elem - the element to be given the specified role
roleName - the name of the role

setState

public static void setState(Element elem,
                            java.lang.String stateName,
                            java.lang.String stateValue)
Assigns the specified element the specified state and value for that state.

Parameters:
elem - the element to be given the specified state
stateName - the name of the state
stateValue - the value of the state

GWT 2.0.3