GNU Classpath (0.95) | |
Frames | No Frames |
1: /* AccessibleRelation.java -- the relation between accessible objects 2: Copyright (C) 2002, 2005 Free Software Foundation 3: 4: This file is part of GNU Classpath. 5: 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. 10: 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. 15: 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. 20: 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. 25: 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. */ 37: 38: package javax.accessibility; 39: 40: import java.util.Locale; 41: 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. 48: * 49: * @author Eric Blake (ebb9@email.byu.edu) 50: * @since 1.2 51: * @status updated to 1.4 52: */ 53: public class AccessibleRelation extends AccessibleBundle 54: { 55: /** 56: * Indicates the object labels other objects. 57: * 58: * @see #getTarget() 59: * @see #CONTROLLER_FOR 60: * @see #CONTROLLED_BY 61: * @see #LABELED_BY 62: * @see #MEMBER_OF 63: */ 64: public static final String LABEL_FOR; 65: 66: /** 67: * Indicates the object is labeled by other objects. 68: * 69: * @see #getTarget() 70: * @see #CONTROLLER_FOR 71: * @see #CONTROLLED_BY 72: * @see #LABEL_FOR 73: * @see #MEMBER_OF 74: */ 75: public static final String LABELED_BY; 76: 77: /** 78: * Indicates an object is a member of a group of target objects. 79: * 80: * @see #getTarget() 81: * @see #CONTROLLER_FOR 82: * @see #CONTROLLED_BY 83: * @see #LABEL_FOR 84: * @see #LABELED_BY 85: */ 86: public static final String MEMBER_OF; 87: 88: /** 89: * Indicates an object is a controller for other objects. 90: * 91: * @see #getTarget() 92: * @see #CONTROLLED_BY 93: * @see #LABEL_FOR 94: * @see #LABELED_BY 95: * @see #MEMBER_OF 96: */ 97: public static final String CONTROLLER_FOR; 98: 99: /** 100: * Indicates an object is controlled by other objects. 101: * 102: * @see #getTarget() 103: * @see #CONTROLLER_FOR 104: * @see #LABEL_FOR 105: * @see #LABELED_BY 106: * @see #MEMBER_OF 107: */ 108: public static final String CONTROLLED_BY; 109: 110: /** Indicates that the label target group has changed. */ 111: public static final String LABEL_FOR_PROPERTY = "labelForProperty"; 112: 113: /** Indicates that the labelling objects have changed. */ 114: public static final String LABELED_BY_PROPERTY = "labeledByProperty"; 115: 116: /** Indicates that group membership has changed. */ 117: public static final String MEMBER_OF_PROPERTY = "memberOfProperty"; 118: 119: /** Indicates that the controller target group has changed. */ 120: public static final String CONTROLLER_FOR_PROPERTY = "controllerForProperty"; 121: 122: /** Indicates that the controlling objects have changed. */ 123: public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty"; 124: 125: /** 126: * Indicates that an object is a child of another object. 127: * @since 1.5 128: */ 129: public static final String CHILD_NODE_OF = "childNodeOf"; 130: 131: /** 132: * Indicates that the ancestry relationship has changed. 133: * @since 1.5 134: */ 135: public static final String CHILD_NODE_OF_PROPERTY = "childNodeOfProperty"; 136: 137: /** 138: * Indicates that an object is embedded by another object. 139: * @since 1.5 140: */ 141: public static final String EMBEDDED_BY = "embeddedBy"; 142: 143: /** 144: * Indicates that the {@link #EMBEDDED_BY} property changed. 145: * @since 1.5 146: */ 147: public static final String EMBEDDED_BY_PROPERTY = "embeddedByProperty"; 148: 149: /** 150: * Indicates that an object embeds another object. 151: * @since 1.5 152: */ 153: public static final String EMBEDS = "embeds"; 154: 155: /** 156: * Indicates that the {@link #EMBEDS} property changed. 157: * @since 1.5 158: */ 159: public static final String EMBEDS_PROPERTY = "embedsProperty"; 160: 161: /** 162: * Indicates that one object directly follows another object, 163: * as in a paragraph flow. 164: * @since 1.5 165: */ 166: public static final String FLOWS_FROM = "flowsFrom"; 167: 168: /** 169: * Indicates that the {@link #FLOWS_FROM} property changed. 170: * @since 1.5 171: */ 172: public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty"; 173: 174: /** 175: * Indicates that one object comes directly before another object, 176: * as in a paragraph flow. 177: * @since 1.5 178: */ 179: public static final String FLOWS_TO = "flowsTo"; 180: 181: /** 182: * Indicates that the {@link #FLOWS_TO} property changed. 183: * @since 1.5 184: */ 185: public static final String FLOWS_TO_PROPERTY = "flowsToProperty"; 186: 187: /** 188: * Indicates that one object is a parent window of another object. 189: * @since 1.5 190: */ 191: public static final String PARENT_WINDOW_OF = "parentWindowOf"; 192: 193: /** 194: * Indicates that the {@link #PARENT_WINDOW_OF} property changed. 195: * @since 1.5 196: */ 197: public static final String PARENT_WINDOW_OF_PROPERTY = "parentWindowOfProperty"; 198: 199: /** 200: * Indicates that one object is a subwindow of another object. 201: * @since 1.5 202: */ 203: public static final String SUBWINDOW_OF = "subwindowOf"; 204: 205: /** 206: * Indicates that the {@link #SUBWINDOW_OF} property changed. 207: * @since 1.5 208: */ 209: public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty"; 210: 211: /** An empty set of targets. */ 212: private static final Object[] EMPTY_TARGETS = { }; 213: 214: static 215: { 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"; 222: } 223: 224: /** 225: * The related objects. 226: * 227: * @see #getTarget() 228: * @see #setTarget(Object) 229: * @see #setTarget(Object[]) 230: */ 231: Object[] targets; 232: 233: /** 234: * Create a new relation with a locale independent key, and no related 235: * objects. 236: * 237: * @param key the name of the role 238: * @see #toDisplayString(String, Locale) 239: */ 240: public AccessibleRelation(String key) 241: { 242: this.key = key; 243: targets = EMPTY_TARGETS; 244: } 245: 246: /** 247: * Create a new relation with a locale independent key, and a single related 248: * object. 249: * 250: * @param key the name of the role 251: * @param target the related object 252: * @see #toDisplayString(String, Locale) 253: */ 254: public AccessibleRelation(String key, Object target) 255: { 256: this.key = key; 257: targets = new Object[] { target }; 258: } 259: 260: /** 261: * Create a new relation with a locale independent key, and the given 262: * related objects. 263: * 264: * @param key the name of the role 265: * @param targets the related objects 266: * @see #toDisplayString(String, Locale) 267: */ 268: public AccessibleRelation(String key, Object[] targets) 269: { 270: this.key = key; 271: this.targets = targets == null ? EMPTY_TARGETS : targets; 272: } 273: 274: /** 275: * Return the key for this relation. 276: * 277: * @return the key 278: * @see #CONTROLLER_FOR 279: * @see #CONTROLLED_BY 280: * @see #LABEL_FOR 281: * @see #LABELED_BY 282: * @see #MEMBER_OF 283: */ 284: public String getKey() 285: { 286: return key; 287: } 288: 289: /** 290: * Return the targets of this relation. 291: * 292: * @return the targets, may be empty, but never null 293: */ 294: public Object[] getTarget() 295: { 296: return targets; 297: } 298: 299: /** 300: * Set the target to a single object. 301: * 302: * @param target the new target 303: */ 304: public void setTarget(Object target) 305: { 306: targets = new Object[] { target }; 307: } 308: 309: /** 310: * Set the target to an array of objects. 311: * 312: * @param targets the new targets 313: */ 314: public void setTarget(Object[] targets) 315: { 316: this.targets = targets == null ? EMPTY_TARGETS : targets; 317: } 318: } // class AccessibleRelation
GNU Classpath (0.95) |