javax.swing
Class JTable.AccessibleJTable

java.lang.Object
  extended by javax.accessibility.AccessibleContext
      extended by java.awt.Component.AccessibleAWTComponent
          extended by java.awt.Container.AccessibleAWTContainer
              extended by javax.swing.JComponent.AccessibleJComponent
                  extended by javax.swing.JTable.AccessibleJTable
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, AccessibleComponent, AccessibleExtendedComponent, AccessibleExtendedTable, AccessibleSelection, AccessibleTable, CellEditorListener, ListSelectionListener, TableColumnModelListener, TableModelListener
Enclosing class:
JTable

protected class JTable.AccessibleJTable
extends JComponent.AccessibleJComponent
implements AccessibleSelection, ListSelectionListener, TableModelListener, TableColumnModelListener, CellEditorListener, PropertyChangeListener, AccessibleExtendedTable

Provides accessibility support for JTable.

See Also:
Serialized Form

Nested Class Summary
protected  class JTable.AccessibleJTable.AccessibleJTableCell
          Provides accessibility support for table cells.
protected  class JTable.AccessibleJTable.AccessibleJTableModelChange
           
 
Nested classes/interfaces inherited from class javax.swing.JComponent.AccessibleJComponent
JComponent.AccessibleJComponent.AccessibleContainerHandler, JComponent.AccessibleJComponent.AccessibleFocusHandler
 
Nested classes/interfaces inherited from class java.awt.Component.AccessibleAWTComponent
Component.AccessibleAWTComponent.AccessibleAWTComponentHandler, Component.AccessibleAWTComponent.AccessibleAWTFocusHandler
 
Field Summary
 
Fields inherited from class javax.swing.JComponent.AccessibleJComponent
accessibleContainerHandler, accessibleFocusHandler
 
Fields inherited from class java.awt.Component.AccessibleAWTComponent
accessibleAWTComponentHandler, accessibleAWTFocusHandler
 
Fields inherited from class javax.accessibility.AccessibleContext
ACCESSIBLE_ACTION_PROPERTY, ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY, ACCESSIBLE_CARET_PROPERTY, ACCESSIBLE_CHILD_PROPERTY, ACCESSIBLE_COMPONENT_BOUNDS_CHANGED, ACCESSIBLE_DESCRIPTION_PROPERTY, ACCESSIBLE_HYPERTEXT_OFFSET, ACCESSIBLE_INVALIDATE_CHILDREN, ACCESSIBLE_NAME_PROPERTY, ACCESSIBLE_SELECTION_PROPERTY, ACCESSIBLE_STATE_PROPERTY, ACCESSIBLE_TABLE_CAPTION_CHANGED, ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED, ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED, ACCESSIBLE_TABLE_MODEL_CHANGED, ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED, ACCESSIBLE_TABLE_ROW_HEADER_CHANGED, ACCESSIBLE_TABLE_SUMMARY_CHANGED, ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED, ACCESSIBLE_TEXT_PROPERTY, ACCESSIBLE_VALUE_PROPERTY, ACCESSIBLE_VISIBLE_DATA_PROPERTY, accessibleDescription, accessibleName, accessibleParent
 
Constructor Summary
protected JTable.AccessibleJTable()
          Creates a new AccessibleJTable.
 
