javax.accessibility
Class AccessibleContext

java.lang.Object
  extended by javax.accessibility.AccessibleContext
Direct Known Subclasses:
Component.AccessibleAWTComponent, ImageIcon.AccessibleImageIcon, JList.AccessibleJList.AccessibleJListChild, JTable.AccessibleJTable.AccessibleJTableCell, JTableHeader.AccessibleJTableHeader.AccessibleJTableHeaderEntry, JTree.AccessibleJTree.AccessibleJTreeNode, MenuComponent.AccessibleAWTMenuComponent

public abstract class AccessibleContext
extends Object

The minimum information that all accessible objects return. This includes name, description, role, and state of the object, parents and children, and any other useful information. If a component supports further details, it should implement one of the following:

Since:
1.2

Field Summary
static String ACCESSIBLE_ACTION_PROPERTY
          Constant used when supported set of actions has changed.
static String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY
          Constant used when active descendent of a component has changed.
static String ACCESSIBLE_CARET_PROPERTY
          Constant used when the accessibleText caret has changed.
static String ACCESSIBLE_CHILD_PROPERTY
          Constant used when children are added or removed.
static String ACCESSIBLE_COMPONENT_BOUNDS_CHANGED
          Constant used when a component's bounds have changed.
static String ACCESSIBLE_DESCRIPTION_PROPERTY
          Constant used when the accessible description has changed.
static String ACCESSIBLE_HYPERTEXT_OFFSET
          Constant used when a hypertext element received focus.
static String ACCESSIBLE_INVALIDATE_CHILDREN
          Constant used when the state of child objects changes.
static String ACCESSIBLE_NAME_PROPERTY
          Constant used when the accessible name has changed.
static String ACCESSIBLE_SELECTION_PROPERTY
          Constant used when the accessibleSelection has changed.
static String ACCESSIBLE_STATE_PROPERTY
          Constant used when the accessibleStateSet has changed.
static String ACCESSIBLE_TABLE_CAPTION_CHANGED
          Constant used when the accessible table caption has changed.
static String ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED
          Constant used when the accessible table column description has changed.
static String ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED
          Constant used when the accessible table column header has changed.
static String ACCESSIBLE_TABLE_MODEL_CHANGED
          Constant used when the accessible table model has changed.
static String ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED
          Constant used when the accessible table row description has changed.
static String ACCESSIBLE_TABLE_ROW_HEADER_CHANGED
          Constant used when the accessible table row header has changed.
static String ACCESSIBLE_TABLE_SUMMARY_CHANGED
          Constant used when the accessible table summary has changed.
static String ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED
          Constant used when the attributes of some text have changed.
static String ACCESSIBLE_TEXT_PROPERTY
          Constant used when the accessibleText has changed.
static String ACCESSIBLE_VALUE_PROPERTY
          Constant used when the accessibleValue has changed.
static String ACCESSIBLE_VISIBLE_DATA_PROPERTY
          Constant used when the visible data has changed.
protected  String accessibleDescription
          A localized string describing this object.
protected  String accessibleName
          A localized string naming this object.
protected  Accessible accessibleParent
          The accessible parent of this object.
 
Constructor Summary
AccessibleContext()
          Default constructor.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Add a PropertyChangeListener to the listener list.
 void firePropertyChange(String name, Object oldValue, Object newValue)
          Fire an event to report property changes.
 AccessibleAction getAccessibleAction()
          Get any supported accessible actions.
abstract  Accessible getAccessibleChild(int i)
          Returns the specified accessible chile.
abstract  int getAccessibleChildrenCount()
          Returns the number of accessible children of this object.
 AccessibleComponent getAccessibleComponent()
          Get any supported accessible component.
 String getAccessibleDescription()
          Get the localized description of the object.
 AccessibleEditableText getAccessibleEditableText()
          Get any supported accessible editable text.
 AccessibleIcon[] getAccessibleIcon()
          Get all supported accessible icons.
abstract  int getAccessibleIndexInParent()
          Gets the index of this object within its accessible parent.
 String getAccessibleName()
          Get the localized name of the object.
 Accessible getAccessibleParent()
          Return the accessible parent of this object.
 AccessibleRelationSet getAccessibleRelationSet()
          Get any supported accessible relation set.
abstract  AccessibleRole getAccessibleRole()
          Gets the role of this object.
 AccessibleSelection getAccessibleSelection()
          Get any supported accessible selection.
