jdk/src/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java
author yan
Fri, 20 Jun 2014 19:03:57 +0400
changeset 25152 4459bf7dab0b
parent 5506 202f599c92aa
child 25565 ce603b34c98d
permissions -rw-r--r--
8046445: Fix doclint warnings for javax.swing.plaf.multi Reviewed-by: alexsch Contributed-by: Alexander Stepanov <alexander.v.stepanov@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
25152
4459bf7dab0b 8046445: Fix doclint warnings for javax.swing.plaf.multi
yan
parents: 5506
diff changeset
     2
 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.swing.plaf.multi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.swing.plaf.SpinnerUI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.swing.plaf.ComponentUI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.swing.JComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.Graphics;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.Dimension;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.accessibility.Accessible;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * A multiplexing UI used to combine <code>SpinnerUI</code>s.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <p>This file was automatically generated by AutoMulti.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @author  Otto Multey
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
public class MultiSpinnerUI extends SpinnerUI {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * The vector containing the real UIs.  This is populated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * in the call to <code>createUI</code>, and can be obtained by calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * obtained from the default look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    protected Vector uis = new Vector();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
// Common UI methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Returns the list of UIs associated with this multiplexing UI.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * allows processing of the UIs by an application aware of multiplexing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * UIs on components.
25152
4459bf7dab0b 8046445: Fix doclint warnings for javax.swing.plaf.multi
yan
parents: 5506
diff changeset
    61
     *
4459bf7dab0b 8046445: Fix doclint warnings for javax.swing.plaf.multi
yan
parents: 5506
diff changeset
    62
     * @return an array of the UI delegates
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public ComponentUI[] getUIs() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        return MultiLookAndFeel.uisToArray(uis);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
// SpinnerUI methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
// ComponentUI methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * Invokes the <code>contains</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @return the value obtained from the first UI, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * the UI obtained from the default <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public boolean contains(JComponent a, int b, int c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        boolean returnValue =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        for (int i = 1; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        return returnValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * Invokes the <code>update</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public void update(Graphics a, JComponent b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        for (int i = 0; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            ((ComponentUI) (uis.elementAt(i))).update(a,b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * Returns a multiplexing UI instance if any of the auxiliary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <code>LookAndFeel</code>s supports this UI.  Otherwise, just returns the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * UI object obtained from the default <code>LookAndFeel</code>.
25152
4459bf7dab0b 8046445: Fix doclint warnings for javax.swing.plaf.multi
yan
parents: 5506
diff changeset
   104
     *
4459bf7dab0b 8046445: Fix doclint warnings for javax.swing.plaf.multi
yan
parents: 5506
diff changeset
   105
     * @param  a the component to create the UI for
4459bf7dab0b 8046445: Fix doclint warnings for javax.swing.plaf.multi
yan
parents: 5506
diff changeset
   106
     * @return the UI delegate created
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    public static ComponentUI createUI(JComponent a) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        ComponentUI mui = new MultiSpinnerUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        return MultiLookAndFeel.createUIs(mui,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                                          ((MultiSpinnerUI) mui).uis,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                                          a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Invokes the <code>installUI</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public void installUI(JComponent a) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        for (int i = 0; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            ((ComponentUI) (uis.elementAt(i))).installUI(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    public void uninstallUI(JComponent a) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        for (int i = 0; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * Invokes the <code>paint</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    public void paint(Graphics a, JComponent b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        for (int i = 0; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            ((ComponentUI) (uis.elementAt(i))).paint(a,b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @return the value obtained from the first UI, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * the UI obtained from the default <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    public Dimension getPreferredSize(JComponent a) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        Dimension returnValue =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        for (int i = 1; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        return returnValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * @return the value obtained from the first UI, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * the UI obtained from the default <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    public Dimension getMinimumSize(JComponent a) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        Dimension returnValue =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        for (int i = 1; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        return returnValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @return the value obtained from the first UI, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * the UI obtained from the default <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    public Dimension getMaximumSize(JComponent a) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        Dimension returnValue =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        for (int i = 1; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        return returnValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @return the value obtained from the first UI, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * the UI obtained from the default <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    public int getAccessibleChildrenCount(JComponent a) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        int returnValue =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        for (int i = 1; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        return returnValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * @return the value obtained from the first UI, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * the UI obtained from the default <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public Accessible getAccessibleChild(JComponent a, int b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        Accessible returnValue =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        for (int i = 1; i < uis.size(); i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        return returnValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
}