Method Summary
 void addAccessibleSelection(int i)
          Adds the accessible child with the specified index i to the selection.
 void clearAccessibleSelection()
          Deselects all selected accessible children.
 void columnAdded(TableColumnModelEvent event)
          Called by the TableColumnModel to indicate that a column has been added to the model.
 void columnMarginChanged(ChangeEvent event)
          Called by the TableColumnModel to indicate that the model's column margin has changed.
 void columnMoved(TableColumnModelEvent event)
          Called by the TableColumnModel to indicate that a column has been moved.
 void columnRemoved(TableColumnModelEvent event)
          Called by the TableColumnModel to indicate that a column has been removed from the model.
 void columnSelectionChanged(ListSelectionEvent event)
          Called by the TableColumnModel to indicate that the column selection state has changed.
 void editingCanceled(ChangeEvent event)
          Editing has been canceled
 void editingStopped(ChangeEvent event)
          Editing has been stopped
 Accessible getAccessibleAt(int r, int c)
          Returns the accessible child (table cell) at the specified row and column.
 Accessible getAccessibleCaption()
          Returns the caption of the table.
 Accessible getAccessibleChild(int index)
          Returns the accessible child at the given index.
 int getAccessibleColumn(int index)
          Returns the column number of an accessible child (cell) with the specified index.
 int getAccessibleColumnAtIndex(int index)
          Returns the accessible column at the specified index.
 int getAccessibleColumnCount()
          Returns the number of columns in the table.
 Accessible getAccessibleColumnDescription(int c)
          Returns the accessible description for the column with the specified index, or null if no description has been set.
 int getAccessibleColumnExtentAt(int r, int c)
          Returns the number of columns that the specified cell occupies.
 AccessibleTable getAccessibleColumnHeader()
          Returns the column header.
 int getAccessibleIndex(int r, int c)
          Returns the index of the accessible child at the specified row and column.
 int getAccessibleIndexAt(int row, int column)
          Returns the accessible child index at the specified column and row.
 AccessibleRole getAccessibleRole()
          Returns the accessible role for the JTable component.
 int getAccessibleRow(int index)
          Returns the row number of an accessible child (cell) with the specified index.
 int getAccessibleRowAtIndex(int index)
          Returns the accessible row at the specified index.
 int getAccessibleRowCount()
          Returns the number of rows in the table.
 Accessible getAccessibleRowDescription(int r)
          Returns the accessible description for the row with the specified index, or null if no description has been set.
 int getAccessibleRowExtentAt(int r, int c)
          Returns the number of rows that the specified cell occupies.
 AccessibleTable getAccessibleRowHeader()
          Returns the accessible row header.
 Accessible getAccessibleSelection(int i)
          Returns the selected accessible object with the specified index i.
 int getAccessibleSelectionCount()
          Returns the number of selected items in this table.
 Accessible getAccessibleSummary()
          Returns the summary for the table.
 AccessibleTable getAccessibleTable()
          Returns the accessible table.
 int[] getSelectedAccessibleColumns()
          Returns the indices of all selected columns.
 int[] getSelectedAccessibleRows()
          Returns the indices of all selected rows.
 boolean isAccessibleChildSelected(int i)
          Returns true if the accessible child with the index i is selected, false otherwise.
 boolean isAccessibleColumnSelected(int c)
          Returns true if the column with the specified index is selected, false otherwise.
 boolean isAccessibleRowSelected(int r)
          Returns true if the row with the specified index is selected, false otherwise.
 boolean isAccessibleSelected(int r, int c)
          Returns true if the accessible child at the specified row and column is selected, false otherwise.
 void propertyChange(PropertyChangeEvent e)
          Receives notification when any of the JTable's properties changes.
 void removeAccessibleSelection(int i)
          Removes the accessible child with the specified index i from the current selection.
 void selectAllAccessibleSelection()
          Selects all accessible children that can be selected.
 void setAccessibleCaption(Accessible c)
          Sets the caption for the table.
 void setAccessibleColumnDescription(int c, Accessible description)
          Sets the accessible description for the column with the specified index.
 void setAccessibleColumnHeader(AccessibleTable header)
          Sets the accessible column header.
 void setAccessibleRowDescription(int r, Accessible description)
          Sets the accessible description for the row with the specified index.
 void setAccessibleRowHeader(AccessibleTable header)
          Sets the accessible row header.
 void setAccessibleSummary(Accessible s)
          Sets the summary for the table.
 void tableChanged(TableModelEvent event)
          Receives notification when the table model changes.
 void tableRowsDeleted(TableModelEvent event)
          Receives notification when one or more rows have been deleted from the table.
 void tableRowsInserted(TableModelEvent event)
          Receives notification when one or more rows have been inserted into the table and fires appropriate property change events.
 void valueChanged(ListSelectionEvent event)
          Receives notification when the row selection changes and fires appropriate property change events.
 
Methods inherited from class javax.swing.JComponent.AccessibleJComponent
addPropertyChangeListener, getAccessibleChildrenCount, getAccessibleDescription, getAccessibleKeyBinding, getAccessibleName, getAccessibleStateSet, getBorderTitle, getTitledBorderText, getToolTipText, removePropertyChangeListener
 
Methods inherited from class java.awt.Container.AccessibleAWTContainer
getAccessibleAt
 
Methods inherited from class java.awt.Component.AccessibleAWTComponent
addFocusListener, contains, getAccessibleComponent, getAccessibleIndexInParent, getAccessibleParent, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getLocale, getLocation, getLocationOnScreen, getSize, isEnabled, isFocusTraversable, isShowing, isVisible, removeFocusListener, requestFocus, setBackground, setBounds, setCursor, setEnabled, setFont, setForeground, setLocation, setSize, setVisible
 