abstract  AccessibleStateSet getAccessibleStateSet()
          Gets the state set of this object.
 AccessibleTable getAccessibleTable()
          Get any supported accessible table.
 AccessibleText getAccessibleText()
          Get any supported accessible text.
 AccessibleValue getAccessibleValue()
          Get any supported accessible value.
abstract  Locale getLocale()
          Gets the component locale, deferring to the parent if one is not declared.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a PropertyChangeListener from the listener list.
 void setAccessibleDescription(String s)
          Set the localized name of the object.
 void setAccessibleName(String s)
          Set the localized name of the object.
 void setAccessibleParent(Accessible a)
          Sets the accessible parent of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCESSIBLE_NAME_PROPERTY

public static final String ACCESSIBLE_NAME_PROPERTY
Constant used when the accessible name has changed. Both the old and new values are listed in the event.

See Also:
getAccessibleName(), addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_DESCRIPTION_PROPERTY

public static final String ACCESSIBLE_DESCRIPTION_PROPERTY
Constant used when the accessible description has changed. Both the old and new values are listed in the event.

See Also:
getAccessibleDescription(), addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_STATE_PROPERTY

public static final String ACCESSIBLE_STATE_PROPERTY
Constant used when the accessibleStateSet has changed. Both the old and new values are listed in the event, although either may be null if a state was disabled at that time.

See Also:
getAccessibleStateSet(), AccessibleState, AccessibleStateSet, addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_VALUE_PROPERTY

public static final String ACCESSIBLE_VALUE_PROPERTY
Constant used when the accessibleValue has changed. Both the old and new values are listed in the event.

See Also:
getAccessibleValue(), addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_SELECTION_PROPERTY

public static final String ACCESSIBLE_SELECTION_PROPERTY
Constant used when the accessibleSelection has changed. Both the old and new values of the event are reserved for future use.

See Also:
getAccessibleSelection(), addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_TEXT_PROPERTY

public static final String ACCESSIBLE_TEXT_PROPERTY
Constant used when the accessibleText has changed. Both the old and new values of the event are reserved for future use.

See Also:
getAccessibleText(), addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_CARET_PROPERTY

public static final String ACCESSIBLE_CARET_PROPERTY
Constant used when the accessibleText caret has changed. Both the old and new values are listed in the event.

See Also:
addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_VISIBLE_DATA_PROPERTY

public static final String ACCESSIBLE_VISIBLE_DATA_PROPERTY
Constant used when the visible data has changed. Both the old and new values of the event are reserved for future use.

See Also:
addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_CHILD_PROPERTY

public static final String ACCESSIBLE_CHILD_PROPERTY
Constant used when children are added or removed. On addition, the new value of the event holds the new child; on removal, the old value holds the removed child.

See Also:
addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY

public static final String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY
Constant used when active descendent of a component has changed. Both the old and new values are listed in the event.

See Also:
addPropertyChangeListener(PropertyChangeListener), Constant Field Values

ACCESSIBLE_TABLE_CAPTION_CHANGED

public static final String ACCESSIBLE_TABLE_CAPTION_CHANGED
Constant used when the accessible table caption has changed. Both the old and new values are listed in the event.

See Also:
Accessible, AccessibleTable, Constant Field Values

ACCESSIBLE_TABLE_SUMMARY_CHANGED

public static final String ACCESSIBLE_TABLE_SUMMARY_CHANGED
Constant used when the accessible table summary has changed. Both the old and new values are listed in the event.

See Also:
Accessible, AccessibleTable, Constant Field Values

ACCESSIBLE_TABLE_MODEL_CHANGED

public static final String ACCESSIBLE_TABLE_MODEL_CHANGED
Constant used when the accessible table model has changed. Only the new value of the event has meaning.

See Also:
AccessibleTable, AccessibleTableModelChange, Constant Field Values

ACCESSIBLE_TABLE_ROW_HEADER_CHANGED

public static final String ACCESSIBLE_TABLE_ROW_HEADER_CHANGED
Constant used when the accessible table row header has changed. Only the new value of the event has meaning.

See Also:
AccessibleTable, AccessibleTableModelChange, Constant Field Values

ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED

public static final String ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED
Constant used when the accessible table row description has changed. Only the new value of the event has meaning.

See Also:
AccessibleTable, Constant Field Values

ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED

public static final String ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED
Constant used when the accessible table column header has changed. Only the new value of the event has meaning.

