author | alexsch |
Wed, 18 Nov 2015 19:13:42 +0400 | |
changeset 34407 | 2b40f400a30b |
parent 25859 | 3317bb8137f4 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
25565
ce603b34c98d
8043548: Fix raw and unchecked lint warnings in javax.swing.plaf.*
darcy
parents:
23010
diff
changeset
|
2 |
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
package javax.swing.plaf.synth; |
|
26 |
||
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
27 |
import sun.awt.AppContext; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
28 |
|
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
29 |
import java.util.HashMap; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
30 |
import java.util.Locale; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
31 |
import java.util.Map; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
32 |
import javax.swing.JComponent; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
33 |
import javax.swing.UIDefaults; |
2 | 34 |
|
35 |
/** |
|
36 |
* A distinct rendering area of a Swing component. A component may |
|
37 |
* support one or more regions. Specific component regions are defined |
|
38 |
* by the typesafe enumeration in this class. |
|
39 |
* <p> |
|
40 |
* Regions are typically used as a way to identify the <code>Component</code>s |
|
41 |
* and areas a particular style is to apply to. Synth's file format allows you |
|
42 |
* to bind styles based on the name of a <code>Region</code>. |
|
43 |
* The name is derived from the field name of the constant: |
|
44 |
* <ol> |
|
45 |
* <li>Map all characters to lowercase. |
|
46 |
* <li>Map the first character to uppercase. |
|
47 |
* <li>Map the first character after underscores to uppercase. |
|
48 |
* <li>Remove all underscores. |
|
49 |
* </ol> |
|
50 |
* For example, to identify the <code>SPLIT_PANE</code> |
|
51 |
* <code>Region</code> you would use <code>SplitPane</code>. |
|
52 |
* The following shows a custom <code>SynthStyleFactory</code> |
|
53 |
* that returns a specific style for split panes: |
|
54 |
* <pre> |
|
55 |
* public SynthStyle getStyle(JComponent c, Region id) { |
|
56 |
* if (id == Region.SPLIT_PANE) { |
|
57 |
* return splitPaneStyle; |
|
58 |
* } |
|
59 |
* ... |
|
60 |
* } |
|
61 |
* </pre> |
|
62 |
* The following <a href="doc-files/synthFileFormat.html">xml</a> |
|
63 |
* accomplishes the same thing: |
|
64 |
* <pre> |
|
20169 | 65 |
* <style id="splitPaneStyle"> |
2 | 66 |
* ... |
20169 | 67 |
* </style> |
68 |
* <bind style="splitPaneStyle" type="region" key="SplitPane"/> |
|
2 | 69 |
* </pre> |
70 |
* |
|
71 |
* @since 1.5 |
|
72 |
* @author Scott Violet |
|
73 |
*/ |
|
74 |
public class Region { |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
75 |
private static final Object UI_TO_REGION_MAP_KEY = new Object(); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
76 |
private static final Object LOWER_CASE_NAME_MAP_KEY = new Object(); |
2 | 77 |
|
78 |
/** |
|
79 |
* ArrowButton's are special types of buttons that also render a |
|
80 |
* directional indicator, typically an arrow. ArrowButtons are used by |
|
81 |
* composite components, for example ScrollBar's contain ArrowButtons. |
|
82 |
* To bind a style to this <code>Region</code> use the name |
|
83 |
* <code>ArrowButton</code>. |
|
84 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
85 |
public static final Region ARROW_BUTTON = new Region("ArrowButton", false); |
2 | 86 |
|
87 |
/** |
|
88 |
* Button region. To bind a style to this <code>Region</code> use the name |
|
89 |
* <code>Button</code>. |
|
90 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
91 |
public static final Region BUTTON = new Region("Button", false); |
2 | 92 |
|
93 |
/** |
|
94 |
* CheckBox region. To bind a style to this <code>Region</code> use the name |
|
95 |
* <code>CheckBox</code>. |
|
96 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
97 |
public static final Region CHECK_BOX = new Region("CheckBox", false); |
2 | 98 |
|
99 |
/** |
|
100 |
* CheckBoxMenuItem region. To bind a style to this <code>Region</code> use |
|
101 |
* the name <code>CheckBoxMenuItem</code>. |
|
102 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
103 |
public static final Region CHECK_BOX_MENU_ITEM = new Region("CheckBoxMenuItem", false); |
2 | 104 |
|
105 |
/** |
|
106 |
* ColorChooser region. To bind a style to this <code>Region</code> use |
|
107 |
* the name <code>ColorChooser</code>. |
|
108 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
109 |
public static final Region COLOR_CHOOSER = new Region("ColorChooser", false); |
2 | 110 |
|
111 |
/** |
|
112 |
* ComboBox region. To bind a style to this <code>Region</code> use |
|
113 |
* the name <code>ComboBox</code>. |
|
114 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
115 |
public static final Region COMBO_BOX = new Region("ComboBox", false); |
2 | 116 |
|
117 |
/** |
|
118 |
* DesktopPane region. To bind a style to this <code>Region</code> use |
|
119 |
* the name <code>DesktopPane</code>. |
|
120 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
121 |
public static final Region DESKTOP_PANE = new Region("DesktopPane", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
122 |
|
2 | 123 |
/** |
124 |
* DesktopIcon region. To bind a style to this <code>Region</code> use |
|
125 |
* the name <code>DesktopIcon</code>. |
|
126 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
127 |
public static final Region DESKTOP_ICON = new Region("DesktopIcon", false); |
2 | 128 |
|
129 |
/** |
|
130 |
* EditorPane region. To bind a style to this <code>Region</code> use |
|
131 |
* the name <code>EditorPane</code>. |
|
132 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
133 |
public static final Region EDITOR_PANE = new Region("EditorPane", false); |
2 | 134 |
|
135 |
/** |
|
136 |
* FileChooser region. To bind a style to this <code>Region</code> use |
|
137 |
* the name <code>FileChooser</code>. |
|
138 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
139 |
public static final Region FILE_CHOOSER = new Region("FileChooser", false); |
2 | 140 |
|
141 |
/** |
|
142 |
* FormattedTextField region. To bind a style to this <code>Region</code> use |
|
143 |
* the name <code>FormattedTextField</code>. |
|
144 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
145 |
public static final Region FORMATTED_TEXT_FIELD = new Region("FormattedTextField", false); |
2 | 146 |
|
147 |
/** |
|
148 |
* InternalFrame region. To bind a style to this <code>Region</code> use |
|
149 |
* the name <code>InternalFrame</code>. |
|
150 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
151 |
public static final Region INTERNAL_FRAME = new Region("InternalFrame", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
152 |
|
2 | 153 |
/** |
154 |
* TitlePane of an InternalFrame. The TitlePane typically |
|
155 |
* shows a menu, title, widgets to manipulate the internal frame. |
|
156 |
* To bind a style to this <code>Region</code> use the name |
|
157 |
* <code>InternalFrameTitlePane</code>. |
|
158 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
159 |
public static final Region INTERNAL_FRAME_TITLE_PANE = new Region("InternalFrameTitlePane", false); |
2 | 160 |
|
161 |
/** |
|
162 |
* Label region. To bind a style to this <code>Region</code> use the name |
|
163 |
* <code>Label</code>. |
|
164 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
165 |
public static final Region LABEL = new Region("Label", false); |
2 | 166 |
|
167 |
/** |
|
168 |
* List region. To bind a style to this <code>Region</code> use the name |
|
169 |
* <code>List</code>. |
|
170 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
171 |
public static final Region LIST = new Region("List", false); |
2 | 172 |
|
173 |
/** |
|
174 |
* Menu region. To bind a style to this <code>Region</code> use the name |
|
175 |
* <code>Menu</code>. |
|
176 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
177 |
public static final Region MENU = new Region("Menu", false); |
2 | 178 |
|
179 |
/** |
|
180 |
* MenuBar region. To bind a style to this <code>Region</code> use the name |
|
181 |
* <code>MenuBar</code>. |
|
182 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
183 |
public static final Region MENU_BAR = new Region("MenuBar", false); |
2 | 184 |
|
185 |
/** |
|
186 |
* MenuItem region. To bind a style to this <code>Region</code> use the name |
|
187 |
* <code>MenuItem</code>. |
|
188 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
189 |
public static final Region MENU_ITEM = new Region("MenuItem", false); |
2 | 190 |
|
191 |
/** |
|
192 |
* Accelerator region of a MenuItem. To bind a style to this |
|
193 |
* <code>Region</code> use the name <code>MenuItemAccelerator</code>. |
|
194 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
195 |
public static final Region MENU_ITEM_ACCELERATOR = new Region("MenuItemAccelerator", true); |
2 | 196 |
|
197 |
/** |
|
198 |
* OptionPane region. To bind a style to this <code>Region</code> use |
|
199 |
* the name <code>OptionPane</code>. |
|
200 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
201 |
public static final Region OPTION_PANE = new Region("OptionPane", false); |
2 | 202 |
|
203 |
/** |
|
204 |
* Panel region. To bind a style to this <code>Region</code> use the name |
|
205 |
* <code>Panel</code>. |
|
206 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
207 |
public static final Region PANEL = new Region("Panel", false); |
2 | 208 |
|
209 |
/** |
|
210 |
* PasswordField region. To bind a style to this <code>Region</code> use |
|
211 |
* the name <code>PasswordField</code>. |
|
212 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
213 |
public static final Region PASSWORD_FIELD = new Region("PasswordField", false); |
2 | 214 |
|
215 |
/** |
|
216 |
* PopupMenu region. To bind a style to this <code>Region</code> use |
|
217 |
* the name <code>PopupMenu</code>. |
|
218 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
219 |
public static final Region POPUP_MENU = new Region("PopupMenu", false); |
2 | 220 |
|
221 |
/** |
|
222 |
* PopupMenuSeparator region. To bind a style to this <code>Region</code> |
|
223 |
* use the name <code>PopupMenuSeparator</code>. |
|
224 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
225 |
public static final Region POPUP_MENU_SEPARATOR = new Region("PopupMenuSeparator", false); |
2 | 226 |
|
227 |
/** |
|
228 |
* ProgressBar region. To bind a style to this <code>Region</code> |
|
229 |
* use the name <code>ProgressBar</code>. |
|
230 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
231 |
public static final Region PROGRESS_BAR = new Region("ProgressBar", false); |
2 | 232 |
|
233 |
/** |
|
234 |
* RadioButton region. To bind a style to this <code>Region</code> |
|
235 |
* use the name <code>RadioButton</code>. |
|
236 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
237 |
public static final Region RADIO_BUTTON = new Region("RadioButton", false); |
2 | 238 |
|
239 |
/** |
|
240 |
* RegionButtonMenuItem region. To bind a style to this <code>Region</code> |
|
241 |
* use the name <code>RadioButtonMenuItem</code>. |
|
242 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
243 |
public static final Region RADIO_BUTTON_MENU_ITEM = new Region("RadioButtonMenuItem", false); |
2 | 244 |
|
245 |
/** |
|
246 |
* RootPane region. To bind a style to this <code>Region</code> use |
|
247 |
* the name <code>RootPane</code>. |
|
248 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
249 |
public static final Region ROOT_PANE = new Region("RootPane", false); |
2 | 250 |
|
251 |
/** |
|
252 |
* ScrollBar region. To bind a style to this <code>Region</code> use |
|
253 |
* the name <code>ScrollBar</code>. |
|
254 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
255 |
public static final Region SCROLL_BAR = new Region("ScrollBar", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
256 |
|
2 | 257 |
/** |
258 |
* Track of the ScrollBar. To bind a style to this <code>Region</code> use |
|
259 |
* the name <code>ScrollBarTrack</code>. |
|
260 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
261 |
public static final Region SCROLL_BAR_TRACK = new Region("ScrollBarTrack", true); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
262 |
|
2 | 263 |
/** |
264 |
* Thumb of the ScrollBar. The thumb is the region of the ScrollBar |
|
265 |
* that gives a graphical depiction of what percentage of the View is |
|
266 |
* currently visible. To bind a style to this <code>Region</code> use |
|
267 |
* the name <code>ScrollBarThumb</code>. |
|
268 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
269 |
public static final Region SCROLL_BAR_THUMB = new Region("ScrollBarThumb", true); |
2 | 270 |
|
271 |
/** |
|
272 |
* ScrollPane region. To bind a style to this <code>Region</code> use |
|
273 |
* the name <code>ScrollPane</code>. |
|
274 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
275 |
public static final Region SCROLL_PANE = new Region("ScrollPane", false); |
2 | 276 |
|
277 |
/** |
|
278 |
* Separator region. To bind a style to this <code>Region</code> use |
|
279 |
* the name <code>Separator</code>. |
|
280 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
281 |
public static final Region SEPARATOR = new Region("Separator", false); |
2 | 282 |
|
283 |
/** |
|
284 |
* Slider region. To bind a style to this <code>Region</code> use |
|
285 |
* the name <code>Slider</code>. |
|
286 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
287 |
public static final Region SLIDER = new Region("Slider", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
288 |
|
2 | 289 |
/** |
290 |
* Track of the Slider. To bind a style to this <code>Region</code> use |
|
291 |
* the name <code>SliderTrack</code>. |
|
292 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
293 |
public static final Region SLIDER_TRACK = new Region("SliderTrack", true); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
294 |
|
2 | 295 |
/** |
296 |
* Thumb of the Slider. The thumb of the Slider identifies the current |
|
297 |
* value. To bind a style to this <code>Region</code> use the name |
|
298 |
* <code>SliderThumb</code>. |
|
299 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
300 |
public static final Region SLIDER_THUMB = new Region("SliderThumb", true); |
2 | 301 |
|
302 |
/** |
|
303 |
* Spinner region. To bind a style to this <code>Region</code> use the name |
|
304 |
* <code>Spinner</code>. |
|
305 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
306 |
public static final Region SPINNER = new Region("Spinner", false); |
2 | 307 |
|
308 |
/** |
|
309 |
* SplitPane region. To bind a style to this <code>Region</code> use the name |
|
310 |
* <code>SplitPane</code>. |
|
311 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
312 |
public static final Region SPLIT_PANE = new Region("SplitPane", false); |
2 | 313 |
|
314 |
/** |
|
315 |
* Divider of the SplitPane. To bind a style to this <code>Region</code> |
|
316 |
* use the name <code>SplitPaneDivider</code>. |
|
317 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
318 |
public static final Region SPLIT_PANE_DIVIDER = new Region("SplitPaneDivider", true); |
2 | 319 |
|
320 |
/** |
|
321 |
* TabbedPane region. To bind a style to this <code>Region</code> use |
|
322 |
* the name <code>TabbedPane</code>. |
|
323 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
324 |
public static final Region TABBED_PANE = new Region("TabbedPane", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
325 |
|
2 | 326 |
/** |
327 |
* Region of a TabbedPane for one tab. To bind a style to this |
|
328 |
* <code>Region</code> use the name <code>TabbedPaneTab</code>. |
|
329 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
330 |
public static final Region TABBED_PANE_TAB = new Region("TabbedPaneTab", true); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
331 |
|
2 | 332 |
/** |
333 |
* Region of a TabbedPane containing the tabs. To bind a style to this |
|
334 |
* <code>Region</code> use the name <code>TabbedPaneTabArea</code>. |
|
335 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
336 |
public static final Region TABBED_PANE_TAB_AREA = new Region("TabbedPaneTabArea", true); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
337 |
|
2 | 338 |
/** |
339 |
* Region of a TabbedPane containing the content. To bind a style to this |
|
340 |
* <code>Region</code> use the name <code>TabbedPaneContent</code>. |
|
341 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
342 |
public static final Region TABBED_PANE_CONTENT = new Region("TabbedPaneContent", true); |
2 | 343 |
|
344 |
/** |
|
345 |
* Table region. To bind a style to this <code>Region</code> use |
|
346 |
* the name <code>Table</code>. |
|
347 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
348 |
public static final Region TABLE = new Region("Table", false); |
2 | 349 |
|
350 |
/** |
|
351 |
* TableHeader region. To bind a style to this <code>Region</code> use |
|
352 |
* the name <code>TableHeader</code>. |
|
353 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
354 |
public static final Region TABLE_HEADER = new Region("TableHeader", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
355 |
|
2 | 356 |
/** |
357 |
* TextArea region. To bind a style to this <code>Region</code> use |
|
358 |
* the name <code>TextArea</code>. |
|
359 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
360 |
public static final Region TEXT_AREA = new Region("TextArea", false); |
2 | 361 |
|
362 |
/** |
|
363 |
* TextField region. To bind a style to this <code>Region</code> use |
|
364 |
* the name <code>TextField</code>. |
|
365 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
366 |
public static final Region TEXT_FIELD = new Region("TextField", false); |
2 | 367 |
|
368 |
/** |
|
369 |
* TextPane region. To bind a style to this <code>Region</code> use |
|
370 |
* the name <code>TextPane</code>. |
|
371 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
372 |
public static final Region TEXT_PANE = new Region("TextPane", false); |
2 | 373 |
|
374 |
/** |
|
375 |
* ToggleButton region. To bind a style to this <code>Region</code> use |
|
376 |
* the name <code>ToggleButton</code>. |
|
377 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
378 |
public static final Region TOGGLE_BUTTON = new Region("ToggleButton", false); |
2 | 379 |
|
380 |
/** |
|
381 |
* ToolBar region. To bind a style to this <code>Region</code> use |
|
382 |
* the name <code>ToolBar</code>. |
|
383 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
384 |
public static final Region TOOL_BAR = new Region("ToolBar", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
385 |
|
2 | 386 |
/** |
387 |
* Region of the ToolBar containing the content. To bind a style to this |
|
388 |
* <code>Region</code> use the name <code>ToolBarContent</code>. |
|
389 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
390 |
public static final Region TOOL_BAR_CONTENT = new Region("ToolBarContent", true); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
391 |
|
2 | 392 |
/** |
393 |
* Region for the Window containing the ToolBar. To bind a style to this |
|
394 |
* <code>Region</code> use the name <code>ToolBarDragWindow</code>. |
|
395 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
396 |
public static final Region TOOL_BAR_DRAG_WINDOW = new Region("ToolBarDragWindow", false); |
2 | 397 |
|
398 |
/** |
|
399 |
* ToolTip region. To bind a style to this <code>Region</code> use |
|
400 |
* the name <code>ToolTip</code>. |
|
401 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
402 |
public static final Region TOOL_TIP = new Region("ToolTip", false); |
2 | 403 |
|
404 |
/** |
|
405 |
* ToolBar separator region. To bind a style to this <code>Region</code> use |
|
406 |
* the name <code>ToolBarSeparator</code>. |
|
407 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
408 |
public static final Region TOOL_BAR_SEPARATOR = new Region("ToolBarSeparator", false); |
2 | 409 |
|
410 |
/** |
|
411 |
* Tree region. To bind a style to this <code>Region</code> use the name |
|
412 |
* <code>Tree</code>. |
|
413 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
414 |
public static final Region TREE = new Region("Tree", false); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
415 |
|
2 | 416 |
/** |
417 |
* Region of the Tree for one cell. To bind a style to this |
|
418 |
* <code>Region</code> use the name <code>TreeCell</code>. |
|
419 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
420 |
public static final Region TREE_CELL = new Region("TreeCell", true); |
2 | 421 |
|
422 |
/** |
|
423 |
* Viewport region. To bind a style to this <code>Region</code> use |
|
424 |
* the name <code>Viewport</code>. |
|
425 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
426 |
public static final Region VIEWPORT = new Region("Viewport", false); |
2 | 427 |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
428 |
private static Map<String, Region> getUItoRegionMap() { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
429 |
AppContext context = AppContext.getAppContext(); |
25565
ce603b34c98d
8043548: Fix raw and unchecked lint warnings in javax.swing.plaf.*
darcy
parents:
23010
diff
changeset
|
430 |
@SuppressWarnings("unchecked") |
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
431 |
Map<String, Region> map = (Map<String, Region>) context.get(UI_TO_REGION_MAP_KEY); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
432 |
if (map == null) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
433 |
map = new HashMap<String, Region>(); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
434 |
map.put("ArrowButtonUI", ARROW_BUTTON); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
435 |
map.put("ButtonUI", BUTTON); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
436 |
map.put("CheckBoxUI", CHECK_BOX); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
437 |
map.put("CheckBoxMenuItemUI", CHECK_BOX_MENU_ITEM); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
438 |
map.put("ColorChooserUI", COLOR_CHOOSER); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
439 |
map.put("ComboBoxUI", COMBO_BOX); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
440 |
map.put("DesktopPaneUI", DESKTOP_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
441 |
map.put("DesktopIconUI", DESKTOP_ICON); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
442 |
map.put("EditorPaneUI", EDITOR_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
443 |
map.put("FileChooserUI", FILE_CHOOSER); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
444 |
map.put("FormattedTextFieldUI", FORMATTED_TEXT_FIELD); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
445 |
map.put("InternalFrameUI", INTERNAL_FRAME); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
446 |
map.put("InternalFrameTitlePaneUI", INTERNAL_FRAME_TITLE_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
447 |
map.put("LabelUI", LABEL); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
448 |
map.put("ListUI", LIST); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
449 |
map.put("MenuUI", MENU); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
450 |
map.put("MenuBarUI", MENU_BAR); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
451 |
map.put("MenuItemUI", MENU_ITEM); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
452 |
map.put("OptionPaneUI", OPTION_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
453 |
map.put("PanelUI", PANEL); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
454 |
map.put("PasswordFieldUI", PASSWORD_FIELD); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
455 |
map.put("PopupMenuUI", POPUP_MENU); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
456 |
map.put("PopupMenuSeparatorUI", POPUP_MENU_SEPARATOR); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
457 |
map.put("ProgressBarUI", PROGRESS_BAR); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
458 |
map.put("RadioButtonUI", RADIO_BUTTON); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
459 |
map.put("RadioButtonMenuItemUI", RADIO_BUTTON_MENU_ITEM); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
460 |
map.put("RootPaneUI", ROOT_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
461 |
map.put("ScrollBarUI", SCROLL_BAR); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
462 |
map.put("ScrollPaneUI", SCROLL_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
463 |
map.put("SeparatorUI", SEPARATOR); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
464 |
map.put("SliderUI", SLIDER); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
465 |
map.put("SpinnerUI", SPINNER); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
466 |
map.put("SplitPaneUI", SPLIT_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
467 |
map.put("TabbedPaneUI", TABBED_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
468 |
map.put("TableUI", TABLE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
469 |
map.put("TableHeaderUI", TABLE_HEADER); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
470 |
map.put("TextAreaUI", TEXT_AREA); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
471 |
map.put("TextFieldUI", TEXT_FIELD); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
472 |
map.put("TextPaneUI", TEXT_PANE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
473 |
map.put("ToggleButtonUI", TOGGLE_BUTTON); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
474 |
map.put("ToolBarUI", TOOL_BAR); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
475 |
map.put("ToolTipUI", TOOL_TIP); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
476 |
map.put("ToolBarSeparatorUI", TOOL_BAR_SEPARATOR); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
477 |
map.put("TreeUI", TREE); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
478 |
map.put("ViewportUI", VIEWPORT); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
479 |
context.put(UI_TO_REGION_MAP_KEY, map); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
480 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
481 |
return map; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
482 |
} |
2 | 483 |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
484 |
private static Map<Region, String> getLowerCaseNameMap() { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
485 |
AppContext context = AppContext.getAppContext(); |
25565
ce603b34c98d
8043548: Fix raw and unchecked lint warnings in javax.swing.plaf.*
darcy
parents:
23010
diff
changeset
|
486 |
@SuppressWarnings("unchecked") |
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
487 |
Map<Region, String> map = (Map<Region, String>) context.get(LOWER_CASE_NAME_MAP_KEY); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
488 |
if (map == null) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
489 |
map = new HashMap<Region, String>(); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
490 |
context.put(LOWER_CASE_NAME_MAP_KEY, map); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
491 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
492 |
return map; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
493 |
} |
2 | 494 |
|
495 |
static Region getRegion(JComponent c) { |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
496 |
return getUItoRegionMap().get(c.getUIClassID()); |
2 | 497 |
} |
498 |
||
499 |
static void registerUIs(UIDefaults table) { |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
500 |
for (Object key : getUItoRegionMap().keySet()) { |
2 | 501 |
table.put(key, "javax.swing.plaf.synth.SynthLookAndFeel"); |
502 |
} |
|
503 |
} |
|
504 |
||
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
505 |
private final String name; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
506 |
private final boolean subregion; |
2 | 507 |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
508 |
private Region(String name, boolean subregion) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
509 |
if (name == null) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
510 |
throw new NullPointerException("You must specify a non-null name"); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
511 |
} |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
512 |
this.name = name; |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
513 |
this.subregion = subregion; |
2 | 514 |
} |
515 |
||
516 |
/** |
|
517 |
* Creates a Region with the specified name. This should only be |
|
518 |
* used if you are creating your own <code>JComponent</code> subclass |
|
519 |
* with a custom <code>ComponentUI</code> class. |
|
520 |
* |
|
521 |
* @param name Name of the region |
|
522 |
* @param ui String that will be returned from |
|
523 |
* <code>component.getUIClassID</code>. This will be null |
|
524 |
* if this is a subregion. |
|
525 |
* @param subregion Whether or not this is a subregion. |
|
526 |
*/ |
|
527 |
protected Region(String name, String ui, boolean subregion) { |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
528 |
this(name, subregion); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
529 |
if (ui != null) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
530 |
getUItoRegionMap().put(ui, this); |
2 | 531 |
} |
532 |
} |
|
533 |
||
534 |
/** |
|
535 |
* Returns true if the Region is a subregion of a Component, otherwise |
|
536 |
* false. For example, <code>Region.BUTTON</code> corresponds do a |
|
537 |
* <code>Component</code> so that <code>Region.BUTTON.isSubregion()</code> |
|
538 |
* returns false. |
|
539 |
* |
|
540 |
* @return true if the Region is a subregion of a Component. |
|
541 |
*/ |
|
542 |
public boolean isSubregion() { |
|
543 |
return subregion; |
|
544 |
} |
|
545 |
||
546 |
/** |
|
547 |
* Returns the name of the region. |
|
548 |
* |
|
549 |
* @return name of the Region. |
|
550 |
*/ |
|
551 |
public String getName() { |
|
552 |
return name; |
|
553 |
} |
|
554 |
||
555 |
/** |
|
556 |
* Returns the name, in lowercase. |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
557 |
* |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
558 |
* @return lower case representation of the name of the Region |
2 | 559 |
*/ |
560 |
String getLowerCaseName() { |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
561 |
Map<Region, String> lowerCaseNameMap = getLowerCaseNameMap(); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
562 |
String lowerCaseName = lowerCaseNameMap.get(this); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
563 |
if (lowerCaseName == null) { |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
564 |
lowerCaseName = name.toLowerCase(Locale.ENGLISH); |
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
565 |
lowerCaseNameMap.put(this, lowerCaseName); |
2 | 566 |
} |
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
567 |
return lowerCaseName; |
2 | 568 |
} |
569 |
||
570 |
/** |
|
571 |
* Returns the name of the Region. |
|
572 |
* |
|
573 |
* @return name of the Region. |
|
574 |
*/ |
|
3457
fcf975361ffe
6660049: Synth Region.uiToRegionMap/lowerCaseNameMap are mutable statics
malenkov
parents:
1639
diff
changeset
|
575 |
@Override |
2 | 576 |
public String toString() { |
577 |
return name; |
|
578 |
} |
|
579 |
} |