Methods inherited from class javax.accessibility.AccessibleContext
firePropertyChange, getAccessibleAction, getAccessibleEditableText, getAccessibleIcon, getAccessibleRelationSet, getAccessibleSelection, getAccessibleText, getAccessibleValue, setAccessibleDescription, setAccessibleName, setAccessibleParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.accessibility.AccessibleComponent
addFocusListener, contains, getAccessibleAt, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getLocation, getLocationOnScreen, getSize, isEnabled, isFocusTraversable, isShowing, isVisible, removeFocusListener, requestFocus, setBackground, setBounds, setCursor, setEnabled, setFont, setForeground, setLocation, setSize, setVisible
 

Constructor Detail

JTable.AccessibleJTable

protected JTable.AccessibleJTable()
Creates a new AccessibleJTable.

Since:
JDK1.5
Method Detail

getAccessibleRole

public AccessibleRole getAccessibleRole()
Returns the accessible role for the JTable component.

Overrides:
getAccessibleRole in class JComponent.AccessibleJComponent
Returns:
AccessibleRole.TABLE.
See Also:
AccessibleRole

getAccessibleTable

public AccessibleTable getAccessibleTable()
Returns the accessible table.

Overrides:
getAccessibleTable in class AccessibleContext
Returns:
this.
See Also:
AccessibleTable

getAccessibleSelectionCount

public int getAccessibleSelectionCount()
Returns the number of selected items in this table.

Specified by:
getAccessibleSelectionCount in interface AccessibleSelection
Returns:
the number of selected children

getAccessibleSelection

public Accessible getAccessibleSelection(int i)
Returns the selected accessible object with the specified index i. This basically returns the i-th selected cell in the table when going though it row-wise, and inside the rows, column-wise.

Specified by:
getAccessibleSelection in interface AccessibleSelection
Parameters:
i - the index of the selected object to find
Returns:
the selected accessible object with the specified index i
See Also:
AccessibleSelection.getAccessibleSelectionCount()

isAccessibleChildSelected

public boolean isAccessibleChildSelected(int i)
Returns true if the accessible child with the index i is selected, false otherwise.

Specified by:
isAccessibleChildSelected in interface AccessibleSelection
Parameters:
i - the index of the accessible to check
Returns:
true if the accessible child with the index i is selected, false otherwise

addAccessibleSelection

public void addAccessibleSelection(int i)
Adds the accessible child with the specified index i to the selection.

Specified by:
addAccessibleSelection in interface AccessibleSelection
Parameters:
i - the index of the accessible child to add to the selection

removeAccessibleSelection

public void removeAccessibleSelection(int i)
Removes the accessible child with the specified index i from the current selection. This will only work on tables that have cell selection enabled (rowSelectionAllowed == false && columnSelectionAllowed == false).

Specified by:
removeAccessibleSelection in interface AccessibleSelection
Parameters:
i - the index of the accessible to be removed from the selection

clearAccessibleSelection

public void clearAccessibleSelection()
Deselects all selected accessible children.

Specified by:
clearAccessibleSelection in interface AccessibleSelection

selectAllAccessibleSelection

public void selectAllAccessibleSelection()
Selects all accessible children that can be selected. This will only work on tables that support multiple selections and that have individual cell selection enabled.

Specified by:
selectAllAccessibleSelection in interface AccessibleSelection

valueChanged

public void valueChanged(ListSelectionEvent event)
Receives notification when the row selection changes and fires appropriate property change events.

Specified by:
valueChanged in interface ListSelectionListener
Parameters:
event - the list selection event

tableChanged

public void tableChanged(TableModelEvent event)
Receives notification when the table model changes. Depending on the type of change, this method calls tableRowsInserted(javax.swing.event.TableModelEvent) or tableRowsDeleted(javax.swing.event.TableModelEvent).

Specified by:
tableChanged in interface TableModelListener
Parameters:
event - the table model event

tableRowsInserted

public void tableRowsInserted(TableModelEvent event)
Receives notification when one or more rows have been inserted into the table and fires appropriate property change events.

Parameters:
event - the table model event

tableRowsDeleted

public void tableRowsDeleted(TableModelEvent event)
Receives notification when one or more rows have been deleted from the table.

Parameters:
event - the table model event

columnAdded

public void columnAdded(TableColumnModelEvent event)
Description copied from interface: TableColumnModelListener
Called by the TableColumnModel to indicate that a column has been added to the model.

Specified by:
columnAdded in interface TableColumnModelListener
Parameters:
event - information about the column addition.

columnRemoved

public void columnRemoved(TableColumnModelEvent event)
Description copied from interface: TableColumnModelListener
Called by the TableColumnModel to indicate that a column has been removed from the model.

Specified by:
columnRemoved in interface TableColumnModelListener
Parameters:
event - information about the column removal.

columnMoved