See Also:
AccessibleTable, AccessibleTableModelChange, Constant Field Values

ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED

public static final String ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED
Constant used when the accessible table column description has changed. Only the new value of the event has meaning.

See Also:
AccessibleTable, Constant Field Values

ACCESSIBLE_ACTION_PROPERTY

public static final String ACCESSIBLE_ACTION_PROPERTY
Constant used when supported set of actions has changed. Both the old and new values are listed in the event.

See Also:
AccessibleAction, Constant Field Values

ACCESSIBLE_HYPERTEXT_OFFSET

public static final String ACCESSIBLE_HYPERTEXT_OFFSET
Constant used when a hypertext element received focus. Both the old and new values are listed in the event, with -1 indicating that no link had focus.

See Also:
AccessibleHyperlink, Constant Field Values

ACCESSIBLE_COMPONENT_BOUNDS_CHANGED

public static final String ACCESSIBLE_COMPONENT_BOUNDS_CHANGED
Constant used when a component's bounds have changed. The old and new bounds are given in the event.

Since:
1.5
See Also:
Constant Field Values

ACCESSIBLE_INVALIDATE_CHILDREN

public static final String ACCESSIBLE_INVALIDATE_CHILDREN
Constant used when the state of child objects changes. The old value in the event is always null, and the new value is the component whose children have changed.

Since:
1.5
See Also:
Constant Field Values

ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED

public static final String ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED
Constant used when the attributes of some text have changed. On insertion, the old value is null and the new value is an AccessibleAttributeSequence describing the insertion. On deletion, the old value is an AccessibleAttributeSequence and the new value is null. For replacement, both the old and new values are AccessibleAttributeSequence objects.

Since:
1.5
See Also:
Constant Field Values

accessibleParent

protected Accessible accessibleParent
The accessible parent of this object.

See Also:
getAccessibleParent(), setAccessibleParent(Accessible)

accessibleName

protected String accessibleName
A localized string naming this object.

See Also:
getAccessibleName(), setAccessibleName(String)

accessibleDescription

protected String accessibleDescription
A localized string describing this object.

See Also:
getAccessibleDescription(), setAccessibleDescription(String)
Constructor Detail

AccessibleContext

public AccessibleContext()
Default constructor.

Method Detail

getAccessibleName

public String getAccessibleName()
Get the localized name of the object. For example, a label may just return the text of the label, while an entry field for city may return "city" in en_US.

Returns:
the accessible object's name, or null if it is unnamed
See Also:
setAccessibleName(String)

setAccessibleName

public void setAccessibleName(String s)
Set the localized name of the object. This will fire a PropertyChangeEvent with ACCESSIBLE_NAME_PROPERTY.

Parameters:
s - the new name
See Also:
getAccessibleName(), addPropertyChangeListener(PropertyChangeListener)

getAccessibleDescription

public String getAccessibleDescription()
Get the localized description of the object. For example, a 'Cancel' button may be described as "Ignore changes and close dialog box" in en_US.

Returns:
the accessible object's description, or null if there is none
See Also:
setAccessibleDescription(String)

setAccessibleDescription

public void setAccessibleDescription(String s)
Set the localized name of the object. This will fire a PropertyChangeEvent with ACCESSIBLE_DESCRIPTION_PROPERTY.

Parameters:
s - the new description
See Also:
getAccessibleDescription(), addPropertyChangeListener(PropertyChangeListener)

getAccessibleRole

public abstract AccessibleRole getAccessibleRole()
Gets the role of this object. For example, a button serves the role of AccessibleRole.PUSH_BUTTON. This allows assistive technologies to funnel similar objects into the same assistance classes. Note that the class is extensible, to define new roles if necessary.

Returns:
the role of the object
See Also:
AccessibleRole

getAccessibleStateSet

public abstract AccessibleStateSet getAccessibleStateSet()
Gets the state set of this object. A change in the state of the object will fire a PropertyChangeEvent for ACCESSIBLE_STATE_PROPERTY.

Returns:
the current state of the object
See Also:
AccessibleState, AccessibleStateSet, addPropertyChangeListener(PropertyChangeListener)

getAccessibleParent

public Accessible getAccessibleParent()
Return the accessible parent of this object.

Returns:
the accessible parent, or null if there is none

setAccessibleParent

public void setAccessibleParent(Accessible a)
Sets the accessible parent of this object. This should only be used when the current parent object should not be the accessible parent; only the parent of the accessible child should call this method.

