author | vlivanov |
Thu, 18 Jan 2018 02:25:18 +0300 | |
changeset 48596 | 860326263d1f |
parent 47389 | 18c850407be9 |
permissions | -rw-r--r-- |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
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. |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
4 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
10 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
15 |
* accompanied this code). |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
16 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
20 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
23 |
* questions. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
24 |
*/ |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
25 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
26 |
package build.tools.generatenimbus; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
27 |
|
47389
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
28 |
import javax.xml.stream.XMLStreamException; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
29 |
import javax.xml.stream.XMLStreamReader; |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
30 |
import java.util.ArrayList; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
31 |
import java.util.List; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
32 |
import java.util.Map; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
33 |
|
47389
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
34 |
class UIRegion { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
35 |
String name; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
36 |
String key; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
37 |
private boolean opaque = false; |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
38 |
|
47389
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
39 |
private Insets contentMargins = new Insets(0, 0, 0, 0); |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
40 |
|
47389
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
41 |
protected List<UIState> backgroundStates = new ArrayList<UIState>(); |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
42 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
43 |
public List<UIState> getBackgroundStates() { return backgroundStates; } |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
44 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
45 |
protected List<UIState> foregroundStates = new ArrayList<UIState>(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
46 |
public List<UIState> getForegroundStates() { return foregroundStates; } |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
47 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
48 |
protected List<UIState> borderStates = new ArrayList<UIState>(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
49 |
public List<UIState> getBorderStates() { return borderStates; } |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
50 |
|
47389
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
51 |
UIStyle style = new UIStyle(); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
52 |
|
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
53 |
List<UIRegion> subRegions = new ArrayList<>(); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
54 |
public List<UIRegion> getSubRegions() { return subRegions; } |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
55 |
|
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
56 |
UIRegion(XMLStreamReader reader, boolean parse) |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
57 |
throws XMLStreamException { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
58 |
name = reader.getAttributeValue(null, "name"); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
59 |
key = reader.getAttributeValue(null, "key"); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
60 |
opaque = Boolean.parseBoolean(reader.getAttributeValue(null, "opaque")); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
61 |
if (!parse) { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
62 |
return; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
63 |
} |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
64 |
while (reader.hasNext()) { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
65 |
int eventType = reader.next(); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
66 |
switch (eventType) { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
67 |
case XMLStreamReader.START_ELEMENT: |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
68 |
parse(reader); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
69 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
70 |
case XMLStreamReader.END_ELEMENT: |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
71 |
switch (reader.getLocalName()) { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
72 |
case "region": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
73 |
return; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
74 |
} |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
75 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
76 |
} |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
77 |
} |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
78 |
} |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
79 |
|
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
80 |
private List<UIState> states = new ArrayList<UIState>(); |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
81 |
|
47389
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
82 |
void parse(XMLStreamReader reader) throws XMLStreamException { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
83 |
switch (reader.getLocalName()) { |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
84 |
case "backgroundStates": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
85 |
backgroundStates = states = new ArrayList<>(); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
86 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
87 |
case "foregroundStates": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
88 |
foregroundStates = states = new ArrayList<>(); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
89 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
90 |
case "borderStates": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
91 |
borderStates = states = new ArrayList<>(); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
92 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
93 |
case "style": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
94 |
style = new UIStyle(reader); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
95 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
96 |
case "region": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
97 |
subRegions.add(new UIRegion(reader, true)); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
98 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
99 |
case "uiComponent": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
100 |
subRegions.add(new UIComponent(reader)); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
101 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
102 |
case "uiIconRegion": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
103 |
subRegions.add(new UIIconRegion(reader)); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
104 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
105 |
case "contentMargins": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
106 |
contentMargins = new Insets(reader); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
107 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
108 |
case "state": |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
109 |
states.add(new UIState(reader)); |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
110 |
break; |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
111 |
} |
18c850407be9
8187599: Remove dependency of Building Nimbus L&F on JAXB
ssadetsky
parents:
47216
diff
changeset
|
112 |
} |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
113 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
114 |
protected void initStyles(UIStyle parentStyle) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
115 |
style.setParentStyle(parentStyle); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
116 |
for (UIState state: backgroundStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
117 |
state.getStyle().setParentStyle(this.style); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
118 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
119 |
for (UIState state: foregroundStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
120 |
state.getStyle().setParentStyle(this.style); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
121 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
122 |
for (UIState state: borderStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
123 |
state.getStyle().setParentStyle(this.style); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
124 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
125 |
for (UIRegion region: subRegions) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
126 |
region.initStyles(this.style); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
127 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
128 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
129 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
130 |
public String getKey() { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
131 |
return key == null || "".equals(key) ? name : key; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
132 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
133 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
134 |
private boolean hasCanvas() { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
135 |
for (UIState s : backgroundStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
136 |
if (s.hasCanvas()) return true; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
137 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
138 |
for (UIState s : borderStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
139 |
if (s.hasCanvas()) return true; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
140 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
141 |
for (UIState s : foregroundStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
142 |
if (s.hasCanvas()) return true; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
143 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
144 |
for (UIRegion r: subRegions) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
145 |
if (r.hasCanvas()) return true; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
146 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
147 |
return false; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
148 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
149 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
150 |
public void write(StringBuilder sb, StringBuilder styleBuffer, |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
151 |
UIComponent comp, String prefix, String pkg) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
152 |
// write content margins |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
153 |
sb.append(String.format(" d.put(\"%s.contentMargins\", %s);\n", |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
154 |
prefix, contentMargins.write(true))); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
155 |
// write opaque if true |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
156 |
if (opaque) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
157 |
sb.append(String.format(" d.put(\"%s.opaque\", Boolean.TRUE);\n", prefix)); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
158 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
159 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
160 |
// register component with LAF |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
161 |
String regionCode = "Region." + Utils.regionNameToCaps(name); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
162 |
styleBuffer.append(String.format(" register(%s, \"%s\");\n", |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
163 |
regionCode, prefix)); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
164 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
165 |
//write the State, if necessary |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
166 |
StringBuffer regString = new StringBuffer(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
167 |
List<UIStateType> types = comp.getStateTypes(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
168 |
if (types != null && types.size() > 0) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
169 |
for (UIStateType type : types) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
170 |
regString.append(type.getKey()); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
171 |
regString.append(","); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
172 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
173 |
//remove the last "," |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
174 |
regString.deleteCharAt(regString.length() - 1); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
175 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
176 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
177 |
if (! regString.equals("Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Default") && types.size() > 0) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
178 |
//there were either custom states, or the normal states were in a custom order |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
179 |
//so go ahead and write out prefix.State |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
180 |
sb.append(String.format(" d.put(\"%s.States\", \"%s\");\n", |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
181 |
prefix, regString)); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
182 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
183 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
184 |
// write out any custom states, if necessary |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
185 |
for (UIStateType type : types) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
186 |
String synthState = type.getKey(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
187 |
if (! "Enabled".equals(synthState) && |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
188 |
! "MouseOver".equals(synthState) && |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
189 |
! "Pressed".equals(synthState) && |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
190 |
! "Disabled".equals(synthState) && |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
191 |
! "Focused".equals(synthState) && |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
192 |
! "Selected".equals(synthState) && |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
193 |
! "Default".equals(synthState)) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
194 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
195 |
//what we have here, gentlemen, is a bona-fide custom state. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
196 |
//if the type is not one of the standard types, then construct a name for |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
197 |
//the new type, and write out a new subclass of State. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
198 |
String className = Utils.normalize(prefix) + synthState + "State"; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
199 |
sb.append(String.format(" d.put(\"%s.%s\", new %s());\n", |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
200 |
prefix, synthState, className)); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
201 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
202 |
String body = type.getCodeSnippet(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
203 |
Map<String, String> variables = Generator.getVariables(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
204 |
variables.put("STATE_NAME", className); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
205 |
variables.put("STATE_KEY", synthState); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
206 |
variables.put("BODY", body); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
207 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
208 |
Generator.writeSrcFile("StateImpl", variables, className); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
209 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
210 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
211 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
212 |
// write style |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
213 |
sb.append(style.write(prefix + '.')); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
214 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
215 |
String fileName = Utils.normalize(prefix) + "Painter"; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
216 |
boolean hasCanvas = hasCanvas(); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
217 |
if (hasCanvas) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
218 |
PainterGenerator.writePainter(this, fileName); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
219 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
220 |
// write states ui defaults |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
221 |
for (UIState state : backgroundStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
222 |
state.write(sb, prefix, pkg, fileName, "background"); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
223 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
224 |
for (UIState state : foregroundStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
225 |
state.write(sb, prefix, pkg, fileName, "foreground"); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
226 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
227 |
for (UIState state : borderStates) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
228 |
state.write(sb, prefix, pkg, fileName, "border"); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
229 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
230 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
231 |
// handle sub regions |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
232 |
for (UIRegion subreg : subRegions) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
233 |
String p = prefix; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
234 |
if (! (subreg instanceof UIIconRegion)) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
235 |
p = prefix + ":" + Utils.escape(subreg.getKey()); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
236 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
237 |
UIComponent c = comp; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
238 |
if (subreg instanceof UIComponent) { |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
239 |
c = (UIComponent) subreg; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
240 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
241 |
subreg.write(sb, styleBuffer, c, p, pkg); |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
242 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
243 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
244 |
} |