public void columnMoved(TableColumnModelEvent event)
Description copied from interface: TableColumnModelListener
Called by the TableColumnModel to indicate that a column has been moved.

Specified by:
columnMoved in interface TableColumnModelListener
Parameters:
event - information about the column move.

columnMarginChanged

public void columnMarginChanged(ChangeEvent event)
Description copied from interface: TableColumnModelListener
Called by the TableColumnModel to indicate that the model's column margin has changed.

Specified by:
columnMarginChanged in interface TableColumnModelListener
Parameters:
event - the event (identifies the source).

columnSelectionChanged

public void columnSelectionChanged(ListSelectionEvent event)
Description copied from interface: TableColumnModelListener
Called by the TableColumnModel to indicate that the column selection state has changed.

Specified by:
columnSelectionChanged in interface TableColumnModelListener
Parameters:
event - information about the column selection state.

editingCanceled

public void editingCanceled(ChangeEvent event)
Description copied from interface: CellEditorListener
Editing has been canceled

Specified by:
editingCanceled in interface CellEditorListener
Parameters:
event - Change Event

editingStopped

public void editingStopped(ChangeEvent event)
Description copied from interface: CellEditorListener
Editing has been stopped

Specified by:
editingStopped in interface CellEditorListener
Parameters:
event - Change Event

propertyChange

public void propertyChange(PropertyChangeEvent e)
Receives notification when any of the JTable's properties changes. This is used to replace the listeners on the table's model, selection model, column model and cell editor.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - the property change event

getAccessibleRow

public int getAccessibleRow(int index)
Returns the row number of an accessible child (cell) with the specified index.

Specified by:
getAccessibleRow in interface AccessibleExtendedTable
Parameters:
index - the index of the cell of which the row number is queried
Returns:
the row number of an accessible child (cell) with the specified index

getAccessibleColumn

public int getAccessibleColumn(int index)
Returns the column number of an accessible child (cell) with the specified index.

Specified by:
getAccessibleColumn in interface AccessibleExtendedTable
Parameters:
index - the index of the cell of which the column number is queried
Returns:
the column number of an accessible child (cell) with the specified index

getAccessibleIndex

public int getAccessibleIndex(int r,
                              int c)
Returns the index of the accessible child at the specified row and column.

Specified by:
getAccessibleIndex in interface AccessibleExtendedTable
Parameters:
r - the row number
c - the column number
Returns:
the index of the accessible child at the specified row and column

getAccessibleCaption

public Accessible getAccessibleCaption()
Returns the caption of the table.

Specified by:
getAccessibleCaption in interface AccessibleTable
Returns:
the caption of the table
See Also:
setAccessibleCaption(Accessible)

setAccessibleCaption

public void setAccessibleCaption(Accessible c)
Sets the caption for the table.

Specified by:
setAccessibleCaption in interface AccessibleTable
Parameters:
c - the caption to set

getAccessibleSummary

public Accessible getAccessibleSummary()
Returns the summary for the table.

Specified by:
getAccessibleSummary in interface AccessibleTable
Returns:
the summary for the table

setAccessibleSummary

public void setAccessibleSummary(Accessible s)
Sets the summary for the table.

Specified by:
setAccessibleSummary in interface AccessibleTable
Parameters:
s - the summary to set

getAccessibleRowCount

public int getAccessibleRowCount()
Returns the number of rows in the table.

Specified by:
getAccessibleRowCount in interface AccessibleTable
Returns:
the number of rows in the table

getAccessibleColumnCount

public int getAccessibleColumnCount()
Returns the number of columns in the table.

Specified by:
getAccessibleColumnCount in interface AccessibleTable
Returns:
the number of columns in the table

getAccessibleChild

public Accessible getAccessibleChild(int index)
Returns the accessible child at the given index.

Overrides:
getAccessibleChild in class JComponent.AccessibleJComponent
Parameters:
index - the child index.
Returns:
The accessible child.
See Also:
Component.AccessibleAWTComponent.getAccessibleChildrenCount()

getAccessibleAt

public Accessible getAccessibleAt(int r,
                                  int c)
Returns the accessible child (table cell) at the specified row and column.

Specified by:
getAccessibleAt in interface AccessibleTable
Parameters:
r - the row number
c - the column number
Returns:
the accessible child (table cell) at the specified row and column

getAccessibleRowExtentAt

public int getAccessibleRowExtentAt(int r,
                                    int c)
Returns the number of rows that the specified cell occupies. The standard table cells only occupy one row, so we return 1 here.

Specified by:
getAccessibleRowExtentAt in interface AccessibleTable
Parameters:
r - the row number
c - the column number
Returns:
the number of rows that the specified cell occupies

