make/jdk/src/classes/build/tools/generatenimbus/Utils.java
author apetcher
Thu, 07 Jun 2018 13:59:53 -0400
branchJDK-8145252-TLS13-branch
changeset 56697 2dc6efcdeb11
parent 47216 71c04702a3d5
permissions -rw-r--r--
Making an inner class private in PskKeyExchamgeModesExtension
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3742
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21805
diff changeset
     2
 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3742
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
     4
 *
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
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: 3742
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
3742
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3742
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
3742
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    10
 *
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    15
 * accompanied this code).
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    16
 *
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3742
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3742
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3742
diff changeset
    23
 * questions.
3742
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    24
 */
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    25
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    26
package build.tools.generatenimbus;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    27
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    28
import java.util.ArrayList;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    29
import java.util.List;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    30
import javax.swing.plaf.synth.Region;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    31
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    32
public class Utils {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    33
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    34
    public static String escape(String s) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    35
        return s.replace("\"", "\\\"");
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    36
    }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    37
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    38
    public static String normalize(String s) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    39
        char[] src = s.toCharArray();
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    40
        StringBuilder buf = new StringBuilder();
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    41
        List<String> parts = new ArrayList<String>();
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    42
        boolean capitalize = false;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    43
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    44
        for (int i = 0; i < src.length; i++) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    45
            switch (src[i]) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    46
                case '\\':
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    47
                case '"':
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    48
                    break;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    49
                case '.':
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    50
                    capitalize = true;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    51
                    break;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    52
                case ':':
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    53
                    parts.add(buf.toString());
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    54
                    buf.delete(0, buf.length());
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    55
                    capitalize = true;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    56
                    break;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    57
                default:
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    58
                    buf.append(capitalize ? Character.toUpperCase(src[i]) : src[i]);
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    59
                    capitalize = false;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    60
                    break;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    61
            }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    62
        }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    63
        parts.add(buf.toString());
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    64
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    65
        // Try to optimize long class names by omitting repeating prefixes, e.g.
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    66
        // SliderTrackPainter.java instead of SliderSliderTrackPainter.java
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    67
        String result = parts.get(0);
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    68
        for (int i = 1; i < parts.size(); i++) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    69
            String part = parts.get(i);
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    70
            if (part.startsWith(result)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    71
                result = part;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    72
            } else {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    73
                result += part;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    74
            }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    75
        }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    76
        return result;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    77
    }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    78
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    79
    public static String regionNameToCaps(String regionName) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    80
        if (Region.ARROW_BUTTON.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    81
            return "ARROW_BUTTON";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    82
        } else if (Region.BUTTON.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    83
            return "BUTTON";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    84
        } else if (Region.CHECK_BOX.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    85
            return "CHECK_BOX";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    86
        } else if (Region.CHECK_BOX_MENU_ITEM.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    87
            return "CHECK_BOX_MENU_ITEM";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    88
        } else if (Region.COLOR_CHOOSER.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    89
            return "COLOR_CHOOSER";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    90
        } else if (Region.COMBO_BOX.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    91
            return "COMBO_BOX";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    92
        } else if (Region.DESKTOP_ICON.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    93
            return "DESKTOP_ICON";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    94
        } else if (Region.DESKTOP_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    95
            return "DESKTOP_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    96
        } else if (Region.EDITOR_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    97
            return "EDITOR_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    98
        } else if (Region.FILE_CHOOSER.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
    99
            return "FILE_CHOOSER";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   100
        } else if (Region.FORMATTED_TEXT_FIELD.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   101
            return "FORMATTED_TEXT_FIELD";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   102
        } else if (Region.INTERNAL_FRAME.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   103
            return "INTERNAL_FRAME";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   104
        } else if (Region.INTERNAL_FRAME_TITLE_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   105
            return "INTERNAL_FRAME_TITLE_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   106
        } else if (Region.LABEL.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   107
            return "LABEL";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   108
        } else if (Region.LIST.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   109
            return "LIST";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   110
        } else if (Region.MENU.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   111
            return "MENU";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   112
        } else if (Region.MENU_BAR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   113
            return "MENU_BAR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   114
        } else if (Region.MENU_ITEM.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   115
            return "MENU_ITEM";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   116
        } else if (Region.MENU_ITEM_ACCELERATOR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   117
            return "MENU_ITEM_ACCELERATOR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   118
        } else if (Region.OPTION_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   119
            return "OPTION_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   120
        } else if (Region.PANEL.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   121
            return "PANEL";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   122
        } else if (Region.PASSWORD_FIELD.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   123
            return "PASSWORD_FIELD";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   124
        } else if (Region.POPUP_MENU.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   125
            return "POPUP_MENU";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   126
        } else if (Region.POPUP_MENU_SEPARATOR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   127
            return "POPUP_MENU_SEPARATOR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   128
        } else if (Region.PROGRESS_BAR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   129
            return "PROGRESS_BAR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   130
        } else if (Region.RADIO_BUTTON.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   131
            return "RADIO_BUTTON";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   132
        } else if (Region.RADIO_BUTTON_MENU_ITEM.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   133
            return "RADIO_BUTTON_MENU_ITEM";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   134
        } else if (Region.ROOT_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   135
            return "ROOT_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   136
        } else if (Region.SCROLL_BAR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   137
            return "SCROLL_BAR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   138
        } else if (Region.SCROLL_BAR_THUMB.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   139
            return "SCROLL_BAR_THUMB";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   140
        } else if (Region.SCROLL_BAR_TRACK.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   141
            return "SCROLL_BAR_TRACK";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   142
        } else if (Region.SCROLL_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   143
            return "SCROLL_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   144
        } else if (Region.SEPARATOR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   145
            return "SEPARATOR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   146
        } else if (Region.SLIDER.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   147
            return "SLIDER";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   148
        } else if (Region.SLIDER_THUMB.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   149
            return "SLIDER_THUMB";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   150
        } else if (Region.SLIDER_TRACK.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   151
            return "SLIDER_TRACK";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   152
        } else if (Region.SPINNER.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   153
            return "SPINNER";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   154
        } else if (Region.SPLIT_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   155
            return "SPLIT_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   156
        } else if (Region.SPLIT_PANE_DIVIDER.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   157
            return "SPLIT_PANE_DIVIDER";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   158
        } else if (Region.TABBED_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   159
            return "TABBED_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   160
        } else if (Region.TABBED_PANE_CONTENT.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   161
            return "TABBED_PANE_CONTENT";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   162
        } else if (Region.TABBED_PANE_TAB.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   163
            return "TABBED_PANE_TAB";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   164
        } else if (Region.TABBED_PANE_TAB_AREA.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   165
            return "TABBED_PANE_TAB_AREA";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   166
        } else if (Region.TABLE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   167
            return "TABLE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   168
        } else if (Region.TABLE_HEADER.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   169
            return "TABLE_HEADER";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   170
        } else if (Region.TEXT_AREA.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   171
            return "TEXT_AREA";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   172
        } else if (Region.TEXT_FIELD.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   173
            return "TEXT_FIELD";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   174
        } else if (Region.TEXT_PANE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   175
            return "TEXT_PANE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   176
        } else if (Region.TOGGLE_BUTTON.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   177
            return "TOGGLE_BUTTON";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   178
        } else if (Region.TOOL_BAR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   179
            return "TOOL_BAR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   180
        } else if (Region.TOOL_BAR_CONTENT.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   181
            return "TOOL_BAR_CONTENT";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   182
        } else if (Region.TOOL_BAR_DRAG_WINDOW.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   183
            return "TOOL_BAR_DRAG_WINDOW";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   184
        } else if (Region.TOOL_BAR_SEPARATOR.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   185
            return "TOOL_BAR_SEPARATOR";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   186
        } else if (Region.TOOL_TIP.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   187
            return "TOOL_TIP";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   188
        } else if (Region.TREE.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   189
            return "TREE";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   190
        } else if (Region.TREE_CELL.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   191
            return "TREE_CELL";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   192
        } else if (Region.VIEWPORT.getName().equals(regionName)) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   193
            return "VIEWPORT";
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   194
        }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   195
        throw new RuntimeException("Bad Region name " + regionName);
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   196
    }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   197
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   198
    public static String statesToConstantName(String states) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   199
        String s = states.replace(" ", "");
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   200
        s = states.replace("+", "_");
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   201
        return s.toUpperCase();
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   202
    }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   203
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   204
    //takes a states string of the form Enabled+Foo+Bar.
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   205
    //removes any whitespace. Replaces the + signs with And.
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   206
    public static String statesToClassName(String states) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   207
        String s = states.replace(" ", "");
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   208
        s = states.replace("+", "And");
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   209
        return s;
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   210
    }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   211
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   212
    public static String formatDouble(String doubleValue) {
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   213
        return doubleValue.replace("INF", "Double.POSITIVE_INFINITY");
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   214
    }
5e1b8bc3cb1a 6844267: Nimbus generator depends on JIBX
peterz
parents:
diff changeset
   215
}