jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java
author darcy
Sun, 23 Mar 2014 13:49:48 -0700
changeset 23697 e556a715949f
parent 5506 202f599c92aa
child 25792 80fae5c73cb9
permissions -rw-r--r--
8034169: Fix serial lint warnings in javax.swing Reviewed-by: alanb, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4394
diff changeset
     2
 * Copyright (c) 2002, 2008, 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: 4394
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: 4394
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: 4394
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4394
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4394
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.synth;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.swing.border.Border;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.swing.plaf.UIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.plaf.basic.BasicLookAndFeel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.swing.text.DefaultEditorKit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Map;
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
    35
import javax.swing.text.JTextComponent;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <code>SynthStyle</code> is a set of style properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * Each <code>SynthUI</code> references at least one
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <code>SynthStyle</code> that is obtained using a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <code>SynthStyleFactory</code>. You typically don't need to interact with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * this class directly, rather you will load a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <a href="doc-files/synthFileFormat.html">Synth File Format file</a> into
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <code>SynthLookAndFeel</code> that will create a set of SynthStyles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @see SynthLookAndFeel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @see SynthStyleFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @author Scott Violet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public abstract class SynthStyle {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * Contains the default values for certain properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     */
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 2
diff changeset
    56
    private static Map<Object, Object> DEFAULT_VALUES;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * Shared SynthGraphics.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private static final SynthGraphicsUtils SYNTH_GRAPHICS =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                              new SynthGraphicsUtils();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Adds the default values that we know about to DEFAULT_VALUES.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private static void populateDefaultValues() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        Object buttonMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                          "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                 "released SPACE", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        DEFAULT_VALUES.put("Button.focusInputMap", buttonMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        DEFAULT_VALUES.put("CheckBox.focusInputMap", buttonMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        DEFAULT_VALUES.put("RadioButton.focusInputMap", buttonMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        DEFAULT_VALUES.put("ToggleButton.focusInputMap", buttonMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        DEFAULT_VALUES.put("SynthArrowButton.focusInputMap", buttonMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        DEFAULT_VALUES.put("List.dropLineColor", Color.BLACK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        DEFAULT_VALUES.put("Tree.dropLineColor", Color.BLACK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        DEFAULT_VALUES.put("Table.dropLineColor", Color.BLACK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        DEFAULT_VALUES.put("Table.dropLineShortColor", Color.RED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                           "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                           "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                           "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                             "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                              "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                   "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                     "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                     "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                           "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                             "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                              "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                        "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                               "UP", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                            "KP_UP", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                             "DOWN", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                          "KP_DOWN", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                          "PAGE_UP", DefaultEditorKit.pageUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                        "PAGE_DOWN", DefaultEditorKit.pageDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                    "shift PAGE_UP", "selection-page-up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                  "shift PAGE_DOWN", "selection-page-down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
               "ctrl shift PAGE_UP", "selection-page-left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
             "ctrl shift PAGE_DOWN", "selection-page-right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                         "shift UP", DefaultEditorKit.selectionUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                      "shift KP_UP", DefaultEditorKit.selectionUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                       "shift DOWN", DefaultEditorKit.selectionDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                    "shift KP_DOWN", DefaultEditorKit.selectionDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                            "ENTER", DefaultEditorKit.insertBreakAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                           "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                      "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                  "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                             "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                         "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                          "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                              "TAB", DefaultEditorKit.insertTabAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                  "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                        "ctrl HOME", DefaultEditorKit.beginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                         "ctrl END", DefaultEditorKit.endAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                  "ctrl shift HOME", DefaultEditorKit.selectionBeginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                   "ctrl shift END", DefaultEditorKit.selectionEndAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                           "ctrl T", "next-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                     "ctrl shift T", "previous-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                       "ctrl SPACE", "activate-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                   "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        DEFAULT_VALUES.put("EditorPane.focusInputMap", multilineInputMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        DEFAULT_VALUES.put("TextArea.focusInputMap", multilineInputMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        DEFAULT_VALUES.put("TextPane.focusInputMap", multilineInputMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                           "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                           "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                           "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                             "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                              "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                   "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                     "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                     "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                           "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                             "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                              "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                        "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                           "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                      "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                  "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                             "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                         "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                          "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                            "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                  "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                   "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        DEFAULT_VALUES.put("TextField.focusInputMap", fieldInputMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        DEFAULT_VALUES.put("PasswordField.focusInputMap", fieldInputMap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        DEFAULT_VALUES.put("ComboBox.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                  new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                     "ESCAPE", "hidePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                    "PAGE_UP", "pageUpPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                  "PAGE_DOWN", "pageDownPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                       "HOME", "homePassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                        "END", "endPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                       "DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                    "KP_DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                   "alt DOWN", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                "alt KP_DOWN", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                     "alt UP", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                  "alt KP_UP", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                      "SPACE", "spacePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                     "ENTER", "enterPressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                         "UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                      "KP_UP", "selectPrevious"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                  }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        DEFAULT_VALUES.put("Desktop.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                 "ctrl F5", "restore",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                 "ctrl F4", "close",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                 "ctrl F7", "move",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                 "ctrl F8", "resize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                   "RIGHT", "right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                "KP_RIGHT", "right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
             "shift RIGHT", "shrinkRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
          "shift KP_RIGHT", "shrinkRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                    "LEFT", "left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                 "KP_LEFT", "left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
              "shift LEFT", "shrinkLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
           "shift KP_LEFT", "shrinkLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                      "UP", "up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                   "KP_UP", "up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                "shift UP", "shrinkUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
             "shift KP_UP", "shrinkUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                    "DOWN", "down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                 "KP_DOWN", "down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
              "shift DOWN", "shrinkDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
           "shift KP_DOWN", "shrinkDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                  "ESCAPE", "escape",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                 "ctrl F9", "minimize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                "ctrl F10", "maximize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                 "ctrl F6", "selectNextFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                "ctrl TAB", "selectNextFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
             "ctrl alt F6", "selectNextFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
       "shift ctrl alt F6", "selectPreviousFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                "ctrl F12", "navigateNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
           "shift ctrl F12", "navigatePrevious"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        DEFAULT_VALUES.put("FileChooser.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                     "ESCAPE", "cancelSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                     "F2", "editFileName",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                     "F5", "refresh",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                     "BACK_SPACE", "Go Up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                     "ENTER", "approveSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                "ctrl ENTER", "approveSelection"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        DEFAULT_VALUES.put("FormattedTextField.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
              new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                           "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                           "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                           "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                             "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                              "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                   "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                     "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                     "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                           "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                             "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                              "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                        "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                           "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                      "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                  "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
                            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                             "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                         "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                          "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                            "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                  "ctrl BACK_SLASH", "unselect",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                   "control shift O", "toggle-componentOrientation",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                           "ESCAPE", "reset-field-edit",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                               "UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                            "KP_UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                             "DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                          "KP_DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
              }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        DEFAULT_VALUES.put("InternalFrame.icon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                           LookAndFeel.makeIcon(BasicLookAndFeel.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                                                    "icons/JavaCup16.png"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        DEFAULT_VALUES.put("InternalFrame.windowBindings",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
              "shift ESCAPE", "showSystemMenu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                "ctrl SPACE", "showSystemMenu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
              "ESCAPE", "hideSystemMenu"});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        DEFAULT_VALUES.put("List.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                           "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                           "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                           "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                             "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                            "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                              "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                   "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                     "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                     "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                               "UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                            "KP_UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                         "shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                      "shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                    "ctrl shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
                 "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                          "ctrl UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                       "ctrl KP_UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                             "DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                          "KP_DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                       "shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                    "shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                  "ctrl shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
               "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
                        "ctrl DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
                     "ctrl KP_DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                             "LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                          "KP_LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                       "shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                    "shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
                  "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
               "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                        "ctrl LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                     "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                            "RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                         "KP_RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                      "shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                   "shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                 "ctrl shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
              "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                       "ctrl RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                    "ctrl KP_RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
                             "HOME", "selectFirstRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
                       "shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
                  "ctrl shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                        "ctrl HOME", "selectFirstRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                              "END", "selectLastRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
                        "shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
                   "ctrl shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
                         "ctrl END", "selectLastRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
                          "PAGE_UP", "scrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                    "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
               "ctrl shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                     "ctrl PAGE_UP", "scrollUpChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                        "PAGE_DOWN", "scrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                  "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
             "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                   "ctrl PAGE_DOWN", "scrollDownChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                           "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                       "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                  "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                            "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                       "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                      "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                 "ctrl shift SPACE", "moveSelectionTo"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        DEFAULT_VALUES.put("List.focusInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                             "LEFT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                          "KP_LEFT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
                       "shift LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
                    "shift KP_LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
                  "ctrl shift LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
               "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                        "ctrl LEFT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
                     "ctrl KP_LEFT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
                            "RIGHT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
                         "KP_RIGHT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                      "shift RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                   "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
              "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                       "ctrl RIGHT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                    "ctrl KP_RIGHT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        DEFAULT_VALUES.put("MenuBar.windowBindings",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                                new Object[] { "F10", "takeFocus" });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        DEFAULT_VALUES.put("OptionPane.windowBindings",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                 new Object[] { "ESCAPE", "close" });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        DEFAULT_VALUES.put("RootPane.defaultButtonWindowKeyBindings",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
                 new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
                             "ENTER", "press",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                    "released ENTER", "release",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                        "ctrl ENTER", "press",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
               "ctrl released ENTER", "release"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
                 });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        DEFAULT_VALUES.put("RootPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                    "shift F10", "postPopup"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        DEFAULT_VALUES.put("ScrollBar.anecstorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                       "RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                    "KP_RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                        "DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                     "KP_DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                   "PAGE_DOWN", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
                        "LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                     "KP_LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                          "UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                       "KP_UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                     "PAGE_UP", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                        "HOME", "minScroll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                         "END", "maxScroll"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        DEFAULT_VALUES.put("ScrollBar.ancestorInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                       "RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                    "KP_RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                        "LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                     "KP_LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        DEFAULT_VALUES.put("ScrollPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                           "RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                        "KP_RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                            "DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                         "KP_DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
                            "LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
                         "KP_LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
                              "UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
                           "KP_UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                         "PAGE_UP", "scrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                       "PAGE_DOWN", "scrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                    "ctrl PAGE_UP", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                  "ctrl PAGE_DOWN", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
                       "ctrl HOME", "scrollHome",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
                        "ctrl END", "scrollEnd"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        DEFAULT_VALUES.put("ScrollPane.ancestorInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
                    "ctrl PAGE_UP", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
                  "ctrl PAGE_DOWN", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        DEFAULT_VALUES.put("SplitPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
                        "UP", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
                      "DOWN", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
                      "LEFT", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                     "RIGHT", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                     "KP_UP", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
                   "KP_DOWN", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
                   "KP_LEFT", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
                  "KP_RIGHT", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
                      "HOME", "selectMin",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
                       "END", "selectMax",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
                        "F8", "startResize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
                        "F6", "toggleFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
                  "ctrl TAB", "focusOutForward",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            "ctrl shift TAB", "focusOutBackward"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        DEFAULT_VALUES.put("Spinner.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                          "UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                       "KP_UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
                        "DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                     "KP_DOWN", "decrement"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        DEFAULT_VALUES.put("Slider.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
                       "RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
                    "KP_RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
                        "DOWN", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
                     "KP_DOWN", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
                   "PAGE_DOWN", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
              "ctrl PAGE_DOWN", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
                        "LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
                     "KP_LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
                          "UP", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
                       "KP_UP", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
                     "PAGE_UP", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
                "ctrl PAGE_UP", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
                        "HOME", "minScroll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
                         "END", "maxScroll"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        DEFAULT_VALUES.put("Slider.focusInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
                       "RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
                    "KP_RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
                        "LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                     "KP_LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        DEFAULT_VALUES.put("TabbedPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
                   "ctrl PAGE_DOWN", "navigatePageDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
                     "ctrl PAGE_UP", "navigatePageUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
                          "ctrl UP", "requestFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
                       "ctrl KP_UP", "requestFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        DEFAULT_VALUES.put("TabbedPane.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
              new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
                         "RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
                      "KP_RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
                          "LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
                       "KP_LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
                            "UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
                         "KP_UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
                          "DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
                       "KP_DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
                     "ctrl DOWN", "requestFocusForVisibleComponent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
                  "ctrl KP_DOWN", "requestFocusForVisibleComponent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
              }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        DEFAULT_VALUES.put("Table.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
                               "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
                               "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
                               "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
                                 "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
                                "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                                  "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
                       "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
                         "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
                         "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
                                "RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
                             "KP_RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
                          "shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
                       "shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
                     "ctrl shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
                  "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
                           "ctrl RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
                        "ctrl KP_RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
                                 "LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
                              "KP_LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
                           "shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
                        "shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
                      "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
                   "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
                            "ctrl LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
                         "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
                                 "DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
                              "KP_DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
                           "shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
                        "shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
                      "ctrl shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
                   "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
                            "ctrl DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
                         "ctrl KP_DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
                                   "UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
                                "KP_UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
                             "shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
                          "shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
                        "ctrl shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
                     "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
                              "ctrl UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
                           "ctrl KP_UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
                                 "HOME", "selectFirstColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
                           "shift HOME", "selectFirstColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
                      "ctrl shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
                            "ctrl HOME", "selectFirstRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
                                  "END", "selectLastColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
                            "shift END", "selectLastColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
                       "ctrl shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
                             "ctrl END", "selectLastRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
                              "PAGE_UP", "scrollUpChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
                        "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
                   "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
                         "ctrl PAGE_UP", "scrollLeftChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
                            "PAGE_DOWN", "scrollDownChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
                      "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
                 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
                       "ctrl PAGE_DOWN", "scrollRightChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
                                  "TAB", "selectNextColumnCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
                            "shift TAB", "selectPreviousColumnCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
                                "ENTER", "selectNextRowCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
                          "shift ENTER", "selectPreviousRowCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
                               "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
                           "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
                      "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
                               "ESCAPE", "cancel",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
                                   "F2", "startEditing",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
                                "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
                           "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
                          "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
                     "ctrl shift SPACE", "moveSelectionTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
                                   "F8", "focusHeader"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
       DEFAULT_VALUES.put("TableHeader.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
                                "SPACE", "toggleSortOrder",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
                                 "LEFT", "selectColumnToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
                              "KP_LEFT", "selectColumnToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
                                "RIGHT", "selectColumnToRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
                             "KP_RIGHT", "selectColumnToRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
                             "alt LEFT", "moveColumnLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
                          "alt KP_LEFT", "moveColumnLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
                            "alt RIGHT", "moveColumnRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
                         "alt KP_RIGHT", "moveColumnRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
                       "alt shift LEFT", "resizeLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
                    "alt shift KP_LEFT", "resizeLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
                      "alt shift RIGHT", "resizeRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
                   "alt shift KP_RIGHT", "resizeRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
                               "ESCAPE", "focusTable",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        DEFAULT_VALUES.put("Tree.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
                     "ESCAPE", "cancel"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        DEFAULT_VALUES.put("Tree.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
                                    "ADD", "expand",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
                               "SUBTRACT", "collapse",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
                                 "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
                                 "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
                                 "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
                                   "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
                                  "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
                                    "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
                         "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
                           "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
                           "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
                                     "UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
                                  "KP_UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
                               "shift UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
                            "shift KP_UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
                          "ctrl shift UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
                       "ctrl shift KP_UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
                                "ctrl UP", "selectPreviousChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
                             "ctrl KP_UP", "selectPreviousChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                                   "DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                                "KP_DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
                             "shift DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
                          "shift KP_DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                        "ctrl shift DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                     "ctrl shift KP_DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
                              "ctrl DOWN", "selectNextChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
                           "ctrl KP_DOWN", "selectNextChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
                                  "RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
                               "KP_RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
                                   "LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
                                "KP_LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
                                "PAGE_UP", "scrollUpChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
                          "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                     "ctrl shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                           "ctrl PAGE_UP", "scrollUpChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                              "PAGE_DOWN", "scrollDownChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                        "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                   "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
                         "ctrl PAGE_DOWN", "scrollDownChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
                                   "HOME", "selectFirst",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
                             "shift HOME", "selectFirstExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
                        "ctrl shift HOME", "selectFirstExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
                              "ctrl HOME", "selectFirstChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                                    "END", "selectLast",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
                              "shift END", "selectLastExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
                         "ctrl shift END", "selectLastExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
                               "ctrl END", "selectLastChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
                                     "F2", "startEditing",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
                                 "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
                             "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
                        "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
                              "ctrl LEFT", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
                           "ctrl KP_LEFT", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
                             "ctrl RIGHT", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
                          "ctrl KP_RIGHT", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
                                  "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
                             "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
                            "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                       "ctrl shift SPACE", "moveSelectionTo"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
        DEFAULT_VALUES.put("Tree.focusInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
                                  "RIGHT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
                               "KP_RIGHT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                                   "LEFT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
                                "KP_LEFT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
               }));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     * Returns the default value for the specified property, or null if there
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * is no default for the specified value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
    private static Object getDefaultValue(Object key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
        synchronized(SynthStyle.class) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
            if (DEFAULT_VALUES == null) {
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 2
diff changeset
   718
                DEFAULT_VALUES = new HashMap<Object, Object>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
                populateDefaultValues();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
            Object value = DEFAULT_VALUES.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
            if (value instanceof UIDefaults.LazyValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                value = ((UIDefaults.LazyValue)value).createValue(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
                DEFAULT_VALUES.put(key, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
            return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     * Constructs a SynthStyle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    public SynthStyle() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * Returns the <code>SynthGraphicUtils</code> for the specified context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * @return SynthGraphicsUtils
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
    public SynthGraphicsUtils getGraphicsUtils(SynthContext context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
        return SYNTH_GRAPHICS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * Returns the color for the specified state. This gives precedence to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     * foreground and background of the <code>JComponent</code>. If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * <code>Color</code> from the <code>JComponent</code> is not appropriate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * or not used, this will invoke <code>getColorForState</code>. Subclasses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * should generally not have to override this, instead override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     * {@link #getColorForState}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * @param type Type of color being requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * @return Color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
    public Color getColor(SynthContext context, ColorType type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
        JComponent c = context.getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
        Region id = context.getRegion();
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   761
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   762
        if ((context.getComponentState() & SynthConstants.DISABLED) != 0) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   763
            //This component is disabled, so return the disabled color.
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   764
            //In some cases this means ignoring the color specified by the
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   765
            //developer on the component. In other cases it means using a
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   766
            //specified disabledTextColor, such as on JTextComponents.
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   767
            //For example, JLabel doesn't specify a disabled color that the
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   768
            //developer can set, yet it should have a disabled color to the
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   769
            //text when the label is disabled. This code allows for that.
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   770
            if (c instanceof JTextComponent) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   771
                JTextComponent txt = (JTextComponent)c;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   772
                Color disabledColor = txt.getDisabledTextColor();
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   773
                if (disabledColor == null || disabledColor instanceof UIResource) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   774
                    return getColorForState(context, type);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   775
                }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   776
            } else if (c instanceof JLabel &&
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   777
                            (type == ColorType.FOREGROUND ||
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   778
                             type == ColorType.TEXT_FOREGROUND)) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   779
                return getColorForState(context, type);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   780
            }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   781
        }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   782
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   783
        // If the developer has specified a color, prefer it. Otherwise, get
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   784
        // the color for the state.
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   785
        Color color = null;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   786
        if (!id.isSubregion()) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
            if (type == ColorType.BACKGROUND) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   788
                color = c.getBackground();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
            else if (type == ColorType.FOREGROUND) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   791
                color = c.getForeground();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
            else if (type == ColorType.TEXT_FOREGROUND) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   794
                color = c.getForeground();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
        }
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   797
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   798
        if (color == null || color instanceof UIResource) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   799
            // Then use what we've locally defined
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   800
            color = getColorForState(context, type);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   801
        }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1639
diff changeset
   802
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
        if (color == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
            // No color, fallback to that of the widget.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
            if (type == ColorType.BACKGROUND ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
                        type == ColorType.TEXT_BACKGROUND) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
                return c.getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
            else if (type == ColorType.FOREGROUND ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
                     type == ColorType.TEXT_FOREGROUND) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
                return c.getForeground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
        return color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * Returns the color for the specified state. This should NOT call any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * methods on the <code>JComponent</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     * @param type Type of color being requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
     * @return Color to render with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
    protected abstract Color getColorForState(SynthContext context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
                                              ColorType type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     * Returns the Font for the specified state. This redirects to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     * <code>JComponent</code> from the <code>context</code> as necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     * If this does not redirect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * to the JComponent {@link #getFontForState} is invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * @return Font to render with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
    public Font getFont(SynthContext context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
        JComponent c = context.getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
        if (context.getComponentState() == SynthConstants.ENABLED) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
            return c.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
        Font cFont = c.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
        if (cFont != null && !(cFont instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
            return cFont;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
        return getFontForState(context);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
     * Returns the font for the specified state. This should NOT call any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * method on the <code>JComponent</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     * @return Font to render with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    protected abstract Font getFontForState(SynthContext context);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     * Returns the Insets that are used to calculate sizing information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     * @param insets Insets to place return value in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     * @return Sizing Insets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
    public Insets getInsets(SynthContext context, Insets insets) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
        if (insets == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
            insets = new Insets(0, 0, 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
        insets.top = insets.bottom = insets.left = insets.right = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
        return insets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
     * Returns the <code>SynthPainter</code> that will be used for painting.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     * This may return null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
     * @return SynthPainter to use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
    public SynthPainter getPainter(SynthContext context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
     * Returns true if the region is opaque.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * @return true if region is opaque.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
    public boolean isOpaque(SynthContext context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * Getter for a region specific style property.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
     * @param key Property being requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * @return Value of the named property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
    public Object get(SynthContext context, Object key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
        return getDefaultValue(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
    void installDefaults(SynthContext context, SynthUI ui) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
        // Special case the Border as this will likely change when the LAF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
        // can have more control over this.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
        if (!context.isSubregion()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
            JComponent c = context.getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
            Border border = c.getBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
            if (border == null || border instanceof UIResource) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
                c.setBorder(new SynthBorder(ui, getInsets(context, null)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
        installDefaults(context);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
     * Installs the necessary state from this Style on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
     * <code>JComponent</code> from <code>context</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     * @param context SynthContext identifying component to install properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     *        to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
    public void installDefaults(SynthContext context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
        if (!context.isSubregion()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
            JComponent c = context.getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
            Region region = context.getRegion();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
            Font font = c.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
            if (font == null || (font instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
                c.setFont(getFontForState(context));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
            Color background = c.getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
            if (background == null || (background instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
                c.setBackground(getColorForState(context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
                                                 ColorType.BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
            Color foreground = c.getForeground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
            if (foreground == null || (foreground instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
                c.setForeground(getColorForState(context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
                         ColorType.FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
            LookAndFeel.installProperty(c, "opaque", Boolean.valueOf(isOpaque(context)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     * Uninstalls any state that this style installed on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * the <code>JComponent</code> from <code>context</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * Styles should NOT depend upon this being called, in certain cases
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     * it may never be called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     * @param context SynthContext identifying component to install properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
     *        to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
    public void uninstallDefaults(SynthContext context) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
        if (!context.isSubregion()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
            // NOTE: because getForeground, getBackground and getFont will look
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
            // at the parent Container, if we set them to null it may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
            // mean we they return a non-null and non-UIResource value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
            // preventing install from correctly settings its colors/font. For
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
            // this reason we do not uninstall the fg/bg/font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
            JComponent c = context.getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
            Border border = c.getBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
            if (border instanceof UIResource) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
                c.setBorder(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     * Convenience method to get a specific style property whose value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     * a <code>Number</code>. If the value is a <code>Number</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     * <code>intValue</code> is returned, otherwise <code>defaultValue</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     * is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * @param key Property being requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     * @param defaultValue Value to return if the property has not been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     *        specified, or is not a Number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     * @return Value of the named property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
    public int getInt(SynthContext context, Object key, int defaultValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
        Object value = get(context, key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
        if (value instanceof Number) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
            return ((Number)value).intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
        return defaultValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * Convenience method to get a specific style property whose value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * an Boolean.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     * @param key Property being requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     * @param defaultValue Value to return if the property has not been
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     *        specified, or is not a Boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * @return Value of the named property
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
    public boolean getBoolean(SynthContext context, Object key,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
                              boolean defaultValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
        Object value = get(context, key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
        if (value instanceof Boolean) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
            return ((Boolean)value).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
        return defaultValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     * Convenience method to get a specific style property whose value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
     * an Icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     * @param key Property being requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * @return Value of the named property, or null if not specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
    public Icon getIcon(SynthContext context, Object key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
        Object value = get(context, key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
        if (value instanceof Icon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
            return (Icon)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
     * Convenience method to get a specific style property whose value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
     * a String.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
     * @param context SynthContext identifying requester
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
     * @param key Property being requested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     * @param defaultValue Value to return if the property has not been
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     *        specified, or is not a String
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     * @return Value of the named property
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
    public String getString(SynthContext context, Object key,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
                              String defaultValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
        Object value = get(context, key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
        if (value instanceof String) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
            return (String)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
        return defaultValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
}