getAccessibleColumnExtentAt

public int getAccessibleColumnExtentAt(int r,
                                       int c)
Returns the number of columns that the specified cell occupies. The standard table cells only occupy one column, so we return 1 here.

Specified by:
getAccessibleColumnExtentAt in interface AccessibleTable
Parameters:
r - the row number
c - the column number
Returns:
the number of rows that the specified cell occupies

getAccessibleRowHeader

public AccessibleTable getAccessibleRowHeader()
Returns the accessible row header.

Specified by:
getAccessibleRowHeader in interface AccessibleTable
Returns:
the accessible row header

setAccessibleRowHeader

public void setAccessibleRowHeader(AccessibleTable header)
Sets the accessible row header.

Specified by:
setAccessibleRowHeader in interface AccessibleTable
Parameters:
header - the header to set

getAccessibleColumnHeader

public AccessibleTable getAccessibleColumnHeader()
Returns the column header.

Specified by:
getAccessibleColumnHeader in interface AccessibleTable
Returns:
the column header, or null if there is no column header

setAccessibleColumnHeader

public void setAccessibleColumnHeader(AccessibleTable header)
Sets the accessible column header. The default implementation doesn't allow changing the header this way, so this is a no-op.

Specified by:
setAccessibleColumnHeader in interface AccessibleTable
Parameters:
header - the accessible column header to set

getAccessibleRowDescription

public Accessible getAccessibleRowDescription(int r)
Returns the accessible description for the row with the specified index, or null if no description has been set.

Specified by:
getAccessibleRowDescription in interface AccessibleTable
Parameters:
r - the row for which the description is queried
Returns:
the accessible description for the row with the specified index, or null if no description has been set

setAccessibleRowDescription

public void setAccessibleRowDescription(int r,
                                        Accessible description)
Sets the accessible description for the row with the specified index.

Specified by:
setAccessibleRowDescription in interface AccessibleTable
Parameters:
r - the row number for which to set the description
description - the description to set

getAccessibleColumnDescription

public Accessible getAccessibleColumnDescription(int c)
Returns the accessible description for the column with the specified index, or null if no description has been set.

Specified by:
getAccessibleColumnDescription in interface AccessibleTable
Parameters:
c - the column for which the description is queried
Returns:
the accessible description for the column with the specified index, or null if no description has been set

setAccessibleColumnDescription

public void setAccessibleColumnDescription(int c,
                                           Accessible description)
Sets the accessible description for the column with the specified index.

Specified by:
setAccessibleColumnDescription in interface AccessibleTable
Parameters:
c - the column number for which to set the description
description - the description to set

isAccessibleSelected

public boolean isAccessibleSelected(int r,
                                    int c)
Returns true if the accessible child at the specified row and column is selected, false otherwise.

Specified by:
isAccessibleSelected in interface AccessibleTable
Parameters:
r - the row number of the child
c - the column number of the child
Returns:
true if the accessible child at the specified row and column is selected, false otherwise

isAccessibleRowSelected

public boolean isAccessibleRowSelected(int r)
Returns true if the row with the specified index is selected, false otherwise.

Specified by:
isAccessibleRowSelected in interface AccessibleTable
Parameters:
r - the row number
Returns:
true if the row with the specified index is selected, false otherwise

isAccessibleColumnSelected

public boolean isAccessibleColumnSelected(int c)
Returns true if the column with the specified index is selected, false otherwise.

Specified by:
isAccessibleColumnSelected in interface AccessibleTable
Parameters:
c - the column number
Returns:
true if the column with the specified index is selected, false otherwise

getSelectedAccessibleRows

public int[] getSelectedAccessibleRows()
Returns the indices of all selected rows.

Specified by:
getSelectedAccessibleRows in interface AccessibleTable
Returns:
the indices of all selected rows

getSelectedAccessibleColumns

public int[] getSelectedAccessibleColumns()
Returns the indices of all selected columns.

Specified by:
getSelectedAccessibleColumns in interface AccessibleTable
Returns:
the indices of all selected columns

getAccessibleRowAtIndex

public int getAccessibleRowAtIndex(int index)
Returns the accessible row at the specified index.

Parameters:
index - the index for which to query the row
Returns:
the row number at the specified table index

getAccessibleColumnAtIndex

public int getAccessibleColumnAtIndex(int index)
Returns the accessible column at the specified index.

Parameters:
index - the index for which to query the column
Returns:
the column number at the specified table index

getAccessibleIndexAt

public int getAccessibleIndexAt(int row,
                                int column)
Returns the accessible child index at the specified column and row.

Parameters:
row - the row
column - the column
Returns:
the index of the accessible child at the specified row and column