The class provides an implementation of the Java Accessibility
API appropriate to table cells.
Method from javax.swing.JTable$AccessibleJTable$AccessibleJTableCell Detail: |
public void addFocusListener(FocusListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).addFocusListener(l);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.addFocusListener(l);
}
}
}
|
public void addPropertyChangeListener(PropertyChangeListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.addPropertyChangeListener(l);
} else {
super.addPropertyChangeListener(l);
}
}
Adds a PropertyChangeListener to the listener list.
The listener is registered for all properties. |
public boolean contains(Point p) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
Rectangle r = ((AccessibleComponent) ac).getBounds();
return r.contains(p);
} else {
Component c = getCurrentComponent();
if (c != null) {
Rectangle r = c.getBounds();
return r.contains(p);
} else {
return getBounds().contains(p);
}
}
}
Checks whether the specified point is within this
object's bounds, where the point's x and y coordinates
are defined to be relative to the coordinate system of
the object. |
public AccessibleAction getAccessibleAction() {
return getCurrentAccessibleContext().getAccessibleAction();
}
Gets the AccessibleAction associated with this
object if one exists. Otherwise returns null . |
public Accessible getAccessibleAt(Point p) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getAccessibleAt(p);
} else {
return null;
}
}
|
public Accessible getAccessibleChild(int i) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
Accessible accessibleChild = ac.getAccessibleChild(i);
ac.setAccessibleParent(this);
return accessibleChild;
} else {
return null;
}
}
Returns the specified Accessible child of the
object. |
public int getAccessibleChildrenCount() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getAccessibleChildrenCount();
} else {
return 0;
}
}
Returns the number of accessible children in the object. |
public AccessibleComponent getAccessibleComponent() {
return this; // to override getBounds()
}
Gets the AccessibleComponent associated with
this object if one exists. Otherwise returns null . |
public AccessibleContext getAccessibleContext() {
return this;
}
Gets the AccessibleContext associated with this
component. In the implementation of the Java Accessibility
API for this class, return this object, which is its own
AccessibleContext . |
public String getAccessibleDescription() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getAccessibleDescription();
} else {
return super.getAccessibleDescription();
}
}
Gets the accessible description of this object. |
public int getAccessibleIndexInParent() {
return index;
}
Gets the index of this object in its accessible parent. |
public String getAccessibleName() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
String name = ac.getAccessibleName();
if ((name != null) && (name != "")) {
// return the cell renderer's AccessibleName
return name;
}
}
if ((accessibleName != null) && (accessibleName != "")) {
return accessibleName;
} else {
// fall back to the client property
return (String)getClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY);
}
}
Gets the accessible name of this object. |
public Accessible getAccessibleParent() {
return parent;
}
Gets the Accessible parent of this object. |
public AccessibleRole getAccessibleRole() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getAccessibleRole();
} else {
return AccessibleRole.UNKNOWN;
}
}
Gets the role of this object. |
public AccessibleSelection getAccessibleSelection() {
return getCurrentAccessibleContext().getAccessibleSelection();
}
Gets the AccessibleSelection associated with
this object if one exists. Otherwise returns null . |
public AccessibleStateSet getAccessibleStateSet() {
AccessibleContext ac = getCurrentAccessibleContext();
AccessibleStateSet as = null;
if (ac != null) {
as = ac.getAccessibleStateSet();
}
if (as == null) {
as = new AccessibleStateSet();
}
Rectangle rjt = JTable.this.getVisibleRect();
Rectangle rcell = JTable.this.getCellRect(row, column, false);
if (rjt.intersects(rcell)) {
as.add(AccessibleState.SHOWING);
} else {
if (as.contains(AccessibleState.SHOWING)) {
as.remove(AccessibleState.SHOWING);
}
}
if (parent.isCellSelected(row, column)) {
as.add(AccessibleState.SELECTED);
} else if (as.contains(AccessibleState.SELECTED)) {
as.remove(AccessibleState.SELECTED);
}
if ((row == getSelectedRow()) && (column == getSelectedColumn())) {
as.add(AccessibleState.ACTIVE);
}
as.add(AccessibleState.TRANSIENT);
return as;
}
Gets the state set of this object. |
public AccessibleText getAccessibleText() {
return getCurrentAccessibleContext().getAccessibleText();
}
Gets the AccessibleText associated with this
object if one exists. Otherwise returns null . |
public AccessibleValue getAccessibleValue() {
return getCurrentAccessibleContext().getAccessibleValue();
}
Gets the AccessibleValue associated with
this object if one exists. Otherwise returns null . |
public Color getBackground() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getBackground();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getBackground();
} else {
return null;
}
}
}
Gets the background color of this object. |
public Rectangle getBounds() {
if (parent != null) {
return parent.getCellRect(row, column, false);
} else {
return null;
}
}
|
protected AccessibleContext getCurrentAccessibleContext() {
TableColumn aColumn = getColumnModel().getColumn(column);
TableCellRenderer renderer = aColumn.getCellRenderer();
if (renderer == null) {
Class< ? > columnClass = getColumnClass(column);
renderer = getDefaultRenderer(columnClass);
}
Component component = renderer.getTableCellRendererComponent(
JTable.this, getValueAt(row, column),
false, false, row, column);
if (component instanceof Accessible) {
return component.getAccessibleContext();
} else {
return null;
}
}
Gets the AccessibleContext for the table cell renderer. |
protected Component getCurrentComponent() {
TableColumn aColumn = getColumnModel().getColumn(column);
TableCellRenderer renderer = aColumn.getCellRenderer();
if (renderer == null) {
Class< ? > columnClass = getColumnClass(column);
renderer = getDefaultRenderer(columnClass);
}
return renderer.getTableCellRendererComponent(
JTable.this, null, false, false,
row, column);
}
Gets the table cell renderer component. |
public Cursor getCursor() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getCursor();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getCursor();
} else {
Accessible ap = getAccessibleParent();
if (ap instanceof AccessibleComponent) {
return ((AccessibleComponent) ap).getCursor();
} else {
return null;
}
}
}
}
Gets the Cursor of this object. |
public Font getFont() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getFont();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getFont();
} else {
return null;
}
}
}
Gets the Font of this object. |
public FontMetrics getFontMetrics(Font f) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getFontMetrics(f);
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getFontMetrics(f);
} else {
return null;
}
}
}
Gets the FontMetrics of this object. |
public Color getForeground() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).getForeground();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.getForeground();
} else {
return null;
}
}
}
Gets the foreground color of this object. |
public Locale getLocale() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
return ac.getLocale();
} else {
return null;
}
}
Gets the locale of the component. If the component
does not have a locale, then the locale of its parent
is returned. |
public Point getLocation() {
if (parent != null) {
Rectangle r = parent.getCellRect(row, column, false);
if (r != null) {
return r.getLocation();
}
}
return null;
}
Gets the location of the object relative to the parent
in the form of a point specifying the object's
top-left corner in the screen's coordinate space. |
public Point getLocationOnScreen() {
if (parent != null) {
Point parentLocation = parent.getLocationOnScreen();
Point componentLocation = getLocation();
componentLocation.translate(parentLocation.x, parentLocation.y);
return componentLocation;
} else {
return null;
}
}
Returns the location of the object on the screen. |
public Dimension getSize() {
if (parent != null) {
Rectangle r = parent.getCellRect(row, column, false);
if (r != null) {
return r.getSize();
}
}
return null;
}
|
public boolean isEnabled() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isEnabled();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isEnabled();
} else {
return false;
}
}
}
Determines if the object is enabled. |
public boolean isFocusTraversable() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isFocusTraversable();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isFocusTraversable();
} else {
return false;
}
}
}
|
public boolean isShowing() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
if (ac.getAccessibleParent() != null) {
return ((AccessibleComponent) ac).isShowing();
} else {
// Fixes 4529616 - AccessibleJTableCell.isShowing()
// returns false when the cell on the screen
// if no parent
return isVisible();
}
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isShowing();
} else {
return false;
}
}
}
Determines if the object is showing. This is determined
by checking the visibility of the object and ancestors
of the object. Note: this will return true even if the
object is obscured by another (for example,
it happens to be underneath a menu that was pulled down). |
public boolean isVisible() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
return ((AccessibleComponent) ac).isVisible();
} else {
Component c = getCurrentComponent();
if (c != null) {
return c.isVisible();
} else {
return false;
}
}
}
Determines if this object is visible. Note: this means that the
object intends to be visible; however, it may not in fact be
showing on the screen because one of the objects that this object
is contained by is not visible. To determine if an object is
showing on the screen, use isShowing . |
public void removeFocusListener(FocusListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).removeFocusListener(l);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.removeFocusListener(l);
}
}
}
|
public void removePropertyChangeListener(PropertyChangeListener l) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.removePropertyChangeListener(l);
} else {
super.removePropertyChangeListener(l);
}
}
Removes a PropertyChangeListener from the
listener list. This removes a PropertyChangeListener
that was registered for all properties. |
public void requestFocus() {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).requestFocus();
} else {
Component c = getCurrentComponent();
if (c != null) {
c.requestFocus();
}
}
}
|
public void setAccessibleDescription(String s) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.setAccessibleDescription(s);
} else {
super.setAccessibleDescription(s);
}
}
Sets the accessible description of this object. |
public void setAccessibleName(String s) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac != null) {
ac.setAccessibleName(s);
} else {
super.setAccessibleName(s);
}
}
Sets the localized accessible name of this object. |
public void setBackground(Color c) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setBackground(c);
} else {
Component cp = getCurrentComponent();
if (cp != null) {
cp.setBackground(c);
}
}
}
Sets the background color of this object. |
public void setBounds(Rectangle r) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setBounds(r);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setBounds(r);
}
}
}
|
public void setCursor(Cursor c) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setCursor(c);
} else {
Component cp = getCurrentComponent();
if (cp != null) {
cp.setCursor(c);
}
}
}
Sets the Cursor of this object. |
public void setEnabled(boolean b) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setEnabled(b);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setEnabled(b);
}
}
}
Sets the enabled state of the object. |
public void setFont(Font f) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setFont(f);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setFont(f);
}
}
}
Sets the Font of this object. |
public void setForeground(Color c) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setForeground(c);
} else {
Component cp = getCurrentComponent();
if (cp != null) {
cp.setForeground(c);
}
}
}
Sets the foreground color of this object. |
public void setLocation(Point p) {
// if ((parent != null) && (parent.contains(p))) {
// ensureIndexIsVisible(indexInParent);
// }
}
Sets the location of the object relative to the parent. |
public void setSize(Dimension d) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setSize(d);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setSize(d);
}
}
}
|
public void setVisible(boolean b) {
AccessibleContext ac = getCurrentAccessibleContext();
if (ac instanceof AccessibleComponent) {
((AccessibleComponent) ac).setVisible(b);
} else {
Component c = getCurrentComponent();
if (c != null) {
c.setVisible(b);
}
}
}
Sets the visible state of the object. |