Parameters:
a - the new parent

getAccessibleIndexInParent

public abstract int getAccessibleIndexInParent()
Gets the index of this object within its accessible parent.

Returns:
the 0-based index, or -1 if there is no accessible parent
See Also:
getAccessibleParent(), getAccessibleChildrenCount(), getAccessibleChild(int)

getAccessibleChildrenCount

public abstract int getAccessibleChildrenCount()
Returns the number of accessible children of this object.

Returns:
the number of accessible children
See Also:
getAccessibleChild(int)

getAccessibleChild

public abstract Accessible getAccessibleChild(int i)
Returns the specified accessible chile.

Parameters:
i - the 0-based index to get
Returns:
the child, or null if out of bounds
See Also:
getAccessibleChildrenCount()

getLocale

public abstract Locale getLocale()
Gets the component locale, deferring to the parent if one is not declared.

Returns:
the locale
Throws:
IllegalComponentStateException - if there is no locale or parent

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Add a PropertyChangeListener to the listener list. This listener will be notified of all property changes to the accessible object.

Parameters:
l - the listener to add
See Also:
ACCESSIBLE_NAME_PROPERTY, ACCESSIBLE_DESCRIPTION_PROPERTY, ACCESSIBLE_STATE_PROPERTY, ACCESSIBLE_VALUE_PROPERTY, ACCESSIBLE_SELECTION_PROPERTY, ACCESSIBLE_TEXT_PROPERTY, ACCESSIBLE_VISIBLE_DATA_PROPERTY, removePropertyChangeListener(PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Remove a PropertyChangeListener from the listener list.

Parameters:
l - the listener to remove
See Also:
addPropertyChangeListener(PropertyChangeListener)

getAccessibleAction

public AccessibleAction getAccessibleAction()
Get any supported accessible actions. The default implementation returns null.

Returns:
the supported action, or null
See Also:
AccessibleAction

getAccessibleComponent

public AccessibleComponent getAccessibleComponent()
Get any supported accessible component. The default implementation returns null.

Returns:
the supported component, or null
See Also:
AccessibleComponent

getAccessibleSelection

public AccessibleSelection getAccessibleSelection()
Get any supported accessible selection. The default implementation returns null.

Returns:
the supported selection, or null
See Also:
AccessibleSelection

getAccessibleText

public AccessibleText getAccessibleText()
Get any supported accessible text. The default implementation returns null.

Returns:
the supported text, or null
See Also:
AccessibleText

getAccessibleEditableText

public AccessibleEditableText getAccessibleEditableText()
Get any supported accessible editable text. The default implementation returns null.

Returns:
the supported editable text, or null
See Also:
AccessibleEditableText

getAccessibleValue

public AccessibleValue getAccessibleValue()
Get any supported accessible value. The default implementation returns null.

Returns:
the supported value, or null
See Also:
AccessibleValue

getAccessibleIcon

public AccessibleIcon[] getAccessibleIcon()
Get all supported accessible icons. The default implementation returns null.

Returns:
the supported icons, or null
See Also:
AccessibleIcon

getAccessibleRelationSet

public AccessibleRelationSet getAccessibleRelationSet()
Get any supported accessible relation set. The default implementation returns an empty AccessibleRelationSet.

Returns:
the supported relation set, or null
See Also:
AccessibleRelationSet

getAccessibleTable

public AccessibleTable getAccessibleTable()
Get any supported accessible table. The default implementation returns null.

Returns:
the supported table, or null
See Also:
AccessibleTable

firePropertyChange

public void firePropertyChange(String name,
                               Object oldValue,
                               Object newValue)
Fire an event to report property changes. This is intended for use by the accessible objects, not general application programs. If oldValue and newValue differ, and the listenter list is not empty, a PropertyChange event is fired to each listener.

Parameters:
name - the property name
oldValue - the prior value
newValue - the updated value
See Also:
PropertyChangeSupport, addPropertyChangeListener(PropertyChangeListener), removePropertyChangeListener(PropertyChangeListener), ACCESSIBLE_NAME_PROPERTY, ACCESSIBLE_DESCRIPTION_PROPERTY, ACCESSIBLE_STATE_PROPERTY, ACCESSIBLE_VALUE_PROPERTY, ACCESSIBLE_SELECTION_PROPERTY, ACCESSIBLE_TEXT_PROPERTY, ACCESSIBLE_VISIBLE_DATA_PROPERTY