All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.accessibility.util.Translator

java.lang.Object
   |
   +----com.sun.java.accessibility.AccessibleContext
           |
           +----com.sun.java.accessibility.util.Translator

public class Translator
extends AccessibleContext
implements Accessible, AccessibleComponent

The Translator class provides a translation to interface Accessible for objects that do not implement interface Accessible. Assistive technologies can use the 'getAccessible' class method of Translator to obtain an object that implements interface Accessible. If the object passed in already implements interface Accessible, getAccessible merely returns the object.

An example of how an assistive technology might use the Translator class is as follows:

    Accessible accessible = Translator.getAccessible(someObj);
    // obtain information from the 'accessible' object.
 

NOTE: This is proof-of-concept code and is missing many things. It is also an undesirable way to implement accessibility features for a Toolkit. Instead of relying upon this code, the Toolkit's Components should implement interface Accessible directly. This is also a preliminary draft. The methods and name may change in future beta releases.


Variable Index

 o source
The source object needing translating.

Constructor Index

 o Translator()
Create a new Translator.
 o Translator(Object)
Create a new Translator with the source object o.

Method Index

 o addFocusListener(FocusListener)
Adds the specified focus listener to receive focus events from this component.
 o addPropertyChangeListener(PropertyChangeListener)
Add a PropertyChangeListener to the listener list.
 o contains(Point)
Checks whether the specified Point is within this object's bounds, where the Point is relative to the coordinate system of the object.
 o equals(Object)
Returns true if this object is the same as the one passed in.
 o getAccessible(Object)
Obtain an object that implements interface Accessible.
 o getAccessibleAt(Point)
Returns the Accessible child contained at the local coordinate Point, if one exists.
 o getAccessibleChild(int)
Return the nth Accessible child of the object.
 o getAccessibleChildrenCount()
Returns the number of accessible children in the object.
 o getAccessibleContext()
Returns this object.
 o getAccessibleDescription()
Get the accessible description of this object.
 o getAccessibleIndexInParent()
Get the index of this object in its accessible parent.
 o getAccessibleName()
Get the accessible name of this object.
 o getAccessibleParent()
Get the Accessible parent of this object.
 o getAccessibleRole()
Get the role of this object.
 o getAccessibleStateSet()
Get the state of this object, given an already populated state.
 o getBackground()
Get the background color of this object.
 o getBounds()
Returns the current bounds of this object
 o getCursor()
Get the Cursor of this object.
 o getFont()
Get the Font of this object.
 o getFontMetrics(Font)
Get the FontMetrics of this object.
 o getForeground()
Get the foreground color of this object.
 o getLocale()
Gets the locale of the component.
 o getLocation()
Returns the location of the object relative to parent.
 o getLocationOnScreen()
Returns the location of the object on the screen.
 o getSize()
Returns the current size of this object
 o getSource()
Get the source object of the Translator.
 o getTranslatorClass(Class)
Find a translator for this class.
 o isEnabled()
Determine if the object is enabled.
 o isFocusTraversable()
Returns whether this object can accept focus or not.
 o isShowing()
Determine if the object is showing.
 o isVisible()
Determine if the object is visible.
 o removeFocusListener(FocusListener)
Removes the specified focus listener so it no longer receives focus events from this component.
 o removePropertyChangeListener(PropertyChangeListener)
Remove the PropertyChangeListener from the listener list.
 o requestFocus()
Requests focus for this object.
 o setAccessibleDescription(String)
Set the accessible description of this object.
 o setAccessibleName(String)
Set the name of this object.
 o setBackground(Color)
Set the background color of this object.
 o setBounds(Rectangle)
Sets the current bounds of this object
 o setCursor(Cursor)
Set the Cursor of this object.
 o setEnabled(boolean)
Set the enabled state of the object.
 o setFont(Font)
Set the Font of this object.
 o setForeground(Color)
Set the foreground color of this object.
 o setLocation(Point)
Sets the location of the object relative to parent.
 o setSize(Dimension)
Sets the current size of this object
 o setSource(Object)
