diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/javax/accessibility | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/classpath/javax/accessibility')
28 files changed, 4726 insertions, 0 deletions
diff --git a/libjava/classpath/javax/accessibility/Accessible.java b/libjava/classpath/javax/accessibility/Accessible.java new file mode 100644 index 000000000..0aa5ea569 --- /dev/null +++ b/libjava/classpath/javax/accessibility/Accessible.java @@ -0,0 +1,61 @@ +/* Accessible.java -- primary Java accessibility interface + Copyright (C) 2000, 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * Implementing the Accessibility API must start with implementation + * of this interface at a bare minimum. This is the major interface + * for the Accessibility API which must be implemented by all user + * interface components. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @since 1.2 + * @status updated to 1.4 + */ +public interface Accessible +{ + /** + * If a component supports the Accessibility API then this method should + * not return <code>null</code>. Only classes which must extend an accessible + * class, but must not itself be accessible, may return null. + * + * @return the context associated with this accessible object + */ + AccessibleContext getAccessibleContext(); +} // interface Accessible diff --git a/libjava/classpath/javax/accessibility/AccessibleAction.java b/libjava/classpath/javax/accessibility/AccessibleAction.java new file mode 100644 index 000000000..c2e007141 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleAction.java @@ -0,0 +1,120 @@ +/* AccessibleAction.java -- aids in accessibly performing actions + Copyright (C) 2000, 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * If an object implements this interface then it must be able to perform one + * or more actions. Accessibility software can use the implementations of this + * interface to discover and perform actions on an object. + * + * <p>The <code>AccessibleContext.getAccessibleAction()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleAction() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleAction +{ + + /** + * The name of an action which decrements a value. + * + * @since 1.5 + */ + static final String DECREMENT = "decrement"; + + /** + * The name of an action which increments a value. + * + * @since 1.5 + */ + static final String INCREMENT = "increment"; + + /** + * The name of an action which toggles the expansion of a tree node. + * + * @since 1.5 + */ + static final String TOGGLE_EXPAND = "toggle expand"; + + /** + * The name of an action which causes a component to perform its default + * action. + * + * @since 1.6 + */ + static final String CLICK = "click"; + + /** + * The name of an action which toggles the state of a popup, causing a + * hidden popup to be displayed and a visible popup to be hidden. + * + * @since 1.6 + */ + static final String TOGGLE_POPUP = "toggle popup"; + + /** + * Get the number possible actions for this object, with the zeroth + * representing the default action. + * + * @return the 0-based number of actions + */ + int getAccessibleActionCount(); + + /** + * Get a description for the specified action. Returns null if out of + * bounds. + * + * @param i the action to describe, 0-based + * @return description of the action + */ + String getAccessibleActionDescription(int i); + + /** + * Perform the specified action. Does nothing if out of bounds. + * + * @param i the action to perform, 0-based + * @return true if the action was performed + */ + boolean doAccessibleAction(int i); +} // interface AccessibleAction diff --git a/libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java b/libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java new file mode 100644 index 000000000..de8edcb97 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleAttributeSequence.java @@ -0,0 +1,85 @@ +/* AccessibleAttributeSequence.java + Copyright (C) 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. */ + + +package javax.accessibility; + +import javax.swing.text.AttributeSet; + +/** + * This is a convenience class that wraps together a sequence + * of text with the attributes applied to it. This allows a single + * object to be used when + * {@link AccessibleContext#ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED} + * events are fired. + * + * @since 1.5 + */ +public class AccessibleAttributeSequence +{ + /** + * The attributes of the text. + */ + public AttributeSet attributes; + + /** + * The starting index. + */ + public int startIndex; + + /** + * The ending index. + */ + public int endIndex; + + /** + * Creates a new instance using the specified attributes + * and the supplied start and end indicies. + * + * @param start the index of the start of the text. + * @param end the index of the end of the text. + * @param attr the attributes applied to the text sequence. + * @since 1.6 + */ + public AccessibleAttributeSequence(int start, int end, AttributeSet attr) + { + startIndex = start; + endIndex = end; + attributes = attr; + } + +} diff --git a/libjava/classpath/javax/accessibility/AccessibleBundle.java b/libjava/classpath/javax/accessibility/AccessibleBundle.java new file mode 100644 index 000000000..7d78c021e --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleBundle.java @@ -0,0 +1,120 @@ +/* AccessibleBundle.java -- base class for accessibility "enumerations" + Copyright (C) 2002, 2005 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. */ + +package javax.accessibility; + +import java.util.Locale; + +/** + * This serves as a base class for accessibility "enumerations". These + * objects are strongly typed; to make up for the lack of true enums in Java. + * Display should be locale dependent. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see AccessibleRole + * @see AccessibleState + * @since 1.2 + * @status updated to 1.4, but missing Locale support + */ +public abstract class AccessibleBundle +{ + /** + * The locale independent name of the object. This is for the computer, not + * necessarily for humans; changing it in subclasses is frowned upon. + * + * @see #toDisplayString(String, Locale) + */ + protected String key; + + /** + * Default constructor. + */ + public AccessibleBundle() + { + } + + /** + * Obtains the key as a localized string, falling back to the + * locale-independent version if necessary. + * + * @param resourceBundle the resource to use for lookup + * @param locale the locale to translate to + * @return the translated name + * @throws NullPointerException if resourceBundle or locale is null + * @XXX For now, no transformation is done. + */ + protected String toDisplayString(String resourceBundle, Locale locale) + { + return key; + } + + /** + * Obtains the key as a localized string, falling back to the + * locale-independent version if necessary. + * + * @param locale the locale to translate to + * @return the translated name + * @throws NullPointerException if locale is null + * @XXX For now, no transformation is done. + */ + public String toDisplayString(Locale locale) + { + return key; + } + + /** + * Obtains the key as a localized string, using the default locale. + * + * @return the translated name + * @XXX For now, no transformation is done. + */ + public String toDisplayString() + { + return toDisplayString(Locale.getDefault()); + } + + /** + * Obtains the key as a localized string, using the default locale. + * + * @return the translated name + * @XXX For now, no transformation is done. + */ + public String toString() + { + return toDisplayString(Locale.getDefault()); + } +} // class AccessibleBundle diff --git a/libjava/classpath/javax/accessibility/AccessibleComponent.java b/libjava/classpath/javax/accessibility/AccessibleComponent.java new file mode 100644 index 000000000..4c612703f --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleComponent.java @@ -0,0 +1,321 @@ +/* AccessibleComponent.java -- aids in accessibly rendering Java components + Copyright (C) 2000, 2001, 2002, 2005 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. */ + +package javax.accessibility; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.FocusListener; + +/** + * Objects which are to be rendered to a screen as part of a graphical + * user interface should implement this interface. Accessibility + * software can use the implementations of this interface to determine + * and set the screen representation for an object. + * + * <p>The <code>AccessibleContext.getAccessibleComponent()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleComponent() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleComponent +{ + /** + * Get the background color of this component. + * + * @return the background color of this component, or null if not supported + * @see #setBackground(Color) + */ + Color getBackground(); + + /** + * Set the background color of this component to the specified color. + * + * @param color the color to set the background to + * @see #getBackground() + */ + void setBackground(Color color); + + /** + * Get the foreground color of this component. + * + * @return the foreground color of this component, or null if not supported + * @see #setForeground(Color) + */ + Color getForeground(); + + /** + * Set the foreground color of this component. + * + * @param color the color to set the foreground to + * @see #getForeground() + */ + void setForeground(Color color); + + /** + * Get the cursor of this component. + * + * @return the Cursor of this component, or null if not supported + * @see #setCursor(Cursor) + */ + Cursor getCursor(); + + /** + * Set the cursor of the component. + * + * @param cursor the graphical representation of the cursor to use + * @see #getCursor() + */ + void setCursor(Cursor cursor); + + /** + * Get the font of this component + * + * @return the font of the component, or null if not supported + * @see #setFont(Font) + */ + Font getFont(); + + /** + * Set the font of this component. + * + * @param font the font to use + * @see #getFont() + */ + void setFont(Font font); + + /** + * Get the <code>FontMetrics</code> of the specified font in this component. + * + * @param font the specified font + * @return the metrics for the specified font, or null if not supported + * @throws NullPointerException if font is null + * @see #getFont() + */ + FontMetrics getFontMetrics(Font font); + + /** + * Indicates whether or not this component is enabled. An object which is + * enabled also has AccessibleState.ENABLED in its StateSet. + * + * @return true if the component is enabled + * @see #setEnabled(boolean) + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#ENABLED + */ + boolean isEnabled(); + + /** + * Set this component to an enabled or disabled state. + * + * @param b true to enable the component, else disable it + * @see #isEnabled() + */ + void setEnabled(boolean b); + + /** + * Indicates whether or not this component is visible or intends to be + * visible although one of its ancestors may not be. An object which is + * visible also has AccessibleState.VISIBLE in its StateSet. Check + * <code>isShowing()</code> to see if the object is on screen. + * + * @return true if the component is visible + * @see #setVisible(boolean) + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#VISIBLE + */ + boolean isVisible(); + + /** + * Set the visible state of this component. + * + * @param b true to make the component visible, else hide it + * @see #isVisible() + */ + void setVisible(boolean b); + + /** + * Indicates whether or not this component is visible by checking + * the visibility of this component and its ancestors. The component may + * be hidden on screen by another component like pop-up help. An object + * which is showing on screen also has AccessibleState.SHOWING in its + * StateSet. + * + * @return true if component and ancestors are visible + * @see #isVisible() + * @see #setVisible(boolean) + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#SHOWING + */ + boolean isShowing(); + + /** + * Tests whether or not the specified point is contained within + * this component. The coordinates are specified relative to this + * component's coordinate system. + * + * @param point the Point to locate + * @return true if the point is within this component + * @throws NullPointerException if point is null + * @see #getBounds() + */ + boolean contains(Point point); + + /** + * Get the location of this component in the screen's coordinate space. + * The point specified is the top-left corner of this component. + * + * @return the location on screen, or null if off-screen + * @see #getBounds() + * @see #getLocation() + */ + Point getLocationOnScreen(); + + /** + * Get the location of this component in the parent's coordinate system. + * The point specified is the top-left corner of this component. + * + * @return the location in the parent on screen, or null if off-screen + * @see #getBounds() + * @see #getLocationOnScreen() + * @see #setLocation(Point) + */ + Point getLocation(); + + /** + * Set the location of this component relative to its parent. The point + * specified represents the top-left corner of this component. + * + * @param point the top-left corner of this component relative to the parent + * @throws NullPointerException if point is null + * @see #getLocation() + */ + void setLocation(Point point); + + /** + * Get the bounds of this component relative to its parent - it's width, + * height, and relative location to its parent. + * + * @return the bounds of this component, or null if not on screen + * @see #contains(Point) + */ + Rectangle getBounds(); + + /** + * Set the bounds of this component to the specified height and width, and + * relative location to its parent. + * + * @param rectangle the new height, width, and relative location + * @throws NullPointerException if rectangle is null + */ + void setBounds(Rectangle rectangle); + + /** + * Get the size of this component - it's width and height. + * + * @return the dimensions of this component, or null if not on screen + * @see #setSize(Dimension) + */ + Dimension getSize(); + + /** + * Set the size of this component to the given dimensions. + * + * @param dimension the new size of the component + * @throws NullPointerException if dimension is null + * @see #getSize() + */ + void setSize(Dimension dimension); + + /** + * If an object exists at the specified point which is a child of this + * parent component, and it is accessible, then it is returned. + * + * @param point the location within this component's coordinate system + * @return the accessible child object at that point, or null + */ + Accessible getAccessibleAt(Point point); + + /** + * Indicates whether or not this component can accept focus. An object + * which can accept focus also has AccessibleState.FOCUSABLE in its + * StateSet. + * + * @return true if the component can accept focus + * @see AccessibleContext#getAccessibleStateSet() + * @see AccessibleState#FOCUSABLE + * @see AccessibleState#FOCUSED + */ + boolean isFocusTraversable(); + + /** + * If this method is called this component will attempt to gain focus, + * but if it cannot accept focus nothing happens. On success, the StateSet + * will contain AccessibleState.FOCUSED + * + * @see #isFocusTraversable() + * @see AccessibleState#FOCUSED + */ + void requestFocus(); + + /** + * Adds the specified listener to this component. + * + * @param listener the listener to add to this component + * @see #removeFocusListener(FocusListener) + */ + void addFocusListener(FocusListener listener); + + /** + * Removes the specified listener from this component. + * + * @param listener the listener to remove + * @see #addFocusListener(FocusListener) + */ + void removeFocusListener(FocusListener listener); +} // interface AccessibleComponent diff --git a/libjava/classpath/javax/accessibility/AccessibleContext.java b/libjava/classpath/javax/accessibility/AccessibleContext.java new file mode 100644 index 000000000..ee3a5287b --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleContext.java @@ -0,0 +1,619 @@ +/* AccessibleContext.java -- the context of an accessible object + Copyright (C) 2002 Free Software Foundation + +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. */ + +package javax.accessibility; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.Locale; + +/** + * The minimum information that all accessible objects return. This includes + * name, description, role, and state of the object, parents and children, + * and any other useful information. If a component supports further details, + * it should implement one of the following:<ul> + * <li>{@link AccessibleAction} - the object can perform actions</li> + * <li>{@link AccessibleComponent} - the object has a graphical + * representation</li> + * <li>{@link AccessibleSelection} - the object allows its children to be + * selected</li> + * <li>{@link AccessibleText} - the object represents editable text</li> + * <li>{@link AccessibleValue} - the object represents a numerical value</li> + * </ul> + * + * @author Eric Blake (ebb9@email.byu.edu) + * @since 1.2 + * @status updated to 1.4 + */ +public abstract class AccessibleContext +{ + /** + * Constant used when the accessible name has changed. Both the old and new + * values are listed in the event. + * + * @see #getAccessibleName() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_NAME_PROPERTY + = "AccessibleName"; + + /** + * Constant used when the accessible description has changed. Both the old + * and new values are listed in the event. + * + * @see #getAccessibleDescription() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_DESCRIPTION_PROPERTY + = "AccessibleDescription"; + + /** + * Constant used when the accessibleStateSet has changed. Both the old and + * new values are listed in the event, although either may be null if a + * state was disabled at that time. + * + * @see #getAccessibleStateSet() + * @see AccessibleState + * @see AccessibleStateSet + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_STATE_PROPERTY + = "AccessibleState"; + + /** + * Constant used when the accessibleValue has changed. Both the old and new + * values are listed in the event. + * + * @see #getAccessibleValue() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_VALUE_PROPERTY + = "AccessibleValue"; + + /** + * Constant used when the accessibleSelection has changed. Both the old and + * new values of the event are reserved for future use. + * + * @see #getAccessibleSelection() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_SELECTION_PROPERTY + = "AccessibleSelection"; + + /** + * Constant used when the accessibleText has changed. Both the old and new + * values of the event are reserved for future use. + * + * @see #getAccessibleText() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_TEXT_PROPERTY + = "AccessibleText"; + + /** + * Constant used when the accessibleText caret has changed. Both the old and + * new values are listed in the event. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_CARET_PROPERTY + = "AccessibleCaret"; + + /** + * Constant used when the visible data has changed. Both the old and new + * values of the event are reserved for future use. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_VISIBLE_DATA_PROPERTY + = "AccessibleVisibleData"; + + /** + * Constant used when children are added or removed. On addition, the new + * value of the event holds the new child; on removal, the old value holds + * the removed child. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_CHILD_PROPERTY + = "AccessibleChild"; + + /** + * Constant used when active descendent of a component has changed. Both + * the old and new values are listed in the event. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public static final String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY + = "AccessibleActiveDescendant"; + + /** + * Constant used when the accessible table caption has changed. Both the + * old and new values are listed in the event. + * + * @see Accessible + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_CAPTION_CHANGED + = "accessibleTableCaptionChanged"; + + /** + * Constant used when the accessible table summary has changed. Both the + * old and new values are listed in the event. + * + * @see Accessible + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_SUMMARY_CHANGED + = "accessibleTableSummaryChanged"; + + /** + * Constant used when the accessible table model has changed. Only the new + * value of the event has meaning. + * + * @see AccessibleTable + * @see AccessibleTableModelChange + */ + public static final String ACCESSIBLE_TABLE_MODEL_CHANGED + = "accessibleTableModelChanged"; + + /** + * Constant used when the accessible table row header has changed. Only the + * new value of the event has meaning. + * + * @see AccessibleTable + * @see AccessibleTableModelChange + */ + public static final String ACCESSIBLE_TABLE_ROW_HEADER_CHANGED + = "accessibleTableRowHeaderChanged"; + + /** + * Constant used when the accessible table row description has changed. Only + * the new value of the event has meaning. + * + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED + = "accessibleTableRowDescriptionChanged"; + + /** + * Constant used when the accessible table column header has changed. Only + * the new value of the event has meaning. + * + * @see AccessibleTable + * @see AccessibleTableModelChange + */ + public static final String ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED + = "accessibleTableColumnHeaderChanged"; + + /** + * Constant used when the accessible table column description has changed. + * Only the new value of the event has meaning. + * + * @see AccessibleTable + */ + public static final String ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED + = "accessibleTableColumnDescriptionChanged"; + + /** + * Constant used when supported set of actions has changed. Both the old + * and new values are listed in the event. + * + * @see AccessibleAction + */ + public static final String ACCESSIBLE_ACTION_PROPERTY + = "accessibleActionProperty"; + + /** + * Constant used when a hypertext element received focus. Both the old + * and new values are listed in the event, with -1 indicating that no link + * had focus. + * + * @see AccessibleHyperlink + */ + public static final String ACCESSIBLE_HYPERTEXT_OFFSET + = "AccessibleHypertextOffset"; + + /** + * Constant used when a component's bounds have changed. The old and + * new bounds are given in the event. + * @since 1.5 + */ + public static final String ACCESSIBLE_COMPONENT_BOUNDS_CHANGED + = "accessibleComponentBoundsChanged"; + + /** + * Constant used when the state of child objects changes. The old + * value in the event is always null, and the new value is the component + * whose children have changed. + * @since 1.5 + */ + public static final String ACCESSIBLE_INVALIDATE_CHILDREN + = "accessibleInvalidateChildren"; + + /** + * Constant used when the attributes of some text have changed. + * On insertion, the old value is null and the new value is an + * {@link AccessibleAttributeSequence} describing the insertion. + * On deletion, the old value is an {@link AccessibleAttributeSequence} + * and the new value is null. For replacement, both the old + * and new values are {@link AccessibleAttributeSequence} objects. + * @since 1.5 + */ + public static final String ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED + = "accessibleTextAttributesChanged"; + + /** + * The accessible parent of this object. + * + * @see #getAccessibleParent() + * @see #setAccessibleParent(Accessible) + */ + protected Accessible accessibleParent; + + /** + * A localized string naming this object. + * + * @see #getAccessibleName() + * @see #setAccessibleName(String) + */ + protected String accessibleName; + + /** + * A localized string describing this object. + * + * @see #getAccessibleDescription() + * @see #setAccessibleDescription(String) + */ + protected String accessibleDescription; + + /** + * The listener tool. + * + * @see #addPropertyChangeListener(PropertyChangeListener) + * @see #removePropertyChangeListener(PropertyChangeListener) + * @see #firePropertyChange(String, Object, Object) + */ + private final PropertyChangeSupport listeners + = new PropertyChangeSupport(this); + + /** + * Default constructor. + */ + public AccessibleContext() + { + } + + /** + * Get the localized name of the object. For example, a label may just + * return the text of the label, while an entry field for city may return + * "city" in en_US. + * + * @return the accessible object's name, or null if it is unnamed + * @see #setAccessibleName(String) + */ + public String getAccessibleName() + { + return accessibleName; + } + + /** + * Set the localized name of the object. This will fire a + * PropertyChangeEvent with ACCESSIBLE_NAME_PROPERTY. + * + * @param s the new name + * @see #getAccessibleName() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public void setAccessibleName(String s) + { + listeners.firePropertyChange(ACCESSIBLE_NAME_PROPERTY, accessibleName, s); + accessibleName = s; + } + + /** + * Get the localized description of the object. For example, a 'Cancel' + * button may be described as "Ignore changes and close dialog box" in + * en_US. + * + * @return the accessible object's description, or null if there is none + * @see #setAccessibleDescription(String) + */ + public String getAccessibleDescription() + { + return accessibleDescription; + } + + /** + * Set the localized name of the object. This will fire a + * PropertyChangeEvent with ACCESSIBLE_DESCRIPTION_PROPERTY. + * + * @param s the new description + * @see #getAccessibleDescription() + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public void setAccessibleDescription(String s) + { + listeners.firePropertyChange(ACCESSIBLE_DESCRIPTION_PROPERTY, + accessibleDescription, s); + accessibleDescription = s; + } + + /** + * Gets the role of this object. For example, a button serves the role of + * AccessibleRole.PUSH_BUTTON. This allows assistive technologies to funnel + * similar objects into the same assistance classes. Note that the class + * is extensible, to define new roles if necessary. + * + * @return the role of the object + * @see AccessibleRole + */ + public abstract AccessibleRole getAccessibleRole(); + + /** + * Gets the state set of this object. A change in the state of the object + * will fire a PropertyChangeEvent for ACCESSIBLE_STATE_PROPERTY. + * + * @return the current state of the object + * @see AccessibleState + * @see AccessibleStateSet + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public abstract AccessibleStateSet getAccessibleStateSet(); + + /** + * Return the accessible parent of this object. + * + * @return the accessible parent, or null if there is none + */ + public Accessible getAccessibleParent() + { + return accessibleParent; + } + + /** + * Sets the accessible parent of this object. This should only be used when + * the current parent object should not be the accessible parent; only the + * parent of the accessible child should call this method. + * + * @param a the new parent + */ + public void setAccessibleParent(Accessible a) + { + accessibleParent = a; + } + + /** + * Gets the index of this object within its accessible parent. + * + * @return the 0-based index, or -1 if there is no accessible parent + * @see #getAccessibleParent() + * @see #getAccessibleChildrenCount() + * @see #getAccessibleChild(int) + */ + public abstract int getAccessibleIndexInParent(); + + /** + * Returns the number of accessible children of this object. + * + * @return the number of accessible children + * @see #getAccessibleChild(int) + */ + public abstract int getAccessibleChildrenCount(); + + /** + * Returns the specified accessible chile. + * + * @param i the 0-based index to get + * @return the child, or null if out of bounds + * @see #getAccessibleChildrenCount() + */ + public abstract Accessible getAccessibleChild(int i); + + /** + * Gets the component locale, deferring to the parent if one is not declared. + * + * @return the locale + * @throws java.awt.IllegalComponentStateException if there is no locale + * or parent + */ + public abstract Locale getLocale(); + + /** + * Add a PropertyChangeListener to the listener list. This listener will + * be notified of all property changes to the accessible object. + * + * @param l the listener to add + * @see #ACCESSIBLE_NAME_PROPERTY + * @see #ACCESSIBLE_DESCRIPTION_PROPERTY + * @see #ACCESSIBLE_STATE_PROPERTY + * @see #ACCESSIBLE_VALUE_PROPERTY + * @see #ACCESSIBLE_SELECTION_PROPERTY + * @see #ACCESSIBLE_TEXT_PROPERTY + * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY + * @see #removePropertyChangeListener(PropertyChangeListener) + */ + public void addPropertyChangeListener(PropertyChangeListener l) + { + listeners.addPropertyChangeListener(l); + } + + /** + * Remove a PropertyChangeListener from the listener list. + * + * @param l the listener to remove + * @see #addPropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener(PropertyChangeListener l) + { + listeners.removePropertyChangeListener(l); + } + + /** + * Get any supported accessible actions. The default implementation returns + * null. + * + * @return the supported action, or null + * @see AccessibleAction + */ + public AccessibleAction getAccessibleAction() + { + return null; + } + + /** + * Get any supported accessible component. The default implementation returns + * null. + * + * @return the supported component, or null + * @see AccessibleComponent + */ + public AccessibleComponent getAccessibleComponent() + { + return null; + } + + /** + * Get any supported accessible selection. The default implementation returns + * null. + * + * @return the supported selection, or null + * @see AccessibleSelection + */ + public AccessibleSelection getAccessibleSelection() + { + return null; + } + + /** + * Get any supported accessible text. The default implementation returns + * null. + * + * @return the supported text, or null + * @see AccessibleText + */ + public AccessibleText getAccessibleText() + { + return null; + } + + /** + * Get any supported accessible editable text. The default implementation + * returns null. + * + * @return the supported editable text, or null + * @see AccessibleEditableText + */ + public AccessibleEditableText getAccessibleEditableText() + { + return null; + } + + /** + * Get any supported accessible value. The default implementation returns + * null. + * + * @return the supported value, or null + * @see AccessibleValue + */ + public AccessibleValue getAccessibleValue() + { + return null; + } + + /** + * Get all supported accessible icons. The default implementation returns + * null. + * + * @return the supported icons, or null + * @see AccessibleIcon + */ + public AccessibleIcon[] getAccessibleIcon() + { + return null; + } + + /** + * Get any supported accessible relation set. The default implementation + * returns an empty AccessibleRelationSet. + * + * @return the supported relation set, or <code>null</code> + * + * @see AccessibleRelationSet + */ + public AccessibleRelationSet getAccessibleRelationSet() + { + return new AccessibleRelationSet(); + } + + /** + * Get any supported accessible table. The default implementation returns + * null. + * + * @return the supported table, or null + * @see AccessibleTable + */ + public AccessibleTable getAccessibleTable() + { + return null; + } + + /** + * Fire an event to report property changes. This is intended for use by + * the accessible objects, not general application programs. If oldValue and + * newValue differ, and the listenter list is not empty, a PropertyChange + * event is fired to each listener. + * + * @param name the property name + * @param oldValue the prior value + * @param newValue the updated value + * @see PropertyChangeSupport + * @see #addPropertyChangeListener(PropertyChangeListener) + * @see #removePropertyChangeListener(PropertyChangeListener) + * @see #ACCESSIBLE_NAME_PROPERTY + * @see #ACCESSIBLE_DESCRIPTION_PROPERTY + * @see #ACCESSIBLE_STATE_PROPERTY + * @see #ACCESSIBLE_VALUE_PROPERTY + * @see #ACCESSIBLE_SELECTION_PROPERTY + * @see #ACCESSIBLE_TEXT_PROPERTY + * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY + */ + public void firePropertyChange(String name, Object oldValue, Object newValue) + { + listeners.firePropertyChange(name, oldValue, newValue); + } +} // class AccessibleContext diff --git a/libjava/classpath/javax/accessibility/AccessibleEditableText.java b/libjava/classpath/javax/accessibility/AccessibleEditableText.java new file mode 100644 index 000000000..308016a39 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleEditableText.java @@ -0,0 +1,142 @@ +/* AccessibleEditableText.java -- aids in accessibly for editable text + Copyright (C) 2002, 2005 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. */ + +package javax.accessibility; + +import javax.swing.text.AttributeSet; + +/** + * Objects which present editable textual information on the display should + * implement this interface. Accessibility software can use the + * implementations of this interface to change the content, attributes, + * and spacial location of the text. + * + * <p>The <code>AccessibleContext.getAccessibleEditableText()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleText() + * @see AccessibleContext#getAccessibleEditableText() + * @since 1.2 + * @status updated to 1.4, except for javax.swing support + */ +public interface AccessibleEditableText extends AccessibleText +{ + /** + * Set the text contents to the given string. + * + * @param s the new text + */ + // XXX What happens if s is null? + void setTextContents(String s); + + /** + * Inserts the given string at the specified location. + * + * @param index the index for insertion + * @param s the new text + */ + // XXX What happens if index is out of bounds, or s is null? + void insertTextAtIndex(int index, String s); + + /** + * Return the text between two points. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + String getTextRange(int start, int end); + + /** + * Delete the text between two points. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + void delete(int start, int end); + + /** + * Cut the text between two points to the system clipboard. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + void cut(int start, int end); + + /** + * Paste the text from the system clipboard at the given index. + * + * @param start the start position + */ + // XXX What happens if start is out of bounds? + void paste(int start); + + /** + * Replace the text between two points with the given string. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + * @param s the string to paste + */ + // XXX What happens if indices are out of bounds, or s is null? + void replaceText(int start, int end, String s); + + /** + * Select the text between two points. + * + * @param start the start position, inclusive + * @param stop the end position, exclusive + */ + // XXX What happens if indices are out of bounds? + void selectText(int start, int stop); + + /** + * Set the attributes of text between two points. + * + * @param start the start position, inclusive + * @param end the end position, exclusive + * @param s the new attribute set for the range + */ + // XXX What happens if indices are out of bounds, or s is null? + void setAttributes(int start, int end, AttributeSet s); +} // interface AccessibleEditableText diff --git a/libjava/classpath/javax/accessibility/AccessibleExtendedComponent.java b/libjava/classpath/javax/accessibility/AccessibleExtendedComponent.java new file mode 100644 index 000000000..5b751f6eb --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleExtendedComponent.java @@ -0,0 +1,78 @@ +/* AccessibleExtendedComponent.java -- aids in extended component access + Copyright (C) 2002, 2005 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. */ + +package javax.accessibility; + +/** + * Objects which present graphical components with extensions such as key + * bindings or tool-tips should implement this interface. Accessibility + * software can use the implementations of this interface to display the + * extended information of the component. + * + * <p>The <code>AccessibleContext.getAccessibleComponent()</code> method + * should return an instance of this interface only when it is supported. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleComponent() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleExtendedComponent extends AccessibleComponent +{ + /** + * Returns the tool-tip text for this component. + * + * @return the tool-tip, or null if not supported + */ + String getToolTipText(); + + /** + * Returns the title border text for this component. + * + * @return the titled border text, or null if not supported + */ + String getTitledBorderText(); + + /** + * Returns the accessible key bindings for this component. + * + * @return the key bindings, or null if not supported + */ + AccessibleKeyBinding getAccessibleKeyBinding(); +} // interface AccessibleExtendedComponent diff --git a/libjava/classpath/javax/accessibility/AccessibleExtendedTable.java b/libjava/classpath/javax/accessibility/AccessibleExtendedTable.java new file mode 100644 index 000000000..999c1f0b5 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleExtendedTable.java @@ -0,0 +1,81 @@ +/* AccessibleExtendedTable.java -- aids in extended table access + Copyright (C) 2002, 2005 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. */ + +package javax.accessibility; + +/** + * Objects which present 2-D tables with the extension of a flat address + * space should implement this interface. Accessibility software can use the + * implementations of this interface to better manipulate the table. + * + * <p>The <code>AccessibleContext.getAccessibleTable()</code> method + * should return an instance of this interface only when it is supported. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleTable() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleExtendedTable extends AccessibleTable +{ + /** + * Returns the row number of an index in the table. + * + * @param index the cell index, in row-major form from (0,0) + * @return the row number, or -1 if out of bounds + */ + int getAccessibleRow(int index); + + /** + * Returns the column number of an index in the table. + * + * @param index the cell index, in row-major form from (0,0) + * @return the column number, or -1 if out of bounds + */ + int getAccessibleColumn(int index); + + /** + * Returns the cell number for a row-major address from (0,0). + * + * @param r the row + * @param c the column + * @return the cell index + */ + int getAccessibleIndex(int r, int c); +} // interface AccessibleExtendedTable diff --git a/libjava/classpath/javax/accessibility/AccessibleExtendedText.java b/libjava/classpath/javax/accessibility/AccessibleExtendedText.java new file mode 100644 index 000000000..026cd3a7d --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleExtendedText.java @@ -0,0 +1,108 @@ +/* AccessibleExtendedText.java + Copyright (C) 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. */ + + +package javax.accessibility; + +import java.awt.Rectangle; + +/** + * This interface provides extended text functionality, similar + * to AccessibleText. + * @see AccessibleText + * @since 1.5 + */ +public interface AccessibleExtendedText +{ + /** + * This constant indicates that the retrieved text should be a + * complete line. + */ + int LINE = 4; + + /** + * This constant indicates that the retrieved text should consist + * of a run with identical attributes. + */ + int ATTRIBUTE_RUN = 5; + + /** + * Determines the bounding box of some text held by this object. + * @param start the starting index + * @param end the ending index + * @return the bounding box + * @see AccessibleText#getCharacterBounds(int) + */ + Rectangle getTextBounds(int start, int end); + + /** + * Return a range of text from the underlying object. + * @param start the starting index + * @param end the ending index + */ + String getTextRange(int start, int end); + + /** + * Return a text sequence from the underlying object. The part + * parameter describes the type of sequence to return; it is one + * of the constants from {@link AccessibleText} or from this + * class. + * @param part the type of the sequence to return + * @param index start of the sequence + */ + AccessibleTextSequence getTextSequenceAfter(int part, int index); + + /** + * Return a text sequence from the underlying object. The part + * parameter describes the type of sequence to return; it is one + * of the constants from {@link AccessibleText} or from this + * class. + * @param part the type of the sequence to return + * @param index start of the sequence + */ + AccessibleTextSequence getTextSequenceAt(int part, int index); + + /** + * Return a text sequence from the underlying object. The part + * parameter describes the type of sequence to return; it is one + * of the constants from {@link AccessibleText} or from this + * class. + * @param part the type of the sequence to return + * @param index end of the sequence + */ + AccessibleTextSequence getTextSequenceBefore(int part, int index); +} diff --git a/libjava/classpath/javax/accessibility/AccessibleHyperlink.java b/libjava/classpath/javax/accessibility/AccessibleHyperlink.java new file mode 100644 index 000000000..aec1f2a9c --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleHyperlink.java @@ -0,0 +1,139 @@ +/* AccessibleHyperlink.java -- aids in accessibly navigating hypertext + Copyright (C) 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * This object encapsulates actions associated with navigating hypertext. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleText + * @see AccessibleContext#getAccessibleText() + * @since 1.2 + * @status updated to 1.4 + */ +public abstract class AccessibleHyperlink implements AccessibleAction +{ + /** + * The default constructor. + */ + public AccessibleHyperlink() + { + } + + /** + * Returns whether the document the link references is still valid, as the + * association may have changed with a text edit. + * + * @return true if the link is valid with respect to the AccessibleHypertext + */ + public abstract boolean isValid(); + + /** + * Get the number possible actions for this object, starting from 0. In + * general, a hypertext link has only one action, except for an image map, + * so there isn't really a default action. + * + * @return the 0-based number of actions + */ + public abstract int getAccessibleActionCount(); + + /** + * Perform the specified action. Does nothing if out of bounds. + * + * @param i the action to perform, 0-based + * @return true if the action was performed + * @see #getAccessibleActionCount() + */ + public abstract boolean doAccessibleAction(int i); + + /** + * Get the anchor text of the link, or null if the index is out of bounds. + * For example, <a href="http://www.gnu.org/">GNU Home Page</a> + * would return "GNU Home Page", while <a HREF="#top"> + * <img src="top-hat.png" alt="top hat"></a> would return + * "top hat". + * + * @param i the link to retrieve, 0-based + * @return the link anchor text + * @see #getAccessibleActionCount() + */ + public abstract String getAccessibleActionDescription(int i); + + /** + * Get the link location, or null if the index is out of bounds. For + * example, <a href="http://www.gnu.org/">GNU Home Page</a> + * would return a java.net.URL("http://www.gnu.org/"). + * + * @param i the link to retrieve, 0-based + * @return the link location + * @see #getAccessibleActionCount() + */ + public abstract Object getAccessibleActionObject(int i); + + /** + * Get the anchor appropriate for the link, or null if the index is out of + * bounds. For example, <a href="http://www.gnu.org/">GNU Home Page + * </a> would return "GNU Home Page", while <a HREF="#top"> + * <img src="top-hat.png" alt="top hat"></a> would return + * an ImageIcon("top-hat.png", "top hat"). + * + * @param i the link to retrieve, 0-based + * @return the link anchor object + * @see #getAccessibleActionCount() + */ + public abstract Object getAccessibleActionAnchor(int i); + + /** + * Gets the character index where this link starts in the parent hypertext + * document. + * + * @return the starting index + */ + public abstract int getStartIndex(); + + /** + * Gets the character index where this link ends in the parent hypertext + * document. + * + * @return the ending index + */ + public abstract int getEndIndex(); +} // class AccessibleAction diff --git a/libjava/classpath/javax/accessibility/AccessibleHypertext.java b/libjava/classpath/javax/accessibility/AccessibleHypertext.java new file mode 100644 index 000000000..c70357272 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleHypertext.java @@ -0,0 +1,84 @@ +/* AccessibleHypertext.java -- aids in accessibly rendering hypertext + Copyright (C) 2000, 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * Objects which present hyperlinks in a document should implement this + * interface. Accessibility software can use the implementations of this + * interface to aid the user in navigating the links. + * + * <p>The <code>AccessibleContext.getAccessibleText()</code> method + * should return an instance of this interface only when it is supported. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleText + * @see AccessibleContext#getAccessibleText() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleHypertext extends AccessibleText +{ + /** + * Returns the number of links in the document, if any exist. + * + * @return the number of links, or -1 + */ + int getLinkCount(); + + /** + * Returns link object denoted by the number <code>i</code> in this + * document, or null if i is out of bounds. + * + * @param i the ith hyperlink of the document + * @return link object denoted by <code>i</code> + */ + AccessibleHyperlink getLink(int i); + + /** + * Returns the link index for this character index if it resides within + * one of the hyperlinks of the document. If no association exists at that + * character, or c is out of bounds, returns -1. + * + * @param c the character index + * @return the link index, or -1 + */ + int getLinkIndex(int c); +} // interface AccessibleHypertext diff --git a/libjava/classpath/javax/accessibility/AccessibleIcon.java b/libjava/classpath/javax/accessibility/AccessibleIcon.java new file mode 100644 index 000000000..22786e5f3 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleIcon.java @@ -0,0 +1,85 @@ +/* AccessibleIcon.java -- aids in accessibly rendering icons + Copyright (C) 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * Objects which have an associated icon, such as buttons, should implement + * this interface. Accessibility software can use the implementations of this + * interface to aid the user in navigating the links. + * + * <p>The <code>AccessibleContext.getAccessibleIcon()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleIcon() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleIcon +{ + /** + * Returns a textual description of the icon and its purpose. + * + * @return the description, or null if there is none + */ + String getAccessibleIconDescription(); + + /** + * Modify the textual description of the icon and its purpose. + * + * @param s the new descrption string + */ + void setAccessibleIconDescription(String s); + + /** + * Get the icon width. + * + * @return the width + */ + int getAccessibleIconWidth(); + + /** + * Get the icon height. + * + * @return the height + */ + int getAccessibleIconHeight(); +} // interface AccessibleIcon diff --git a/libjava/classpath/javax/accessibility/AccessibleKeyBinding.java b/libjava/classpath/javax/accessibility/AccessibleKeyBinding.java new file mode 100644 index 000000000..b3a3ac453 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleKeyBinding.java @@ -0,0 +1,78 @@ +/* AccessibleKeyBinding.java -- aids in using keyboard navigation + Copyright (C) 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * Objects which have keyboard bindings for mneumonics or shortcuts should + * implement this interface. Accessibility software can use the + * implementations of this interface to aid the user in using the key + * bindings. + * + * <p>The <code>AccessibleContext.getAccessibleKeyBinding()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleKeyBinding() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleKeyBinding +{ + /** + * Returns the count of key bindings for this object. + * + * @return the 0-based count, or -1 if there are none + */ + int getAccessibleKeyBindingCount(); + + /** + * Return the numbered key binding, which can then be cast in an + * implementation dependent way to the appropriate object type. For example, + * swing uses <code>javax.swing.KeyStroke</code>. This returns null if i + * is out of bounds. + * + * @param i the 0-based index of key bindings + * @return the key binding + * @see #getAccessibleKeyBindingCount() + */ + Object getAccessibleKeyBinding(int i); +} // interface AccessibleKeyBinding diff --git a/libjava/classpath/javax/accessibility/AccessibleRelation.java b/libjava/classpath/javax/accessibility/AccessibleRelation.java new file mode 100644 index 000000000..9e1b0da37 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleRelation.java @@ -0,0 +1,318 @@ +/* AccessibleRelation.java -- the relation between accessible objects + Copyright (C) 2002, 2005 Free Software Foundation + +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. */ + +package javax.accessibility; + +import java.util.Locale; + +/** + * The relation between one accessible object and one or more other objects. + * For example, a button may control an action. An AccessibleRelationSet + * summarizes all relations of the object. This strongly typed "enumeration" + * supports localized strings. If the constants of this class are not + * adequate, new ones may be added in a similar matter. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleRelation extends AccessibleBundle +{ + /** + * Indicates the object labels other objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public static final String LABEL_FOR; + + /** + * Indicates the object is labeled by other objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #MEMBER_OF + */ + public static final String LABELED_BY; + + /** + * Indicates an object is a member of a group of target objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #LABELED_BY + */ + public static final String MEMBER_OF; + + /** + * Indicates an object is a controller for other objects. + * + * @see #getTarget() + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public static final String CONTROLLER_FOR; + + /** + * Indicates an object is controlled by other objects. + * + * @see #getTarget() + * @see #CONTROLLER_FOR + * @see #LABEL_FOR + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public static final String CONTROLLED_BY; + + /** Indicates that the label target group has changed. */ + public static final String LABEL_FOR_PROPERTY = "labelForProperty"; + + /** Indicates that the labelling objects have changed. */ + public static final String LABELED_BY_PROPERTY = "labeledByProperty"; + + /** Indicates that group membership has changed. */ + public static final String MEMBER_OF_PROPERTY = "memberOfProperty"; + + /** Indicates that the controller target group has changed. */ + public static final String CONTROLLER_FOR_PROPERTY = "controllerForProperty"; + + /** Indicates that the controlling objects have changed. */ + public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty"; + + /** + * Indicates that an object is a child of another object. + * @since 1.5 + */ + public static final String CHILD_NODE_OF = "childNodeOf"; + + /** + * Indicates that the ancestry relationship has changed. + * @since 1.5 + */ + public static final String CHILD_NODE_OF_PROPERTY = "childNodeOfProperty"; + + /** + * Indicates that an object is embedded by another object. + * @since 1.5 + */ + public static final String EMBEDDED_BY = "embeddedBy"; + + /** + * Indicates that the {@link #EMBEDDED_BY} property changed. + * @since 1.5 + */ + public static final String EMBEDDED_BY_PROPERTY = "embeddedByProperty"; + + /** + * Indicates that an object embeds another object. + * @since 1.5 + */ + public static final String EMBEDS = "embeds"; + + /** + * Indicates that the {@link #EMBEDS} property changed. + * @since 1.5 + */ + public static final String EMBEDS_PROPERTY = "embedsProperty"; + + /** + * Indicates that one object directly follows another object, + * as in a paragraph flow. + * @since 1.5 + */ + public static final String FLOWS_FROM = "flowsFrom"; + + /** + * Indicates that the {@link #FLOWS_FROM} property changed. + * @since 1.5 + */ + public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty"; + + /** + * Indicates that one object comes directly before another object, + * as in a paragraph flow. + * @since 1.5 + */ + public static final String FLOWS_TO = "flowsTo"; + + /** + * Indicates that the {@link #FLOWS_TO} property changed. + * @since 1.5 + */ + public static final String FLOWS_TO_PROPERTY = "flowsToProperty"; + + /** + * Indicates that one object is a parent window of another object. + * @since 1.5 + */ + public static final String PARENT_WINDOW_OF = "parentWindowOf"; + + /** + * Indicates that the {@link #PARENT_WINDOW_OF} property changed. + * @since 1.5 + */ + public static final String PARENT_WINDOW_OF_PROPERTY = "parentWindowOfProperty"; + + /** + * Indicates that one object is a subwindow of another object. + * @since 1.5 + */ + public static final String SUBWINDOW_OF = "subwindowOf"; + + /** + * Indicates that the {@link #SUBWINDOW_OF} property changed. + * @since 1.5 + */ + public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty"; + + /** An empty set of targets. */ + private static final Object[] EMPTY_TARGETS = { }; + + static + { + // not constants in JDK + LABEL_FOR = "labelFor"; + LABELED_BY = "labeledBy"; + MEMBER_OF = "memberOf"; + CONTROLLER_FOR = "controllerFor"; + CONTROLLED_BY = "controlledBy"; + } + + /** + * The related objects. + * + * @see #getTarget() + * @see #setTarget(Object) + * @see #setTarget(Object[]) + */ + Object[] targets; + + /** + * Create a new relation with a locale independent key, and no related + * objects. + * + * @param key the name of the role + * @see #toDisplayString(String, Locale) + */ + public AccessibleRelation(String key) + { + this.key = key; + targets = EMPTY_TARGETS; + } + + /** + * Create a new relation with a locale independent key, and a single related + * object. + * + * @param key the name of the role + * @param target the related object + * @see #toDisplayString(String, Locale) + */ + public AccessibleRelation(String key, Object target) + { + this.key = key; + targets = new Object[] { target }; + } + + /** + * Create a new relation with a locale independent key, and the given + * related objects. + * + * @param key the name of the role + * @param targets the related objects + * @see #toDisplayString(String, Locale) + */ + public AccessibleRelation(String key, Object[] targets) + { + this.key = key; + this.targets = targets == null ? EMPTY_TARGETS : targets; + } + + /** + * Return the key for this relation. + * + * @return the key + * @see #CONTROLLER_FOR + * @see #CONTROLLED_BY + * @see #LABEL_FOR + * @see #LABELED_BY + * @see #MEMBER_OF + */ + public String getKey() + { + return key; + } + + /** + * Return the targets of this relation. + * + * @return the targets, may be empty, but never null + */ + public Object[] getTarget() + { + return targets; + } + + /** + * Set the target to a single object. + * + * @param target the new target + */ + public void setTarget(Object target) + { + targets = new Object[] { target }; + } + + /** + * Set the target to an array of objects. + * + * @param targets the new targets + */ + public void setTarget(Object[] targets) + { + this.targets = targets == null ? EMPTY_TARGETS : targets; + } +} // class AccessibleRelation diff --git a/libjava/classpath/javax/accessibility/AccessibleRelationSet.java b/libjava/classpath/javax/accessibility/AccessibleRelationSet.java new file mode 100644 index 000000000..0770fdbeb --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleRelationSet.java @@ -0,0 +1,226 @@ +/* AccessibleRelationSet.java -- the combined relations of an accessible object + Copyright (C) 2002, 2005 Free Software Foundation + +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. */ + +package javax.accessibility; + +import gnu.java.lang.CPStringBuilder; + +import java.util.Locale; +import java.util.Vector; + +/** + * Describes all relations of an accessible object. For example, an object + * by labeled by one object and control another. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see AccessibleRelation + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleRelationSet +{ + /** + * The list of relations, should be instances of AccessibleRelation. Don't + * set this to null. + * + * @see #add(AccessibleRelation) + * @see #addAll(AccessibleRelation[]) + * @see #remove(AccessibleRelation) + * @see #contains(String) + * @see #get(String) + * @see #size() + * @see #toArray() + * @see #clear() + */ + protected Vector<AccessibleRelation> relations + = new Vector<AccessibleRelation>(); + + /** + * Create an empty relation set. + */ + public AccessibleRelationSet() + { + } + + /** + * Create a relation set initialized with the given relations, duplicates are + * ignored. + * + * @param relations the relations to insert + * @throws NullPointerException if relations is null + */ + public AccessibleRelationSet(AccessibleRelation[] relations) + { + addAll(relations); + } + + /** + * Add a new relation to the current set. If the relation is already in + * the set, the targets are merged with the existing relation, possibly + * resulting in an object being in the target list more than once. Do not + * add a relation with a null key, as it will cause problems later. + * + * @param relation the relation to add + * @return true if the set was modified, which is always the case + * @throws NullPointerException if relation is null + */ + public boolean add(AccessibleRelation relation) + { + AccessibleRelation old = get(relation.key); + if (old == null) + return relations.add(relation); + if (old.targets.length == 0) + old.targets = relation.targets; + else if (relation.targets.length != 0) + { + Object[] t = new Object[old.targets.length + relation.targets.length]; + System.arraycopy(old.targets, 0, t, 0, old.targets.length); + System.arraycopy(relation.targets, 0, t, old.targets.length, + relation.targets.length); + old.targets = t; + } + return true; + } + + /** + * Add all of the relations to the current set. Duplicates are ignored. + * + * @param array the array of relations to add + * @throws NullPointerException if array is null or has null entries + */ + public void addAll(AccessibleRelation[] array) + { + int i = array.length; + while (--i >= 0) + add(array[i]); + } + + /** + * Remove a relation from the set. If a relation was removed, return true. + * Note that this uses AccessibleRelation.equals, which defaults to ==, so a + * relation with the same key may still exist in the set afterwords. + * + * @param relation the state to remove + * @return true if the set changed + */ + public boolean remove(AccessibleRelation relation) + { + return relations.remove(relation); + } + + /** + * Clear all relations in the set. + */ + public void clear() + { + relations.clear(); + } + + /** + * Return the number of relations in the set. + * + * @return the set size + */ + public int size() + { + return relations.size(); + } + + /** + * Check if the relation key is in the set. + * + * @param key the relation to locate + * @return true if it is in the set + */ + public boolean contains(String key) + { + int i = relations.size(); + while (--i >= 0) + if ((relations.get(i)).key.equals(key)) + return true; + return false; + } + + /** + * Get the relation that matches the key. + * + * @param key the relation to locate + * @return the relation in the set, or null + */ + public AccessibleRelation get(String key) + { + int i = relations.size(); + while (--i >= 0) + { + AccessibleRelation r = relations.get(i); + if (r.key.equals(key)) + return r; + } + return null; + } + + /** + * Return the relation set as an array. + * + * @return an array of the current relations + */ + public AccessibleRelation[] toArray() + { + AccessibleRelation[] result = new AccessibleRelation[relations.size()]; + relations.toArray(result); + return result; + } + + /** + * Return a localized, comma-separated string representing all relations + * in the set. This is in arbitrary order. + * + * @return the string representation + * @see AccessibleBundle#toDisplayString(String, Locale) + */ + public String toString() + { + int i = relations.size(); + if (i == 0) + return ""; + // Pre-allocate an average of 10 chars per state. + CPStringBuilder b = new CPStringBuilder(i * 10); + while (--i >= 0) + b.append(relations.get(i)).append(','); + return b.substring(0, b.length() - 1); + } +} // class AccessibleRelationSet diff --git a/libjava/classpath/javax/accessibility/AccessibleResourceBundle.java b/libjava/classpath/javax/accessibility/AccessibleResourceBundle.java new file mode 100644 index 000000000..52cf9cc38 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleResourceBundle.java @@ -0,0 +1,75 @@ +/* AccessibleResourceBundle.java -- deprecated class + Copyright (C) 2002, 2005 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. */ + + +package javax.accessibility; + +import java.util.ListResourceBundle; +import java.util.Locale; + +/** + * This class is deprecated. It once was used for localizing accessibility + * strings, and was never meant for external use anyway. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see AccessibleBundle#toDisplayString(String, Locale) + * @since 1.2 + * @deprecated this class is no longer used + * @status updated to 1.4 + */ +public class AccessibleResourceBundle extends ListResourceBundle +{ + /** + * Default constructor. + * + * @deprecated do not use this class + */ + public AccessibleResourceBundle() + { + } + + /** + * Returns the mapping between keys and display strings. + * + * @return null + * @deprecated do not use this class + */ + public Object[][] getContents() + { + return null; + } +} // class AccessibleResourceBundle diff --git a/libjava/classpath/javax/accessibility/AccessibleRole.java b/libjava/classpath/javax/accessibility/AccessibleRole.java new file mode 100644 index 000000000..ff51dd449 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleRole.java @@ -0,0 +1,543 @@ +/* AccessibleRole.java -- the primary role of an accessible object + Copyright (C) 2002, 2005 Free Software Foundation + +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. */ + +package javax.accessibility; + +import java.util.Locale; + +/** + * The role of an accessible object. For example, this could be "button" or + * "table". This strongly typed "enumeration" supports localized strings. If + * the constants of this class are not adequate, new ones may be added in a + * similar matter, while avoiding a public constructor. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleRole extends AccessibleBundle +{ + /** The object alerts the user about something. */ + public static final AccessibleRole ALERT + = new AccessibleRole("alert"); + + /** The header for a column of data. */ + public static final AccessibleRole COLUMN_HEADER + = new AccessibleRole("column header"); + + /** + * The object can be drawn into, and traps events. + * + * @see #FRAME + * @see #GLASS_PANE + * @see #LAYERED_PANE + */ + public static final AccessibleRole CANVAS + = new AccessibleRole("canvas"); + + /** + * A list of choices, which may optionally allow the user to create a new + * choice. + */ + public static final AccessibleRole COMBO_BOX + = new AccessibleRole("combo box"); + + /** + * An iconified frame in a desktop. + * + * @see #DESKTOP_PANE + * @see #INTERNAL_FRAME + */ + public static final AccessibleRole DESKTOP_ICON + = new AccessibleRole("desktop icon"); + + /** + * A frame-like object clipped by a desktop pane. + * + * @see #DESKTOP_ICON + * @see #DESKTOP_PANE + * @see #FRAME + */ + public static final AccessibleRole INTERNAL_FRAME + = new AccessibleRole("internal frame"); + + /** + * A pane which supports internal frames and their icons. + * + * @see #DESKTOP_ICON + * @see #INTERNAL_FRAME + */ + public static final AccessibleRole DESKTOP_PANE + = new AccessibleRole("desktop pane"); + + /** + * A specialized pane for use in a dialog. + * + * @see #DIALOG + */ + public static final AccessibleRole OPTION_PANE + = new AccessibleRole("option pane"); + + /** + * A top level window with no title or border. + * + * @see #FRAME + * @see #DIALOG + */ + public static final AccessibleRole WINDOW + = new AccessibleRole("window"); + + /** + * A top level window with title, menu bar, border, and so forth. It is + * often the primary window of an application. + * + * @see #DIALOG + * @see #CANVAS + * @see #WINDOW + */ + public static final AccessibleRole FRAME + = new AccessibleRole("frame"); + + /** + * A top level window title bar and border. It is limited compared to a + * frame, and is often a secondary window. + * + * @see #FRAME + * @see #WINDOW + */ + public static final AccessibleRole DIALOG + = new AccessibleRole("dialog"); + + /** A specialized dialog for choosing a color. */ + public static final AccessibleRole COLOR_CHOOSER + = new AccessibleRole("color chooser"); + + /** + * A pane for navigating through directories. + * + * @see #FILE_CHOOSER + */ + public static final AccessibleRole DIRECTORY_PANE + = new AccessibleRole("directory pane"); + + /** + * A specialized dialog that allows a user to select a file. + * + * @see #DIRECTORY_PANE + */ + public static final AccessibleRole FILE_CHOOSER + = new AccessibleRole("file chooser"); + + /** An object to fill space between other components. */ + public static final AccessibleRole FILLER + = new AccessibleRole("filler"); + + /** A hypertext anchor. */ + public static final AccessibleRole HYPERLINK + = new AccessibleRole("hyperlink"); + + /** A small picture to decorate components. */ + public static final AccessibleRole ICON + = new AccessibleRole("icon"); + + /** An object to label something in a graphic interface. */ + public static final AccessibleRole LABEL + = new AccessibleRole("label"); + + /** + * A specialized pane with a glass pane and layered pane as children. + * + * @see #GLASS_PANE + * @see #LAYERED_PANE + */ + public static final AccessibleRole ROOT_PANE + = new AccessibleRole("root pane"); + + /** + * A pane guaranteed to be painted on top of panes beneath it. + * + * @see #ROOT_PANE + * @see #LAYERED_PANE + */ + public static final AccessibleRole GLASS_PANE + = new AccessibleRole("glass pane"); + + /** + * A specialized pane that allows drawing children in layers. This is often + * used in menus and other visual components. + * + * @see #ROOT_PANE + * @see #GLASS_PANE + */ + public static final AccessibleRole LAYERED_PANE + = new AccessibleRole("layered pane"); + + /** + * An object which presents a list of items for selection. Often contained + * in a scroll pane. + * + * @see #SCROLL_PANE + * @see #LIST_ITEM + */ + public static final AccessibleRole LIST + = new AccessibleRole("list"); + + /** + * An object which represents an item in a list. Often contained in a scroll + * pane. + * + * @see #SCROLL_PANE + * @see #LIST + */ + public static final AccessibleRole LIST_ITEM + = new AccessibleRole("list item"); + + /** + * An object usually at the top of a frame to list available menus. + * + * @see #MENU + * @see #POPUP_MENU + * @see #LAYERED_PANE + */ + public static final AccessibleRole MENU_BAR + = new AccessibleRole("menu bar"); + + /** + * A temporary window with a menu of options, which hides on selection. + * + * @see #MENU + * @see #MENU_ITEM + */ + public static final AccessibleRole POPUP_MENU + = new AccessibleRole("popup menu"); + + /** + * An object usually in a menu bar which contains a list of actions to + * perform. Such actions are usually associated with menu items or submenus. + * + * @see #MENU_BAR + * @see #MENU_ITEM + * @see #SEPARATOR + * @see #RADIO_BUTTON + * @see #CHECK_BOX + * @see #POPUP_MENU + */ + public static final AccessibleRole MENU + = new AccessibleRole("menu"); + + /** + * An object usually in a menu with an action available for the user. + * + * @see #MENU_BAR + * @see #SEPARATOR + * @see #POPUP_MENU + */ + public static final AccessibleRole MENU_ITEM + = new AccessibleRole("menu item"); + + /** + * An object usually in a menu which separates logical sections of items. + * + * @see #MENU + * @see #MENU_ITEM + */ + public static final AccessibleRole SEPARATOR + = new AccessibleRole("separator"); + + /** + * An object which presents a series of panels, usually via tabs along the + * top. Children are all page tabs. + * + * @see #PAGE_TAB + */ + public static final AccessibleRole PAGE_TAB_LIST + = new AccessibleRole("page tab list"); + + /** + * An object in a page tab list, which contains the panel to display when + * selected from the list. + * + * @see #PAGE_TAB_LIST + */ + public static final AccessibleRole PAGE_TAB + = new AccessibleRole("page tab"); + + /** A generic container to group objects. */ + public static final AccessibleRole PANEL + = new AccessibleRole("panel"); + + /** An object used to track amount of a task that has completed. */ + public static final AccessibleRole PROGRESS_BAR + = new AccessibleRole("progress bar"); + + /** An object for passwords which should not be shown to the user. */ + public static final AccessibleRole PASSWORD_TEXT + = new AccessibleRole("password text"); + + /** + * An object that can be manipulated to do something. + * + * @see #CHECK_BOX + * @see #TOGGLE_BUTTON + * @see #RADIO_BUTTON + */ + public static final AccessibleRole PUSH_BUTTON + = new AccessibleRole("push button"); + + /** + * A specialized button which can be on or off, with no separate indicator. + * + * @see #PUSH_BUTTON + * @see #CHECK_BOX + * @see #RADIO_BUTTON + */ + public static final AccessibleRole TOGGLE_BUTTON + = new AccessibleRole("toggle button"); + + /** + * A choice which can be on or off, and has a separate indicator. + * + * @see #PUSH_BUTTON + * @see #TOGGLE_BUTTON + * @see #RADIO_BUTTON + */ + public static final AccessibleRole CHECK_BOX + = new AccessibleRole("check box"); + + /** + * A specialized choice which toggles radio buttons in the group when it + * is selected. + * + * @see #PUSH_BUTTON + * @see #TOGGLE_BUTTON + * @see #CHECK_BOX + */ + public static final AccessibleRole RADIO_BUTTON + = new AccessibleRole("radio button"); + + /** The header for a row of data. */ + public static final AccessibleRole ROW_HEADER + = new AccessibleRole("row header"); + + /** + * An object which allows an incremental view of a larger pane. + * + * @see #SCROLL_BAR + * @see #VIEWPORT + */ + public static final AccessibleRole SCROLL_PANE + = new AccessibleRole("scroll pane"); + + /** + * An object which allows selection of the view in a scroll pane. + * + * @see #SCROLL_PANE + */ + public static final AccessibleRole SCROLL_BAR + = new AccessibleRole("scroll bar"); + + /** + * An object which represents the visual section in a scroll pane. + * + * @see #SCROLL_PANE + */ + public static final AccessibleRole VIEWPORT + = new AccessibleRole("viewport"); + + /** An object which allows selection in a bounded range. */ + public static final AccessibleRole SLIDER + = new AccessibleRole("slider"); + + /** + * A specialized pane which presents two other panels, and can often adjust + * the divider between them. + */ + public static final AccessibleRole SPLIT_PANE + = new AccessibleRole("split pane"); + + /** An object for presenting data in rows and columns. */ + public static final AccessibleRole TABLE + = new AccessibleRole("table"); + + /** + * An object which represents text, usually editable by the user. + * + * @see #LABEL + */ + public static final AccessibleRole TEXT + = new AccessibleRole("text"); + + /** + * An object which represents a hierachical view of data. Subnodes can + * often be expanded or collapsed. + */ + public static final AccessibleRole TREE + = new AccessibleRole("tree"); + + /** A bar or pallete with buttons for common actions in an application. */ + public static final AccessibleRole TOOL_BAR + = new AccessibleRole("tool bar"); + + /** + * An object which provides information about another object. This is often + * displayed as a "help bubble" when a mouse hovers over the other object. + */ + public static final AccessibleRole TOOL_TIP + = new AccessibleRole("tool tip"); + + /** + * An AWT component with nothing else known about it. + * + * @see #SWING_COMPONENT + * @see #UNKNOWN + */ + public static final AccessibleRole AWT_COMPONENT + = new AccessibleRole("AWT component"); + + /** + * A swing component with nothing else known about it. + * + * @see #AWT_COMPONENT + * @see #UNKNOWN + */ + public static final AccessibleRole SWING_COMPONENT + = new AccessibleRole("SWING component"); + + /** + * An accessible object whose role is unknown. + * + * @see #AWT_COMPONENT + * @see #SWING_COMPONENT + */ + public static final AccessibleRole UNKNOWN + = new AccessibleRole("unknown"); + + /** A component with multiple labels of status information. */ + public static final AccessibleRole STATUS_BAR + = new AccessibleRole("statusbar"); + + /** A component which allows editing of Date and Time objects. */ + public static final AccessibleRole DATE_EDITOR + = new AccessibleRole("dateeditor"); + + /** A component with spinner arrows for simple numbers. */ + public static final AccessibleRole SPIN_BOX + = new AccessibleRole("spinbox"); + + /** A component for choosing fonts and their attributes. */ + public static final AccessibleRole FONT_CHOOSER + = new AccessibleRole("fontchooser"); + + /** A component with a border to group other components. */ + public static final AccessibleRole GROUP_BOX + = new AccessibleRole("groupbox"); + + /** + * A formula for creating a value. + * + * @since 1.5 + */ + public static final AccessibleRole EDITBAR + = new AccessibleRole("editbar"); + + /** + * A text-based footer. + * + * @since 1.5 + */ + public static final AccessibleRole FOOTER + = new AccessibleRole("footer"); + + /** + * A text-based header. + * + * @since 1.5 + */ + public static final AccessibleRole HEADER + = new AccessibleRole("header"); + + + /** + * A text-based paragraph. + * + * @since 1.5 + */ + public static final AccessibleRole PARAGRAPH + = new AccessibleRole("paragraph"); + + /** + * Represents the current level of progress on a particular task. + * + * @since 1.5 + */ + public static final AccessibleRole PROGRESS_MONITOR + = new AccessibleRole("progress monitor"); + + /** + * A ruler is a method of measuring the distance between two + * points. + * + * @since 1.5 + */ + public static final AccessibleRole RULER + = new AccessibleRole("ruler"); + + /** + * A HTML container is an accessible object which contains other + * accessible objects that together form some HTML content. For example, + * the content may be a sequence of text containing a link, which + * would be represent as two children, one an {@link AccessibleText} + * object holding the normal text and the other an + * {@link AccessibleHypertext} object representing the link. + * + * @since 1.6 + */ + public static final AccessibleRole HTML_CONTAINER + = new AccessibleRole("HTML container"); + + /** + * Create a new constant with a locale independent key. Follow the example, + * keep the constructor private and make public constants instead. + * + * @param key the name of the role + * @see #toDisplayString(String, Locale) + */ + protected AccessibleRole(String key) + { + this.key = key; + } +} // class AccessibleRole diff --git a/libjava/classpath/javax/accessibility/AccessibleSelection.java b/libjava/classpath/javax/accessibility/AccessibleSelection.java new file mode 100644 index 000000000..de26de76e --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleSelection.java @@ -0,0 +1,113 @@ +/* AccessibleSelection.java -- aids in accessibly selecting components + Copyright (C) 2000, 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * If an object implements this interface then it must be able to control + * the selection of its children. Accessibility software can use the + * implementations of this interface to change the selection set of children. + * + * <p>The <code>AccessibleContext.getAccessibleSelection()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleSelection() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleSelection +{ + /** + * Returns the number of currently selected Accessible children, which may + * be 0 if nothing is selected. + * + * @return the number of selected children + */ + int getAccessibleSelectionCount(); + + /** + * Returns the i-th selected child (not necessarily the overall i-th child) + * of this Accessible object. If i is out of bounds, null is returned. + * + * @param i zero-based index of selected child objects + * @return the Accessible child, or null + * @see #getAccessibleSelectionCount() + */ + Accessible getAccessibleSelection(int i); + + /** + * Determine if i-th overall child of this accessible object is selected. + * If i is out of bounds, false is returned. + * + * @param i zero-based index of child objects + * @return true if specified child exists and is selected + */ + boolean isAccessibleChildSelected(int i); + + /** + * Select the specified child if it is not already selected, placing it in + * the object's current selection. If the object does not support multiple + * selections then the new selection replaces the old. If the specified + * child is already selected, or is out of bounds, this method does nothing. + * + * @param i zero-based index of child objects + */ + void addAccessibleSelection(int i); + + /** + * Unselect the specified child of this Accessible object. If the specified + * child is not selected, or is out of bounds, this method does nothing. + * + * @param i the zero-based index of the child objects + */ + void removeAccessibleSelection(int i); + + /** + * Unselect all children of this Accessible object. + */ + void clearAccessibleSelection(); + + /** + * Select all children of this Accessible object if the object supports + * multiple selections or has a single child. Otherwise this does nothing. + */ + void selectAllAccessibleSelection(); +} // interface AccessibleSelection diff --git a/libjava/classpath/javax/accessibility/AccessibleState.java b/libjava/classpath/javax/accessibility/AccessibleState.java new file mode 100644 index 000000000..2d5106f36 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleState.java @@ -0,0 +1,349 @@ +/* AccessibleState.java -- a state of an accessible object + Copyright (C) 2002, 2005 Free Software Foundation + +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. */ + +package javax.accessibility; + +import java.awt.Dimension; +import java.util.Locale; + +/** + * A state portion of an accessible object. A combination of states represent + * the entire object state, in an AccessibleStateSet. For example, this could + * be "active" or "selected". This strongly typed "enumeration" supports + * localized strings. If the constants of this class are not adequate, new + * ones may be added in a similar matter, while avoiding a public constructor. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleState extends AccessibleBundle +{ + /** + * Indicates an active window, as well as an active child in a list or other + * collection. + * + * @see AccessibleRole#WINDOW + * @see AccessibleRole#FRAME + * @see AccessibleRole#DIALOG + */ + public static final AccessibleState ACTIVE + = new AccessibleState("active"); + + /** + * Indicates a pushed button, usually when the mouse has been pressed but + * not released. + * + * @see AccessibleRole#PUSH_BUTTON + */ + public static final AccessibleState PRESSED + = new AccessibleState("pressed"); + + /** + * Indicates an armed object, usually a button which has been pushed and + * the mouse has not left the button area. + * + * @see AccessibleRole#PUSH_BUTTON + */ + public static final AccessibleState ARMED + = new AccessibleState("armed"); + + /** + * Indicates an object is busy, such as a slider, scroll bar, or progress + * bar in transition. + * + * @see AccessibleRole#PROGRESS_BAR + * @see AccessibleRole#SCROLL_BAR + * @see AccessibleRole#SLIDER + */ + public static final AccessibleState BUSY + = new AccessibleState("busy"); + + /** + * Indicates an object is checked. + * + * @see AccessibleRole#TOGGLE_BUTTON + * @see AccessibleRole#RADIO_BUTTON + * @see AccessibleRole#CHECK_BOX + */ + public static final AccessibleState CHECKED + = new AccessibleState("checked"); + + /** + * Indicates the user can edit the component contents. This is usually for + * text, as other objects like scroll bars are automatically editable. + * + * @see #ENABLED + */ + public static final AccessibleState EDITABLE + = new AccessibleState("editable"); + + /** + * Indicates the object allows progressive disclosure of its children, + * usually in a collapsible tree or other hierachical object. + * + * @see #EXPANDED + * @see #COLLAPSED + * @see AccessibleRole#TREE + */ + public static final AccessibleState EXPANDABLE + = new AccessibleState("expandable"); + + /** + * Indicates that the object is collapsed, usually in a tree. + * + * @see #EXPANDABLE + * @see #EXPANDED + * @see AccessibleRole#TREE + */ + public static final AccessibleState COLLAPSED + = new AccessibleState("collapsed"); + + /** + * Indicates that the object is expanded, usually in a tree. + * + * @see #EXPANDABLE + * @see #COLLAPSED + * @see AccessibleRole#TREE + */ + public static final AccessibleState EXPANDED + = new AccessibleState("expanded"); + + /** + * Indicates that an object is enabled. In the absence of this state, + * graphics are often grayed out, and cannot be manipulated. + */ + public static final AccessibleState ENABLED + = new AccessibleState("enabled"); + + /** + * Indicates that an object can accept focus, which means it will process + * keyboard events when focused. + * + * @see #FOCUSED + */ + public static final AccessibleState FOCUSABLE + = new AccessibleState("focusable"); + + /** + * Indicates that an object has keyboard focus. + * + * @see #FOCUSABLE + */ + public static final AccessibleState FOCUSED + = new AccessibleState("focused"); + + /** + * Indicates that an object is minimized to an icon. + * + * @see AccessibleRole#FRAME + * @see AccessibleRole#INTERNAL_FRAME + */ + public static final AccessibleState ICONIFIED + = new AccessibleState("iconified"); + + /** + * Indicates that the state of this particular object is + * indeterminate. This commonly occurs when an object is incapable + * of representing the state by a single value. + * + * @since 1.5 + */ + public static final AccessibleState INDETERMINATE + = new AccessibleState("indeterminate"); + + /** + * Indicates that this particular object manages a number of + * subcomponents. This is a common property of structures such as + * trees and tables, which have a number of sub-elements such as + * rows and columns. The subcomponents should be left to the + * object, and not managed by the application. + * + * @since 1.5 + */ + public static final AccessibleState MANAGES_DESCENDANTS + = new AccessibleState("manages descendants"); + + /** + * Indicates that something must be done in the current object before + * interaction is allowed on other windows, usually for dialogs. + * + * @see AccessibleRole#DIALOG + */ + public static final AccessibleState MODAL + = new AccessibleState("modal"); + + /** + * Indicates that all pixels in the object are painted. If this state is not + * present, then the object has some degree of transparency, letting lower + * panes show through. + * + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleComponent() + * @see AccessibleComponent#getBounds() + */ + public static final AccessibleState OPAQUE + = new AccessibleState("opaque"); + + /** + * Indicates the size of this object is not fixed. + * + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleComponent() + * @see AccessibleComponent#getSize() + * @see AccessibleComponent#setSize(Dimension) + */ + public static final AccessibleState RESIZABLE + = new AccessibleState("resizable"); + + /** + * Indicates that multiple children can be selected at once. + * + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleSelection() + * @see AccessibleSelection + */ + public static final AccessibleState MULTISELECTABLE + = new AccessibleState("multiselectable"); + + /** + * Indicates that this child is one which can be selected from its parent. + * + * @see #SELECTED + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleSelection() + * @see AccessibleSelection + */ + public static final AccessibleState SELECTABLE + = new AccessibleState("selectable"); + + /** + * Indicates that this child has been selected from its parent. + * + * @see #SELECTABLE + * @see Accessible#getAccessibleContext() + * @see AccessibleContext#getAccessibleSelection() + * @see AccessibleSelection + */ + public static final AccessibleState SELECTED + = new AccessibleState("selected"); + + /** + * Indicates that this object and all its parents are visible, so that it + * is on the screen. However, something opaque may be on top of it. + * + * @see #VISIBLE + */ + public static final AccessibleState SHOWING + = new AccessibleState("showing"); + + /** + * Indicates that this particular object is truncated when displayed + * visually. + * + * @since 1.5 + */ + public static final AccessibleState TRUNCATED + = new AccessibleState("truncated"); + + /** + * Indicates that this object intends to be visible. However, if its + * parent is invisible, this object is as well. + * + * @see #SHOWING + */ + public static final AccessibleState VISIBLE + = new AccessibleState("visible"); + + /** + * Indicates that an object has vertical orientation. + * + * @see #HORIZONTAL + * @see AccessibleRole#SCROLL_BAR + * @see AccessibleRole#SLIDER + * @see AccessibleRole#PROGRESS_BAR + */ + public static final AccessibleState VERTICAL + = new AccessibleState("vertical"); + + /** + * Indicates that an object has horizontal orientation. + * + * @see #VERTICAL + * @see AccessibleRole#SCROLL_BAR + * @see AccessibleRole#SLIDER + * @see AccessibleRole#PROGRESS_BAR + */ + public static final AccessibleState HORIZONTAL + = new AccessibleState("horizontal"); + + /** + * Indicates that this text object can only hold a single line. + * + * @see #MULTI_LINE + */ + public static final AccessibleState SINGLE_LINE + = new AccessibleState("single line"); + + /** + * Indicates that this text object can hold multiple lines. + * + * @see #SINGLE_LINE + */ + public static final AccessibleState MULTI_LINE + = new AccessibleState("multiple line"); + + /** + * Indicates that this object is transient. This means the object is + * generated for method queries, but will never generate events, because + * its container (such as a tree, list, or table) does all the work. + */ + public static final AccessibleState TRANSIENT + = new AccessibleState("transient"); + + /** + * Create a new constant with a locale independent key. Follow the example, + * keep the constructor private and make public constants instead. + * + * @param key the name of the state + * @see #toDisplayString(String, Locale) + */ + protected AccessibleState(String key) + { + this.key = key; + } +} // class AccessibleState diff --git a/libjava/classpath/javax/accessibility/AccessibleStateSet.java b/libjava/classpath/javax/accessibility/AccessibleStateSet.java new file mode 100644 index 000000000..83bf3d491 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleStateSet.java @@ -0,0 +1,175 @@ +/* AccessibleStateSet.java -- the combined state of an accessible object + Copyright (C) 2002, 2005 Free Software Foundation + +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. */ + +package javax.accessibility; + +import gnu.java.lang.CPStringBuilder; + +import java.util.Locale; +import java.util.Vector; + +/** + * Describes all elements of an accessible object's state. For example, an + * object may be enabled and have focus. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see AccessibleState + * @since 1.2 + * @status updated to 1.4 + */ +public class AccessibleStateSet +{ + /** + * The list of states, should be instances of AccessibleState. Don't set + * this to null. + * + * @see #add(AccessibleState) + * @see #addAll(AccessibleState[]) + * @see #remove(AccessibleState) + * @see #contains(AccessibleState) + * @see #toArray() + * @see #clear() + */ + protected Vector<AccessibleState> states = new Vector<AccessibleState>(); + + /** + * Create an empty state set. + */ + public AccessibleStateSet() + { + } + + /** + * Create a state set initialized with the given states, duplicates are + * ignored. + * + * @param states the states to insert + * @throws NullPointerException if states is null + */ + public AccessibleStateSet(AccessibleState[] states) + { + addAll(states); + } + + /** + * Add a new state to the current set. Return true if the state was added, + * as duplicates are ignored. Entering a null state will cause problems + * later, so don't do it. + * + * @param state the state to add + * @return true if the state was added + */ + public boolean add(AccessibleState state) + { + return states.contains(state) ? false : states.add(state); + } + + /** + * Add all of the states to the current set. Duplicates are ignored. + * Entering a null state will cause problems later, so don't do it. + * + * @param array the array of states to add + * @throws NullPointerException if array is null + */ + public void addAll(AccessibleState[] array) + { + int i = array.length; + while (--i >= 0) + add(array[i]); + } + + /** + * Remove a state from the set. If a state was removed, return true. + * + * @param state the state to remove + * @return true if the set changed + */ + public boolean remove(AccessibleState state) + { + return states.remove(state); + } + + /** + * Clear all states in the set. + */ + public void clear() + { + states.clear(); + } + + /** + * Check if the current state is in the set. + * + * @param state the state to locate + * @return true if it is in the set + */ + public boolean contains(AccessibleState state) + { + return states.contains(state); + } + + /** + * Return the state set as an array. + * + * @return an array of the current states + */ + public AccessibleState[] toArray() + { + AccessibleState[] result = new AccessibleState[states.size()]; + states.toArray(result); + return result; + } + + /** + * Return a localized, comma-separated string representing all states + * in the set. This is in arbitrary order. + * + * @return the string representation + * @see AccessibleBundle#toDisplayString(String, Locale) + */ + public String toString() + { + int i = states.size(); + if (i == 0) + return ""; + // Pre-allocate an average of 10 chars per state. + CPStringBuilder b = new CPStringBuilder(i * 10); + while (--i >= 0) + b.append(states.get(i)).append(','); + return b.substring(0, b.length() - 1); + } +} // class AccessibleStateSet diff --git a/libjava/classpath/javax/accessibility/AccessibleStreamable.java b/libjava/classpath/javax/accessibility/AccessibleStreamable.java new file mode 100644 index 000000000..cbeedf783 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleStreamable.java @@ -0,0 +1,62 @@ +/* AccessibleStreamable.java + Copyright (C) 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. */ + + +package javax.accessibility; + +import java.awt.datatransfer.DataFlavor; +import java.io.InputStream; + +/** + * This interface represents a streamable accessible object. + * @since 1.5 + */ +public interface AccessibleStreamable +{ + /** + * Return an array of the data flavors supported by this object. + */ + DataFlavor[] getMimeTypes(); + + /** + * Return an input stream that yields the contents of this object, + * using the given data flavor. If the given data flavor cannot + * be used, returns null. + * @param flavor the data flavor + */ + InputStream getStream(DataFlavor flavor); +} diff --git a/libjava/classpath/javax/accessibility/AccessibleTable.java b/libjava/classpath/javax/accessibility/AccessibleTable.java new file mode 100644 index 000000000..3be5177ad --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleTable.java @@ -0,0 +1,236 @@ +/* AccessibleTable.java -- aids in accessibly manipulating tables + Copyright (C) 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * Objects which present information in a 2-dimensional table should implement + * this interface. Accessibility software can use the implementations of + * this interface to navigate and change the attributes of the table. + * + * <p>The <code>AccessibleContext.getAccessibleTable()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleTable() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleTable +{ + /** + * Return the caption for the table, or null if unknown. + * + * @return the table caption + */ + Accessible getAccessibleCaption(); + + /** + * Set the table caption. + * + * @param caption the new caption + */ + void setAccessibleCaption(Accessible caption); + + /** + * Return the summary description of the table, or null if unknown. + * + * @return the summary description + */ + Accessible getAccessibleSummary(); + + /** + * Set the table summary description. + * + * @param summary the new summary + */ + void setAccessibleSummary(Accessible summary); + + /** + * Return the number of rows in the table. + * + * @return the row count + */ + int getAccessibleRowCount(); + + /** + * Return the number of columns in the table. + * + * @return the column count + */ + int getAccessibleColumnCount(); + + /** + * Return the cell at the specified row and column, or null if out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return the cell at (r,c) + */ + Accessible getAccessibleAt(int r, int c); + + /** + * Returns the number of merged rows occupied at the specified row and + * column, or 0 if out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return the row extent at (r,c) + */ + int getAccessibleRowExtentAt(int r, int c); + + /** + * Returns the number of merged columns occupied at the specified row and + * column, or 0 if out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return the column extent at (r,c) + */ + int getAccessibleColumnExtentAt(int r, int c); + + /** + * Return the row headers as a table. + * + * @return the row headers, or null if there are none + */ + AccessibleTable getAccessibleRowHeader(); + + /** + * Set the row headers. + * + * @param header the new row header + */ + // XXX What happens if header is incompatible size? + void setAccessibleRowHeader(AccessibleTable header); + + /** + * Return the column headers as a table. + * + * @return the column headers, or null if there are none + */ + AccessibleTable getAccessibleColumnHeader(); + + /** + * Set the column headers. + * + * @param header the new column header + */ + // XXX What happens if header is incompatible size? + void setAccessibleColumnHeader(AccessibleTable header); + + /** + * Return the description of a row, or null if there is none or the index + * is out of bounds. + * + * @param r the 0-based row index + * @return the description + */ + Accessible getAccessibleRowDescription(int r); + + /** + * Set the description of a row. Does nothing if the index is invalid. + * + * @param r the 0-based row index + * @param description the new description + */ + void setAccessibleRowDescription(int r, Accessible description); + + /** + * Return the description of a column, or null if there is none or the index + * is out of bounds. + * + * @param c the 0-based column index + * @return the description + */ + Accessible getAccessibleColumnDescription(int c); + + /** + * Set the description of a column. Does nothing if the index is invalid. + * + * @param c the 0-based column index + * @param description the new description + */ + void setAccessibleColumnDescription(int c, Accessible description); + + /** + * Return whether the cell at the specified location is selected. Returns + * false if the index is out of bounds. + * + * @param r the 0-based row index + * @param c the 0-based column index + * @return true if that cell is selected + */ + boolean isAccessibleSelected(int r, int c); + + /** + * Return whether the specified row is selected. Returns false if the + * index is out of bounds. + * + * @param r the 0-based row index + * @return true if that row is selected + */ + boolean isAccessibleRowSelected(int r); + + /** + * Return whether the specified column is selected. Returns false if the + * index is out of bounds. + * + * @param c the 0-based column index + * @return true if that column is selected + */ + boolean isAccessibleColumnSelected(int c); + + /** + * Return the selected rows. May be null or empty if there is no selection. + * + * @return the indices of selected rows + */ + int[] getSelectedAccessibleRows(); + + /** + * Return the selected columns. May be null or empty if there is no + * selection. + * + * @return the indices of selected columns + */ + int[] getSelectedAccessibleColumns(); +} // interface AccessibleTable diff --git a/libjava/classpath/javax/accessibility/AccessibleTableModelChange.java b/libjava/classpath/javax/accessibility/AccessibleTableModelChange.java new file mode 100644 index 000000000..6a85d0295 --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleTableModelChange.java @@ -0,0 +1,102 @@ +/* AccessibleTableModelChange.java -- describes change to an accessible table + Copyright (C) 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * Describes a change to an accessible table. Accessibility software can use + * the implementations of this interface to update their state after a + * change to a table. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleTable() + * @see AccessibleTable + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleTableModelChange +{ + /** Identifies insertion of rows or columns. */ + int INSERT = 1; + + /** Identifies change to existing data. */ + int UPDATE = 0; + + /** Identifies deletion of rows or columns. */ + int DELETE = -1; + + /** + * Returns the change type. + * + * @return the type + * @see #INSERT + * @see #UPDATE + * @see #DELETE + */ + int getType(); + + /** + * Returns the first row that changed. + * + * @return the 0-based index of the first row to change + */ + int getFirstRow(); + + /** + * Returns the last row that changed. + * + * @return the 0-based index of the last row to change + */ + int getLastRow(); + + /** + * Returns the first column that changed. + * + * @return the 0-based index of the first column to change + */ + int getFirstColumn(); + + /** + * Returns the last column that changed. + * + * @return the 0-based index of the last column to change + */ + int getLastColumn(); +} // interface AccessibleTableModelChange diff --git a/libjava/classpath/javax/accessibility/AccessibleText.java b/libjava/classpath/javax/accessibility/AccessibleText.java new file mode 100644 index 000000000..be5f45c7e --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleText.java @@ -0,0 +1,185 @@ +/* AccessibleText.java -- aids in accessibly manipulating text + Copyright (C) 2000, 2002, 2004, 2005 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. */ + + +package javax.accessibility; + +import java.awt.Point; +import java.awt.Rectangle; + +import javax.swing.text.AttributeSet; + +/** + * Objects which present textual information on the display should implement + * this interface. Accessibility software can use the implementations of + * this interface to change the attributes and spacial location of the text. + * + * <p>The <code>AccessibleContext.getAccessibleText()</code> method + * should return <code>null</code> if an object does not implement this + * interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleText() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleText +{ + /** + * Constant designating that the next selection should be a character. + * + * @see #getAtIndex(int, int) + * @see #getAfterIndex(int, int) + * @see #getBeforeIndex(int, int) + */ + int CHARACTER = 1; + + /** + * Constant designating that the next selection should be a word. + * + * @see #getAtIndex(int, int) + * @see #getAfterIndex(int, int) + * @see #getBeforeIndex(int, int) + */ + int WORD = 2; + + /** + * Constant designating that the next selection should be a sentence. + * + * @see #getAtIndex(int, int) + * @see #getAfterIndex(int, int) + * @see #getBeforeIndex(int, int) + */ + int SENTENCE = 3; + + /** + * Given a point in the coordinate system of this object, return the + * 0-based index of the character at that point, or -1 if there is none. + * + * @param point the point to look at + * @return the character index, or -1 + */ + int getIndexAtPoint(Point point); + + /** + * Determines the bounding box of the indexed character. Returns an empty + * rectangle if the index is out of bounds. + * + * @param index the 0-based character index + * @return the bounding box, may be empty + */ + Rectangle getCharacterBounds(int index); + + /** + * Return the number of characters. + * + * @return the character count + */ + int getCharCount(); + + /** + * Return the offset of the character. The offset matches the index of the + * character to the right, since the carat lies between characters. + * + * @return the 0-based caret position + */ + int getCaretPosition(); + + /** + * Returns the section of text at the index, or null if the index or part + * is invalid. + * + * @param part {@link #CHARACTER}, {@link #WORD}, or {@link #SENTENCE} + * @param index the 0-based character index + * @return the selection of text at that index, or null + */ + String getAtIndex(int part, int index); + + /** + * Returns the section of text after the index, or null if the index or part + * is invalid. + * + * @param part {@link #CHARACTER}, {@link #WORD}, or {@link #SENTENCE} + * @param index the 0-based character index + * @return the selection of text after that index, or null + */ + String getAfterIndex(int part, int index); + + /** + * Returns the section of text before the index, or null if the index or part + * is invalid. + * + * @param part {@link #CHARACTER}, {@link #WORD}, or {@link #SENTENCE} + * @param index the 0-based character index + * @return the selection of text before that index, or null + */ + String getBeforeIndex(int part, int index); + + /** + * Returns the attributes of a character at an index, or null if the index + * is out of bounds. + * + * @param index the 0-based character index + * @return the character's attributes + */ + AttributeSet getCharacterAttribute(int index); + + /** + * Returns the start index of the selection. If there is no selection, this + * is the same as the caret location. + * + * @return the 0-based character index of the selection start + */ + int getSelectionStart(); + + /** + * Returns the end index of the selection. If there is no selection, this + * is the same as the caret location. + * + * @return the 0-based character index of the selection end + */ + int getSelectionEnd(); + + /** + * Returns the selected text. This may be null or "" if no text is selected. + * + * @return the selected text + */ + String getSelectedText(); +} // interface AccessibleText diff --git a/libjava/classpath/javax/accessibility/AccessibleTextSequence.java b/libjava/classpath/javax/accessibility/AccessibleTextSequence.java new file mode 100644 index 000000000..b400160aa --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleTextSequence.java @@ -0,0 +1,81 @@ +/* AccessibleTextSequence.java + Copyright (C) 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. */ + + +package javax.accessibility; + +/** + * This is a convenience class that encapsulates a string of text + * and a range specifying where, within a larger body of text, the + * string may be found. + * + * @since 1.5 + */ +public class AccessibleTextSequence +{ + /** + * The text of the sequence. + */ + public String text; + + /** + * The starting index. + */ + public int startIndex; + + /** + * The ending index. + */ + public int endIndex; + + /** + * Create a new instance. + * + * @param start the initial index of the text within a larger + * body of text. + * @param end the final index of the text within a larger body + * of text. + * @param txt the text itself. + * @since 1.6 + */ + public AccessibleTextSequence(int start, int end, String txt) + { + startIndex = start; + endIndex = end; + text = txt; + } +} diff --git a/libjava/classpath/javax/accessibility/AccessibleValue.java b/libjava/classpath/javax/accessibility/AccessibleValue.java new file mode 100644 index 000000000..100b3ed8d --- /dev/null +++ b/libjava/classpath/javax/accessibility/AccessibleValue.java @@ -0,0 +1,94 @@ +/* AccessibleValue.java -- aids in accessibly controlling values + Copyright (C) 2002, 2005 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. */ + + +package javax.accessibility; + +/** + * If an object implements this interface then it must be able to control + * a numerical value. For example, a scroll bar has a position represented + * by a number. Accessibility software can use the implementations of this + * interface to change the associated value. + * + * <p>The <code>AccessibleContext.getAccessibleValue()</code> method should + * return <code>null</code> if an object does not implement this interface. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Accessible + * @see AccessibleContext + * @see AccessibleContext#getAccessibleValue() + * @since 1.2 + * @status updated to 1.4 + */ +public interface AccessibleValue +{ + /** + * Gets the current value of this object, or null if it has not been set. + * + * @return the current value, or null + * @see #setCurrentAccessibleValue(Number) + */ + Number getCurrentAccessibleValue(); + + /** + * Sets the current value of this object. Returns true if the number + * successfully changed. + * + * @param number the new value + * @return true on success + */ + // XXX What happens if number is null? + boolean setCurrentAccessibleValue(Number number); + + /** + * Gets the minimum value in the range of this object, or null if there is + * no minimum. + * + * @return the minimum + * @see #getMaximumAccessibleValue() + */ + Number getMinimumAccessibleValue(); + + /** + * Gets the maximum value in the range of this object, or null if there is + * no maximum. + * + * @return the maximum + * @see #getMinimumAccessibleValue() + */ + Number getMaximumAccessibleValue(); +} // interface AccessibleValue diff --git a/libjava/classpath/javax/accessibility/package.html b/libjava/classpath/javax/accessibility/package.html new file mode 100644 index 000000000..ec3ce8e91 --- /dev/null +++ b/libjava/classpath/javax/accessibility/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.accessibility package. + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - javax.accessibility</title></head> + +<body> +<p>Provides a contract between objects and accessibility software.</p> + +</body> +</html> |