0N/A/*
2362N/A * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.accessibility;
0N/A
0N/Aimport java.util.Vector;
0N/Aimport java.util.Locale;
0N/Aimport java.util.MissingResourceException;
0N/Aimport java.util.ResourceBundle;
0N/A
0N/A/**
0N/A * <P>Class AccessibleRelation describes a relation between the
0N/A * object that implements the AccessibleRelation and one or more other
0N/A * objects. The actual relations that an object has with other
0N/A * objects are defined as an AccessibleRelationSet, which is a composed
0N/A * set of AccessibleRelations.
0N/A * <p>The toDisplayString method allows you to obtain the localized string
0N/A * for a locale independent key from a predefined ResourceBundle for the
0N/A * keys defined in this class.
0N/A * <p>The constants in this class present a strongly typed enumeration
0N/A * of common object roles. If the constants in this class are not sufficient
0N/A * to describe the role of an object, a subclass should be generated
0N/A * from this class and it should provide constants in a similar manner.
0N/A *
0N/A * @author Lynn Monsanto
0N/A * @since 1.3
0N/A */
0N/Apublic class AccessibleRelation extends AccessibleBundle {
0N/A
0N/A /*
0N/A * The group of objects that participate in the relation.
0N/A * The relation may be one-to-one or one-to-many. For
0N/A * example, in the case of a LABEL_FOR relation, the target
0N/A * vector would contain a list of objects labeled by the object
0N/A * that implements this AccessibleRelation. In the case of a
0N/A * MEMBER_OF relation, the target vector would contain all
0N/A * of the components that are members of the same group as the
0N/A * object that implements this AccessibleRelation.
0N/A */
0N/A private Object [] target = new Object[0];
0N/A
0N/A /**
0N/A * Indicates an object is a label for one or more target objects.
0N/A *
0N/A * @see #getTarget
0N/A * @see #CONTROLLER_FOR
0N/A * @see #CONTROLLED_BY
0N/A * @see #LABELED_BY
0N/A * @see #MEMBER_OF
0N/A */
0N/A public static final String LABEL_FOR = new String("labelFor");
0N/A
0N/A /**
0N/A * Indicates an object is labeled by one or more target objects.
0N/A *
0N/A * @see #getTarget
0N/A * @see #CONTROLLER_FOR
0N/A * @see #CONTROLLED_BY
0N/A * @see #LABEL_FOR
0N/A * @see #MEMBER_OF
0N/A */
0N/A public static final String LABELED_BY = new String("labeledBy");
0N/A
0N/A /**
0N/A * Indicates an object is a member of a group of one or more
0N/A * target objects.
0N/A *
0N/A * @see #getTarget
0N/A * @see #CONTROLLER_FOR
0N/A * @see #CONTROLLED_BY
0N/A * @see #LABEL_FOR
0N/A * @see #LABELED_BY
0N/A */
0N/A public static final String MEMBER_OF = new String("memberOf");
0N/A
0N/A /**
0N/A * Indicates an object is a controller for one or more target
0N/A * objects.
0N/A *
0N/A * @see #getTarget
0N/A * @see #CONTROLLED_BY
0N/A * @see #LABEL_FOR
0N/A * @see #LABELED_BY
0N/A * @see #MEMBER_OF
0N/A */
0N/A public static final String CONTROLLER_FOR = new String("controllerFor");
0N/A
0N/A /**
0N/A * Indicates an object is controlled by one or more target
0N/A * objects.
0N/A *
0N/A * @see #getTarget
0N/A * @see #CONTROLLER_FOR
0N/A * @see #LABEL_FOR
0N/A * @see #LABELED_BY
0N/A * @see #MEMBER_OF
0N/A */
0N/A public static final String CONTROLLED_BY = new String("controlledBy");
0N/A
0N/A /**
0N/A * Indicates an object is logically contiguous with a second
0N/A * object where the second object occurs after the object.
0N/A * An example is a paragraph of text that runs to the end of
0N/A * a page and continues on the next page with an intervening
0N/A * text footer and/or text header. The two parts of
0N/A * the paragraph are separate text elements but are related
0N/A * in that the second element is a continuation
0N/A * of the first
0N/A * element. In other words, the first element "flows to"
0N/A * the second element.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String FLOWS_TO = "flowsTo";
0N/A
0N/A /**
0N/A * Indicates an object is logically contiguous with a second
0N/A * object where the second object occurs before the object.
0N/A * An example is a paragraph of text that runs to the end of
0N/A * a page and continues on the next page with an intervening
0N/A * text footer and/or text header. The two parts of
0N/A * the paragraph are separate text elements but are related
0N/A * in that the second element is a continuation of the first
0N/A * element. In other words, the second element "flows from"
0N/A * the second element.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String FLOWS_FROM = "flowsFrom";
0N/A
0N/A /**
0N/A * Indicates that an object is a subwindow of one or more
0N/A * objects.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String SUBWINDOW_OF = "subwindowOf";
0N/A
0N/A /**
0N/A * Indicates that an object is a parent window of one or more
0N/A * objects.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String PARENT_WINDOW_OF = "parentWindowOf";
0N/A
0N/A /**
0N/A * Indicates that an object has one or more objects
0N/A * embedded in it.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String EMBEDS = "embeds";
0N/A
0N/A /**
0N/A * Indicates that an object is embedded in one or more
0N/A * objects.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String EMBEDDED_BY = "embeddedBy";
0N/A
0N/A /**
0N/A * Indicates that an object is a child node of one
0N/A * or more objects.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String CHILD_NODE_OF = "childNodeOf";
0N/A
0N/A /**
0N/A * Identifies that the target group for a label has changed
0N/A */
0N/A public static final String LABEL_FOR_PROPERTY = "labelForProperty";
0N/A
0N/A /**
0N/A * Identifies that the objects that are doing the labeling have changed
0N/A */
0N/A public static final String LABELED_BY_PROPERTY = "labeledByProperty";
0N/A
0N/A /**
0N/A * Identifies that group membership has changed.
0N/A */
0N/A public static final String MEMBER_OF_PROPERTY = "memberOfProperty";
0N/A
0N/A /**
0N/A * Identifies that the controller for the target object has changed
0N/A */
0N/A public static final String CONTROLLER_FOR_PROPERTY = "controllerForProperty";
0N/A
0N/A /**
0N/A * Identifies that the target object that is doing the controlling has
0N/A * changed
0N/A */
0N/A public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty";
0N/A
0N/A /**
0N/A * Indicates the FLOWS_TO relation between two objects
0N/A * has changed.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String FLOWS_TO_PROPERTY = "flowsToProperty";
0N/A
0N/A /**
0N/A * Indicates the FLOWS_FROM relation between two objects
0N/A * has changed.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty";
0N/A
0N/A /**
0N/A * Indicates the SUBWINDOW_OF relation between two or more objects
0N/A * has changed.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty";
0N/A
0N/A /**
0N/A * Indicates the PARENT_WINDOW_OF relation between two or more objects
0N/A * has changed.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String PARENT_WINDOW_OF_PROPERTY = "parentWindowOfProperty";
0N/A
0N/A /**
0N/A * Indicates the EMBEDS relation between two or more objects
0N/A * has changed.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String EMBEDS_PROPERTY = "embedsProperty";
0N/A
0N/A /**
0N/A * Indicates the EMBEDDED_BY relation between two or more objects
0N/A * has changed.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String EMBEDDED_BY_PROPERTY = "embeddedByProperty";
0N/A
0N/A /**
0N/A * Indicates the CHILD_NODE_OF relation between two or more objects
0N/A * has changed.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final String CHILD_NODE_OF_PROPERTY = "childNodeOfProperty";
0N/A
0N/A /**
0N/A * Create a new AccessibleRelation using the given locale independent key.
0N/A * The key String should be a locale independent key for the relation.
0N/A * It is not intended to be used as the actual String to display
0N/A * to the user. To get the localized string, use toDisplayString.
0N/A *
0N/A * @param key the locale independent name of the relation.
0N/A * @see AccessibleBundle#toDisplayString
0N/A */
0N/A public AccessibleRelation(String key) {
0N/A this.key = key;
0N/A this.target = null;
0N/A }
0N/A
0N/A /**
0N/A * Creates a new AccessibleRelation using the given locale independent key.
0N/A * The key String should be a locale independent key for the relation.
0N/A * It is not intended to be used as the actual String to display
0N/A * to the user. To get the localized string, use toDisplayString.
0N/A *
0N/A * @param key the locale independent name of the relation.
0N/A * @param target the target object for this relation
0N/A * @see AccessibleBundle#toDisplayString
0N/A */
0N/A public AccessibleRelation(String key, Object target) {
0N/A this.key = key;
0N/A this.target = new Object[1];
0N/A this.target[0] = target;
0N/A }
0N/A
0N/A /**
0N/A * Creates a new AccessibleRelation using the given locale independent key.
0N/A * The key String should be a locale independent key for the relation.
0N/A * It is not intended to be used as the actual String to display
0N/A * to the user. To get the localized string, use toDisplayString.
0N/A *
0N/A * @param key the locale independent name of the relation.
0N/A * @param target the target object(s) for this relation
0N/A * @see AccessibleBundle#toDisplayString
0N/A */
0N/A public AccessibleRelation(String key, Object [] target) {
0N/A this.key = key;
0N/A this.target = target;
0N/A }
0N/A
0N/A /**
0N/A * Returns the key for this relation
0N/A *
0N/A * @return the key for this relation
0N/A *
0N/A * @see #CONTROLLER_FOR
0N/A * @see #CONTROLLED_BY
0N/A * @see #LABEL_FOR
0N/A * @see #LABELED_BY
0N/A * @see #MEMBER_OF
0N/A */
0N/A public String getKey() {
0N/A return this.key;
0N/A }
0N/A
0N/A /**
0N/A * Returns the target objects for this relation
0N/A *
0N/A * @return an array containing the target objects for this relation
0N/A */
0N/A public Object [] getTarget() {
0N/A if (target == null) {
0N/A target = new Object[0];
0N/A }
0N/A Object [] retval = new Object[target.length];
0N/A for (int i = 0; i < target.length; i++) {
0N/A retval[i] = target[i];
0N/A }
0N/A return retval;
0N/A }
0N/A
0N/A /**
0N/A * Sets the target object for this relation
0N/A *
0N/A * @param target the target object for this relation
0N/A */
0N/A public void setTarget(Object target) {
0N/A this.target = new Object[1];
0N/A this.target[0] = target;
0N/A }
0N/A
0N/A /**
0N/A * Sets the target objects for this relation
0N/A *
0N/A * @param target an array containing the target objects for this relation
0N/A */
0N/A public void setTarget(Object [] target) {
0N/A this.target = target;
0N/A }
0N/A}