1/*
2 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package com.sun.java.accessibility.util.internal;
27
28import java.lang.*;
29import java.util.*;
30import java.awt.*;
31import java.awt.image.*;
32import javax.accessibility.*;
33import com.sun.java.accessibility.util.*;
34
35/**
36 * <p>The Translator class provides a translation to interface Accessible
37 * for objects that do not implement interface Accessible.  Assistive
38 * technologies can use the 'getAccessible' class method of Translator to
39 * obtain an object that implements interface Accessible.  If the object
40 * passed in already implements interface Accessible, getAccessible merely
41 * returns the object.
42 *
43 * <p>An example of how an assistive technology might use the Translator
44 * class is as follows:
45 *
46 * <PRE>
47 *    Accessible accessible = Translator.getAccessible(someObj);
48 *    // obtain information from the 'accessible' object.
49 * </PRE>
50 *
51 * <P>This class extends the Translator class to provide specific support
52 * for the Label class.  Translator.getAccessible() will automatically
53 * load this class when an assistive technology asks for an accessible
54 * translator for Label.
55 *
56 */
57public class LabelTranslator extends Translator {
58
59    public String getAccessibleName() {
60        return ((Label) source).getText();
61    }
62
63    /**
64     * Set the name of this object.
65     */
66    public void setAccessibleName(String s) {
67        ((Label) source).setText(s);
68    }
69
70    public AccessibleRole getAccessibleRole() {
71        return AccessibleRole.LABEL;
72    }
73}
74