Set the source object of the Translator.
 o setVisible(boolean)
Set the visible state of the object.

Variables

 o source
 protected Object source
The source object needing translating.

Constructors

 o Translator
 public Translator()
Create a new Translator. You must call the setSource method to set the object to be translated after calling this constructor.

 o Translator
 public Translator(Object o)
Create a new Translator with the source object o.

Parameters:
o - the Component that does not implement interface Accessible

Methods

 o getTranslatorClass
 protected static Class getTranslatorClass(Class c)
Find a translator for this class. If one doesn't exist for this class explicitly, try its superclass and so on.

 o getAccessible
 public static Accessible getAccessible(Object o)
Obtain an object that implements interface Accessible. If the object passed in already implements interface Accessible, getAccessible merely returns the object.

 o getSource
 public Object getSource()
Get the source object of the Translator.

Returns:
the source object of the Translator
 o setSource
 public void setSource(Object o)
Set the source object of the Translator.

Parameters:
o - the Component that does not implement interface Accessible
 o equals
 public boolean equals(Object o)
Returns true if this object is the same as the one passed in.

Parameters:
c - the Component to check against.
Returns:
true if this is the same object.
Overrides:
equals in class Object
 o getAccessibleContext
 public AccessibleContext getAccessibleContext()
Returns this object.

 o getAccessibleName
 public String getAccessibleName()
Get the accessible name of this object.

Returns:
the localized name of the object -- can be null if this object does not have a name
Overrides:
getAccessibleName in class AccessibleContext
 o setAccessibleName
 public void setAccessibleName(String s)
Set the name of this object.

Overrides:
setAccessibleName in class AccessibleContext
 o getAccessibleDescription
 public String getAccessibleDescription()
Get the accessible description of this object.

Returns:
the description of the object -- can be null if this object does not have a description
Overrides:
getAccessibleDescription in class AccessibleContext
 o setAccessibleDescription
 public void setAccessibleDescription(String s)
Set the accessible description of this object.

Parameters:
s - the new localized description of the object
Overrides:
setAccessibleDescription in class AccessibleContext
 o getAccessibleRole
 public AccessibleRole getAccessibleRole()
Get the role of this object.

Returns:
an instance of AccessibleRole describing the role of the object
Overrides:
getAccessibleRole in class AccessibleContext
 o getAccessibleStateSet
 public AccessibleStateSet getAccessibleStateSet()
Get the state of this object, given an already populated state. This method is intended for use by subclasses so they don't have to check for everything.

Returns:
an instance of AccessibleStateSet containing the current state of the object
Overrides:
getAccessibleStateSet in class AccessibleContext
 o getAccessibleParent
 public Accessible getAccessibleParent()
Get the Accessible parent of this object.

Returns:
the Accessible parent of this object -- can be null if this object does not have an Accessible parent
Overrides:
getAccessibleParent in class AccessibleContext
 o getAccessibleIndexInParent
 public int getAccessibleIndexInParent()
Get the index of this object in its accessible parent.

Returns:
-1 of this object does not have an accessible parent. Otherwise, the index of the child in its accessible parent.
Overrides:
getAccessibleIndexInParent in class AccessibleContext
 o getAccessibleChildrenCount
 public int getAccessibleChildrenCount()
Returns the number of accessible children in the object.

Returns:
the number of accessible children in the object.
Overrides:
getAccessibleChildrenCount in class AccessibleContext
 o getAccessibleChild
 public Accessible getAccessibleChild(int i)
Return the nth Accessible child of the object.

Parameters:
i - zero-based index of child
Returns:
the nth Accessible child of the object
Overrides:
getAccessibleChild in class AccessibleContext
 o getLocale
 public Locale getLocale() throws IllegalComponentStateException
Gets the locale of the component. If the component does not have a locale, the locale of its parent is returned.

Returns:
the Locale of the object.
Overrides:
getLocale in class AccessibleContext
See Also:
setLocale
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener l)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

Overrides:
addPropertyChangeListener in class AccessibleContext
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener l)
Remove the PropertyChangeListener from the listener list.

