All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.accessibility.Translator
java.lang.Object
|
+----com.sun.java.accessibility.Translator
- public class Translator
- extends Object
- implements Accessible
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.
-
source
- The source object needing translating.
-
Translator()
- Create a new Translator.
-
Translator(Object)
- Create a new Translator with the source object o.
-
addAccessibleSelection(int)
- Adds the nth selected item in the object to the object's
selection.
-
addFocusListener(FocusListener)
- Adds the specified focus listener to receive focus events from this
component.
-
clearAccessibleSelection()
- Clears the selection in the object, so that nothing in the
object is selected.
-
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.
-
doAccessibleAction(int)
- Perform the nth Action on the object
-
equals(Object)
- Returns true if this object is the same as the one passed in.
-
getAccessible(Object)
-
Obtain an object that implements interface Accessible.
-
getAccessibleActionCount()
- Returns the number of Actions available in this object
If there is more than one, the first one is the "default"
action (if any action is considered "default").
-
getAccessibleActionDescription(int)
- Return a description of the nth action of the object.
-
getAccessibleAt(Point)
- Returns the Accessible child contained at the local coordinate
Point, if one exists.
-
getAccessibleChild(int)
- Return the nth Accessible child of the object.
-
getAccessibleChildrenCount()
- Returns the number of accessible children in the object.
-
getAccessibleDescription()
- Get the accessible description of this object.
-
getAccessibleName()
- Get the accessible name of this object.
-
getAccessibleParent()
- Get the Accessible parent of this object.
-
getAccessibleRole()
- Get the role of this object.
-
getAccessibleSelection(int)
- Returns an Accessible representing the nth selected item
in the object.
-
getAccessibleSelectionCount()
- Returns the number of items currently selected.
-
getAccessibleStateSet()
- Get the state of this object, given an already populated state.
-
getAccessibleText()
- Gets the AccessibleText interface for the component.
-
getAccessibleValue()
- Get the value of this object as a String.
-
getBackground()
- Get the background color of this object.
-
getBounds()
-
Returns the current bounds of this object
-
getCursor()
- Get the Cursor of this object.
-
getFont()
- Get the Font of this object.
-
getFontMetrics(Font)
- Get the FontMetrics of this object.
-
getForeground()
- Get the foreground color of this object.
-
getLocale()
- Gets the locale of the component.
-
getLocation()
-
Returns the location of the object relative to parent.
-
getLocationOnScreen()
-
Returns the location of the object on the screen.
-
getNextAccessibleSibling()
- Get the next sibling of this Accessible, if a preferred one exists.
-
getPreviousAccessibleSibling()
- Get the previous sibling of this Accessible, if a preferred one exists.
-
getSize()
-
Returns the current size of this object
-
getSource()
- Get the source object of the Translator.
-
getTranslatorClass(Class)
- Find a translator for this class.
-
isEnabled()
- Determine if the object is enabled.
-
isFocusTraversable()
- Returns whether this object can accept focus or not.
-
isShowing()
- Determine if the object is showing.
-
isVisible()
- Determine if the object is visible.
-
removeAccessibleSelection(int)
- Removes the nth selected item in the object from the object's
selection.
-
removeFocusListener(FocusListener)
- Removes the specified focus listener so it no longer receives focus
events from this component.
-
requestFocus()
- Requests focus for this object.
-
selectAllAccessibleSelection()
- Causes every selected item in the object to be selected,
if the object supports multiple selections (if getAccessibleStateSet
returns a state that is MULTISELECTABLE).
-
setAccessibleDescription(String)
- Set the accessible description of this object.
-
setAccessibleName(String)
- Set the name of this object.
-
setBackground(Color)
- Set the background color of this object.
-
setBounds(Rectangle)
-
Sets the current bounds of this object
-
setCursor(Cursor)
- Set the Cursor of this object.
-
setEnabled(boolean)
- Set the enabled state of the object.
-
setFont(Font)
- Set the Font of this object.
-
setForeground(Color)
- Set the foreground color of this object.
-
setLocale(Locale)
- Sets the locale of the component.
-
setLocation(Point)
-
Sets the location of the object relative to parent.
-
setSize(Dimension)
-
Sets the current size of this object
-
setSource(Object)
- Set the source object of the Translator.
-
setVisible(boolean)
- Set the visible state of the object.
source
protected Object source
- The source object needing translating.
Translator
public Translator()
- Create a new Translator. You must call the setSource method to
set the object to be translated after calling this constructor.
Translator
public Translator(Object o)
- Create a new Translator with the source object o.
- Parameters:
- o - the Component that does not implement interface Accessible
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.
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.
getSource
public Object getSource()
- Get the source object of the Translator.
- Returns:
- the source object of the Translator
setSource
public void setSource(Object o)
- Set the source object of the Translator.
- Parameters:
- o - the Component that does not implement interface Accessible
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
getNextAccessibleSibling
public Accessible getNextAccessibleSibling()
- Get the next sibling of this Accessible, if a preferred one exists.
This should generally return the next item in the tab order, if
that item implements Accessible
- Returns:
- the next Accessible, if there is one
getPreviousAccessibleSibling
public Accessible getPreviousAccessibleSibling()
- Get the previous sibling of this Accessible, if a preferred one exists.
This should generally return the previous item in the tab order, if
that item implements Accessible
- Returns:
- the previous Accessible, if there is one
getBackground
public Color getBackground()
- Get the background color of this object.
- Returns:
- if supported, the background color of the object; otherwise, null
setBackground
public void setBackground(Color c)
- Set the background color of this object.
- Parameters:
- c - the new Color for the background
getForeground
public Color getForeground()
- Get the foreground color of this object.
- Returns:
- if supported, the foreground color of the object; otherwise, null
setForeground
public void setForeground(Color c)
- Set the foreground color of this object.
- Parameters:
- c - the new Color for the foreground
getCursor
public Cursor getCursor()
- Get the Cursor of this object.
- Returns:
- if supported, the Cursor of the object; otherwise, null
setCursor
public void setCursor(Cursor c)
- Set the Cursor of this object.
- Parameters:
- c - the new Cursor for the object
getFont
public Font getFont()
- Get the Font of this object.
- Returns:
- if supported, the Font for the object; otherwise, null
setFont
public void setFont(Font f)
- Set the Font of this object.
- Parameters:
- f - the new Font for the object
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
isEnabled
public boolean isEnabled()
- Determine if the object is enabled.
- Returns:
- true if object is enabled; otherwise, false
setEnabled
public void setEnabled(boolean b)
- Set the enabled state of the object.
- Parameters:
- b - if true, enables this object; otherwise, disables it
isVisible
public boolean isVisible()
- Determine if the object is visible.
- Returns:
- true if object is visible; otherwise, false
setVisible
public void setVisible(boolean b)
- Set the visible state of the object.
- Parameters:
- b - if true, shows this object; otherwise, hides it
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
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
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
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
setLocation
public void setLocation(Point p)
- Sets the location of the object relative to parent.
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
setBounds
public void setBounds(Rectangle r)
- Sets the current bounds of this object
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
setSize
public void setSize(Dimension d)
- Sets the current size of this object
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
isFocusTraversable
public boolean isFocusTraversable()
- Returns whether this object can accept focus or not.
- Returns:
- true if object can accept focus; otherwise false
requestFocus
public void requestFocus()
- Requests focus for this object.
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
setAccessibleName
public void setAccessibleName(String s)
- Set the name of this object.
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
setAccessibleDescription
public void setAccessibleDescription(String s)
- Set the accessible description of this object.
- Parameters:
- s - the new localized description of the object
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
getAccessibleRole
public AccessibleRole getAccessibleRole()
- Get the role of this object.
- Returns:
- an instance of AccessibleRole describing the role of the object
getAccessibleValue
public String getAccessibleValue()
- Get the value of this object as a String.
- Returns:
- human readable value of the object -- can be null if this
object does not have a value
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
getAccessibleChildrenCount
public int getAccessibleChildrenCount()
- Returns the number of accessible children in the object.
- Returns:
- the number of accessible children in the object.
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
getAccessibleActionCount
public int getAccessibleActionCount()
- Returns the number of Actions available in this object
If there is more than one, the first one is the "default"
action (if any action is considered "default").
- Returns:
- the number of Actions in this object
getAccessibleActionDescription
public String getAccessibleActionDescription(int i)
- Return a description of the nth action of the object.
This description should be human-readable; by default
it currently isn't...
- Parameters:
- i - zero-based index of the actions
- Returns:
- a description of the nth action
doAccessibleAction
public boolean doAccessibleAction(int i)
- Perform the nth Action on the object
- Parameters:
- i - zero-based index of actions
- Returns:
- whether the action was performed or not.
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.
- See Also:
- setLocale
setLocale
public void setLocale(Locale l)
- Sets the locale of the component.
- Parameters:
- l - the new Locale of the object.
- See Also:
- getLocale
getAccessibleText
public AccessibleText getAccessibleText()
- Gets the AccessibleText interface for the component. If the component
does not speak AccessibleText, or have a proxy which does, this
method returns null.
- Returns:
- the AccessibleText of the object.
- See Also:
- AccessibleText
addFocusListener
public synchronized void addFocusListener(FocusListener l)
- Adds the specified focus listener to receive focus events from this
component.
- Parameters:
- l - the focus listener
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
getAccessibleSelectionCount
public int getAccessibleSelectionCount()
- Returns the number of items currently selected.
If no items are selected, the return value will be 0.
- Returns:
- the number of items currently selected.
getAccessibleSelection
public Accessible getAccessibleSelection(int i)
- Returns an Accessible representing the nth selected item
in the object. If there isn't a selection, or there are
fewer items selcted than the integer passed in, the return
value will be null.
- Parameters:
- i - the zero-based index of selected items
- Returns:
- an Accessible containing the selected item
addAccessibleSelection
public void addAccessibleSelection(int i)
- Adds the nth selected item in the object to the object's
selection. If the object supports multiple selections,
(the method getAccessibleStateSet returns a state that is MULTISELECTABLE)
the nth item is added to any existing selection, otherwse
it replaces any existing selection in the objct. If the
nth item is already selected, this method has no effect.
- Parameters:
- i - the zero-based index of selectable items
- See Also:
- getAccessibleStateSet
removeAccessibleSelection
public void removeAccessibleSelection(int i)
- Removes the nth selected item in the object from the object's
selection. If the nth item isn't currently selected, this
method has no effect.
- Parameters:
- i - the zero-based index of selectable items
clearAccessibleSelection
public void clearAccessibleSelection()
- Clears the selection in the object, so that nothing in the
object is selected.
selectAllAccessibleSelection
public void selectAllAccessibleSelection()
- Causes every selected item in the object to be selected,
if the object supports multiple selections (if getAccessibleStateSet
returns a state that is MULTISELECTABLE).
- See Also:
- getAccessibleStateSet
All Packages Class Hierarchy This Package Previous Next Index