libjava/ChangeLog:
[official-gcc.git] / libjava / classpath / javax / accessibility / AccessibleRelation.java
blob3d515fd576538036aa3cf557c3aab490b3ff9027
1 /* AccessibleRelation.java -- the relation between accessible objects
2 Copyright (C) 2002, 2005 Free Software Foundation
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package javax.accessibility;
40 import java.util.Locale;
42 /**
43 * The relation between one accessible object and one or more other objects.
44 * For example, a button may control an action. An AccessibleRelationSet
45 * summarizes all relations of the object. This strongly typed "enumeration"
46 * supports localized strings. If the constants of this class are not
47 * adequate, new ones may be added in a similar matter.
49 * @author Eric Blake (ebb9@email.byu.edu)
50 * @since 1.2
51 * @status updated to 1.4
53 public class AccessibleRelation extends AccessibleBundle
55 /**
56 * Indicates the object labels other objects.
58 * @see #getTarget()
59 * @see #CONTROLLER_FOR
60 * @see #CONTROLLED_BY
61 * @see #LABELED_BY
62 * @see #MEMBER_OF
64 public static final String LABEL_FOR;
66 /**
67 * Indicates the object is labeled by other objects.
69 * @see #getTarget()
70 * @see #CONTROLLER_FOR
71 * @see #CONTROLLED_BY
72 * @see #LABEL_FOR
73 * @see #MEMBER_OF
75 public static final String LABELED_BY;
77 /**
78 * Indicates an object is a member of a group of target objects.
80 * @see #getTarget()
81 * @see #CONTROLLER_FOR
82 * @see #CONTROLLED_BY
83 * @see #LABEL_FOR
84 * @see #LABELED_BY
86 public static final String MEMBER_OF;
88 /**
89 * Indicates an object is a controller for other objects.
91 * @see #getTarget()
92 * @see #CONTROLLED_BY
93 * @see #LABEL_FOR
94 * @see #LABELED_BY
95 * @see #MEMBER_OF
97 public static final String CONTROLLER_FOR;
99 /**
100 * Indicates an object is controlled by other objects.
102 * @see #getTarget()
103 * @see #CONTROLLER_FOR
104 * @see #LABEL_FOR
105 * @see #LABELED_BY
106 * @see #MEMBER_OF
108 public static final String CONTROLLED_BY;
110 /** Indicates that the label target group has changed. */
111 public static final String LABEL_FOR_PROPERTY = "labelForProperty";
113 /** Indicates that the labelling objects have changed. */
114 public static final String LABELED_BY_PROPERTY = "labeledByProperty";
116 /** Indicates that group membership has changed. */
117 public static final String MEMBER_OF_PROPERTY = "memberOfProperty";
119 /** Indicates that the controller target group has changed. */
120 public static final String CONTROLLER_FOR_PROPERTY = "controllerForProperty";
122 /** Indicates that the controlling objects have changed. */
123 public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty";
126 * Indicates that an object is a child of another object.
127 * @since 1.5
129 public static final String CHILD_NODE_OF = "childNodeOf";
132 * Indicates that the ancestry relationship has changed.
133 * @since 1.5
135 public static final String CHILD_NODE_OF_PROPERTY = "childNodeOfProperty";
138 * Indicates that an object is embedded by another object.
139 * @since 1.5
141 public static final String EMBEDDED_BY = "embeddedBy";
144 * Indicates that the {@link #EMBEDDED_BY} property changed.
145 * @since 1.5
147 public static final String EMBEDDED_BY_PROPERTY = "embeddedByProperty";
150 * Indicates that an object embeds another object.
151 * @since 1.5
153 public static final String EMBEDS = "embeds";
156 * Indicates that the {@link #EMBEDS} property changed.
157 * @since 1.5
159 public static final String EMBEDS_PROPERTY = "embedsProperty";
162 * Indicates that one object directly follows another object,
163 * as in a paragraph flow.
164 * @since 1.5
166 public static final String FLOWS_FROM = "flowsFrom";
169 * Indicates that the {@link #FLOWS_FROM} property changed.
170 * @since 1.5
172 public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty";
175 * Indicates that one object comes directly before another object,
176 * as in a paragraph flow.
177 * @since 1.5
179 public static final String FLOWS_TO = "flowsTo";
182 * Indicates that the {@link #FLOWS_TO} property changed.
183 * @since 1.5
185 public static final String FLOWS_TO_PROPERTY = "flowsToProperty";
188 * Indicates that one object is a parent window of another object.
189 * @since 1.5
191 public static final String PARENT_WINDOW_OF = "parentWindowOf";
194 * Indicates that the {@link #PARENT_WINDOW_OF} property changed.
195 * @since 1.5
197 public static final String PARENT_WINDOW_OF_PROPERTY = "parentWindowOfProperty";
200 * Indicates that one object is a subwindow of another object.
201 * @since 1.5
203 public static final String SUBWINDOW_OF = "subwindowOf";
206 * Indicates that the {@link #SUBWINDOW_OF} property changed.
207 * @since 1.5
209 public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty";
211 /** An empty set of targets. */
212 private static final Object[] EMPTY_TARGETS = { };
214 static
216 // not constants in JDK
217 LABEL_FOR = "labelFor";
218 LABELED_BY = "labeledBy";
219 MEMBER_OF = "memberOf";
220 CONTROLLER_FOR = "controllerFor";
221 CONTROLLED_BY = "controlledBy";
225 * The related objects.
227 * @see #getTarget()
228 * @see #setTarget(Object)
229 * @see #setTarget(Object[])
231 Object[] targets;
234 * Create a new relation with a locale independent key, and no related
235 * objects.
237 * @param key the name of the role
238 * @see #toDisplayString(String, Locale)
240 public AccessibleRelation(String key)
242 this.key = key;
243 targets = EMPTY_TARGETS;
247 * Create a new relation with a locale independent key, and a single related
248 * object.
250 * @param key the name of the role
251 * @param target the related object
252 * @see #toDisplayString(String, Locale)
254 public AccessibleRelation(String key, Object target)
256 this.key = key;
257 targets = new Object[] { target };
261 * Create a new relation with a locale independent key, and the given
262 * related objects.
264 * @param key the name of the role
265 * @param targets the related objects
266 * @see #toDisplayString(String, Locale)
268 public AccessibleRelation(String key, Object[] targets)
270 this.key = key;
271 this.targets = targets == null ? EMPTY_TARGETS : targets;
275 * Return the key for this relation.
277 * @return the key
278 * @see #CONTROLLER_FOR
279 * @see #CONTROLLED_BY
280 * @see #LABEL_FOR
281 * @see #LABELED_BY
282 * @see #MEMBER_OF
284 public String getKey()
286 return key;
290 * Return the targets of this relation.
292 * @return the targets, may be empty, but never null
294 public Object[] getTarget()
296 return targets;
300 * Set the target to a single object.
302 * @param target the new target
304 public void setTarget(Object target)
306 targets = new Object[] { target };
310 * Set the target to an array of objects.
312 * @param targets the new targets
314 public void setTarget(Object[] targets)
316 this.targets = targets == null ? EMPTY_TARGETS : targets;
318 } // class AccessibleRelation