Overrides:
removePropertyChangeListener in class AccessibleContext
 o getBackground
 public Color getBackground()
Get the background color of this object.

Returns:
if supported, the background color of the object; otherwise, null
 o setBackground
 public void setBackground(Color c)
Set the background color of this object.

Parameters:
c - the new Color for the background
 o getForeground
 public Color getForeground()
Get the foreground color of this object.

Returns:
if supported, the foreground color of the object; otherwise, null
 o setForeground
 public void setForeground(Color c)
Set the foreground color of this object.

Parameters:
c - the new Color for the foreground
 o getCursor
 public Cursor getCursor()
Get the Cursor of this object.

Returns:
if supported, the Cursor of the object; otherwise, null
 o setCursor
 public void setCursor(Cursor c)
Set the Cursor of this object.

Parameters:
c - the new Cursor for the object
 o getFont
 public Font getFont()
Get the Font of this object.

Returns:
if supported, the Font for the object; otherwise, null
 o setFont
 public void setFont(Font f)
Set the Font of this object.

Parameters:
f - the new Font for the object
 o getFontMetrics
 public FontMetrics getFontMetrics(Font f)
Get the FontMetrics of this object.

Parameters:
f - the Font
Returns:
if supported, the FontMetrics the object; otherwise, null
See Also:
getFont
 o isEnabled
 public boolean isEnabled()
Determine if the object is enabled.

Returns:
true if object is enabled; otherwise, false
 o setEnabled
 public void setEnabled(boolean b)
Set the enabled state of the object.

Parameters:
b - if true, enables this object; otherwise, disables it
 o isVisible
 public boolean isVisible()
Determine if the object is visible.

Returns:
true if object is visible; otherwise, false
 o setVisible
 public void setVisible(boolean b)
Set the visible state of the object.

Parameters:
b - if true, shows this object; otherwise, hides it
 o isShowing
 public boolean isShowing()
Determine if the object is showing. This is determined by checking the visibility of the object and ancestors of the object.

Returns:
true if object is showing; otherwise, false
 o contains
 public boolean contains(Point p)
Checks whether the specified Point is within this object's bounds, where the Point is relative to the coordinate system of the object.

Parameters:
p - the Point relative to the coordinate system of the object
Returns:
true if object contains Point; otherwise false
 o getLocationOnScreen
 public Point getLocationOnScreen()
Returns the location of the object on the screen.

Returns:
location of object on screen -- can be null if this object is not on the screen
 o getLocation
 public Point getLocation()
Returns the location of the object relative to parent.

Returns:
location of object relative to parent -- can be null if this object or its parent are not on the screen
 o setLocation
 public void setLocation(Point p)
Sets the location of the object relative to parent.

 o getBounds
 public Rectangle getBounds()
Returns the current bounds of this object

Returns:
current bounds of object -- can be null if this object is not on the screen
 o setBounds
 public void setBounds(Rectangle r)
Sets the current bounds of this object

 o getSize
 public Dimension getSize()
Returns the current size of this object

Returns:
current size of object -- can be null if this object is not on the screen
 o setSize
 public void setSize(Dimension d)
Sets the current size of this object

 o getAccessibleAt
 public Accessible getAccessibleAt(Point p)
Returns the Accessible child contained at the local coordinate Point, if one exists.

Returns:
the Accessible at the specified location, if it exists
 o isFocusTraversable
 public boolean isFocusTraversable()
Returns whether this object can accept focus or not.

Returns:
true if object can accept focus; otherwise false
 o requestFocus
 public void requestFocus()
Requests focus for this object.

 o addFocusListener
 public synchronized void addFocusListener(FocusListener l)
Adds the specified focus listener to receive focus events from this component.

Parameters:
l - the focus listener
 o removeFocusListener
 public synchronized void removeFocusListener(FocusListener l)
Removes the specified focus listener so it no longer receives focus events from this component.

Parameters:
l - the focus listener

All Packages  Class Hierarchy  This Package  Previous  Next  Index