javax.swing

Class JTable.AccessibleJTable

Enclosing Class:
JTable
Implemented Interfaces:
AccessibleComponent, AccessibleExtendedComponent, AccessibleExtendedTable, AccessibleSelection, AccessibleTable, CellEditorListener, EventListener, ListSelectionListener, PropertyChangeListener, Serializable, TableColumnModelListener, TableModelListener

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.Container.AccessibleAWTContainer

Container.AccessibleAWTContainer.AccessibleContainerHandler

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.Container.AccessibleAWTContainer

accessibleContainerHandler

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

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)
void
columnMarginChanged(ChangeEvent event)
void
columnMoved(TableColumnModelEvent event)
void
columnRemoved(TableColumnModelEvent event)
void
columnSelectionChanged(ListSelectionEvent event)
void
editingCanceled(ChangeEvent event)
void
editingStopped(ChangeEvent event)
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, getAccessibleChild, getAccessibleChildrenCount, getAccessibleDescription, getAccessibleKeyBinding, getAccessibleName, getAccessibleRole, getAccessibleStateSet, getBorderTitle, getTitledBorderText, getToolTipText, removePropertyChangeListener

Methods inherited from class java.awt.Container.AccessibleAWTContainer

getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount

Methods inherited from class java.awt.Component.AccessibleAWTComponent

addFocusListener, addPropertyChangeListener, contains, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAccessibleComponent, getAccessibleDescription, getAccessibleIndexInParent, getAccessibleName, getAccessibleParent, getAccessibleRole, getAccessibleStateSet, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getLocale, getLocation, getLocationOnScreen, getSize, isEnabled, isFocusTraversable, isShowing, isVisible, removeFocusListener, removePropertyChangeListener, requestFocus, setBackground, setBounds, setCursor, setEnabled, setFont, setForeground, setLocation, setSize, setVisible

Methods inherited from class javax.accessibility.AccessibleContext

addPropertyChangeListener, firePropertyChange, getAccessibleAction, getAccessibleChild, getAccessibleChildrenCount, getAccessibleComponent, getAccessibleDescription, getAccessibleEditableText, getAccessibleIcon, getAccessibleIndexInParent, getAccessibleName, getAccessibleParent, getAccessibleRelationSet, getAccessibleRole, getAccessibleSelection, getAccessibleStateSet, getAccessibleTable, getAccessibleText, getAccessibleValue, getLocale, removePropertyChangeListener, setAccessibleDescription, setAccessibleName, setAccessibleParent

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

AccessibleJTable

protected AccessibleJTable()
Creates a new AccessibleJTable.
Since:
JDK1.5

Method Details

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

clearAccessibleSelection

public void clearAccessibleSelection()
Deselects all selected accessible children.
Specified by:
clearAccessibleSelection in interface AccessibleSelection

columnAdded

public void columnAdded(TableColumnModelEvent event)
Specified by:
columnAdded in interface TableColumnModelListener

columnMarginChanged

public void columnMarginChanged(ChangeEvent event)
Specified by:
columnMarginChanged in interface TableColumnModelListener

columnMoved

public void columnMoved(TableColumnModelEvent event)
Specified by:
columnMoved in interface TableColumnModelListener

columnRemoved

public void columnRemoved(TableColumnModelEvent event)
Specified by:
columnRemoved in interface TableColumnModelListener

columnSelectionChanged

public void columnSelectionChanged(ListSelectionEvent event)
Specified by:
columnSelectionChanged in interface TableColumnModelListener

editingCanceled

public void editingCanceled(ChangeEvent event)
Specified by:
editingCanceled in interface CellEditorListener

editingStopped

public void editingStopped(ChangeEvent event)
Specified by:
editingStopped in interface CellEditorListener

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

getAccessibleCaption

public Accessible getAccessibleCaption()
Returns the caption of the table.
Specified by:
getAccessibleCaption in interface AccessibleTable
Returns:
the caption of the table

getAccessibleChild

public Accessible getAccessibleChild(int index)
Returns the accessible child at the given index.
Overrides:
getAccessibleChild in interface JComponent.AccessibleJComponent
Parameters:
index - the child index.
Returns:
The accessible child.

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

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

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

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

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

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

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

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

getAccessibleRole

public AccessibleRole getAccessibleRole()
Returns the accessible role for the JTable component.
Overrides:
getAccessibleRole in interface JComponent.AccessibleJComponent

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

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

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

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

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

getAccessibleRowHeader

public AccessibleTable getAccessibleRowHeader()
Returns the accessible row header.
Specified by:
getAccessibleRowHeader in interface AccessibleTable
Returns:
the accessible row header

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

getAccessibleSelectionCount

public int getAccessibleSelectionCount()
Returns the number of selected items in this table.
Specified by:
getAccessibleSelectionCount in interface AccessibleSelection

getAccessibleSummary

public Accessible getAccessibleSummary()
Returns the summary for the table.
Specified by:
getAccessibleSummary in interface AccessibleTable
Returns:
the summary for the table

getAccessibleTable

public AccessibleTable getAccessibleTable()
Returns the accessible table.
Overrides:
getAccessibleTable in interface AccessibleContext
Returns:
this.

getSelectedAccessibleColumns

public int[] getSelectedAccessibleColumns()
Returns the indices of all selected columns.
Specified by:
getSelectedAccessibleColumns in interface AccessibleTable
Returns:
the indices of all selected columns

getSelectedAccessibleRows

public int[] getSelectedAccessibleRows()
Returns the indices of all selected rows.
Specified by:
getSelectedAccessibleRows in interface AccessibleTable
Returns:
the indices of all selected rows

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

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

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

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

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

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

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

setAccessibleCaption

public void setAccessibleCaption(Accessible c)
Sets the caption for the table.
Specified by:
setAccessibleCaption in interface AccessibleTable
Parameters:
c - the caption to 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

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

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

setAccessibleRowHeader

public void setAccessibleRowHeader(AccessibleTable header)
Sets the accessible row header.
Specified by:
setAccessibleRowHeader in interface AccessibleTable
Parameters:
header - the header to set

setAccessibleSummary

public void setAccessibleSummary(Accessible s)
Sets the summary for the table.
Specified by:
setAccessibleSummary in interface AccessibleTable
Parameters:
s - the summary to set

tableChanged

public void tableChanged(TableModelEvent event)
Receives notification when the table model changes. Depending on the type of change, this method calls tableRowsInserted(TableModelEvent) or tableRowsDeleted(TableModelEvent).
Specified by:
tableChanged in interface TableModelListener
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

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

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

JTable.java -- Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.