Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / javax / swing / JRootPane.js
1 Clazz.declarePackage ("javax.swing");
2 Clazz.load (["java.awt.LayoutManager2", "javax.swing.AbstractAction", "$.JComponent"], "javax.swing.JRootPane", ["java.lang.IllegalArgumentException", "$.NullPointerException", "java.awt.BorderLayout", "$.Dimension", "$.IllegalComponentStateException", "javax.swing.JLayeredPane", "$.JPanel", "$.SwingUtilities", "$.UIManager", "jssun.awt.AppContext"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.windowDecorationStyle = 0;
5 this.menuBar = null;
6 this.contentPane = null;
7 this.layeredPane = null;
8 this.glassPane = null;
9 this.defaultButton = null;
10 this.defaultPressAction = null;
11 this.defaultReleaseAction = null;
12 this.useTrueDoubleBuffering = true;
13 if (!Clazz.isClassDefined ("javax.swing.JRootPane.RootLayout")) {
14 javax.swing.JRootPane.$JRootPane$RootLayout$ ();
15 }
16 Clazz.instantialize (this, arguments);
17 }, javax.swing, "JRootPane", javax.swing.JComponent);
18 Clazz.makeConstructor (c$, 
19 function () {
20 Clazz.superConstructor (this, javax.swing.JRootPane, []);
21 var appletName = jssun.awt.AppContext.getAppContext ().getThreadGroup ().getName ();
22 this.setName (appletName + ".JRootPane");
23 this.setGlassPane (this.createGlassPane ());
24 this.setLayeredPane (this.createLayeredPane ());
25 this.setContentPane (this.createContentPane ());
26 this.setLayout (this.createRootLayout ());
27 this.updateUI ();
28 });
29 Clazz.overrideMethod (c$, "setDoubleBuffered", 
30 function (aFlag) {
31 }, "~B");
32 Clazz.defineMethod (c$, "getWindowDecorationStyle", 
33 function () {
34 return this.windowDecorationStyle;
35 });
36 Clazz.defineMethod (c$, "setWindowDecorationStyle", 
37 function (windowDecorationStyle) {
38 if (windowDecorationStyle < 0 || windowDecorationStyle > 8) {
39 throw  new IllegalArgumentException ("Invalid decoration style");
40 }var oldWindowDecorationStyle = this.getWindowDecorationStyle ();
41 this.windowDecorationStyle = windowDecorationStyle;
42 this.firePropertyChangeInt ("windowDecorationStyle", oldWindowDecorationStyle, windowDecorationStyle);
43 }, "~N");
44 Clazz.overrideMethod (c$, "getUI", 
45 function () {
46 return this.ui;
47 });
48 Clazz.overrideMethod (c$, "updateUI", 
49 function () {
50 this.setUI (javax.swing.UIManager.getUI (this));
51 });
52 Clazz.overrideMethod (c$, "getUIClassID", 
53 function () {
54 return "RootPaneUI";
55 });
56 Clazz.defineMethod (c$, "createLayeredPane", 
57 function () {
58 var p =  new javax.swing.JLayeredPane ();
59 p.setName (this.getName () + ".layeredPane");
60 return p;
61 });
62 Clazz.defineMethod (c$, "createContentPane", 
63 function () {
64 var c =  new javax.swing.JPanel ();
65 c.setName (this.getName () + ".contentPane");
66 c.setLayout (((Clazz.isClassDefined ("javax.swing.JRootPane$1") ? 0 : javax.swing.JRootPane.$JRootPane$1$ ()), Clazz.innerTypeInstance (javax.swing.JRootPane$1, this, null)));
67 return c;
68 });
69 Clazz.defineMethod (c$, "createGlassPane", 
70 function () {
71 var c =  new javax.swing.JPanel ();
72 c.setName (this.getName () + ".glassPane");
73 c.setVisible (false);
74 (c).setOpaque (false);
75 return c;
76 });
77 Clazz.defineMethod (c$, "createRootLayout", 
78 function () {
79 return Clazz.innerTypeInstance (javax.swing.JRootPane.RootLayout, this, null);
80 });
81 Clazz.defineMethod (c$, "setJMenuBar", 
82 function (menu) {
83 if (this.menuBar != null && this.menuBar.getParent () === this.layeredPane) this.layeredPane.remove (this.menuBar);
84 this.menuBar = menu;
85 if (this.menuBar != null) this.layeredPane.add (this.menuBar, javax.swing.JLayeredPane.FRAME_CONTENT_LAYER);
86 }, "javax.swing.JMenuBar");
87 Clazz.defineMethod (c$, "setMenuBar", 
88 function (menu) {
89 if (this.menuBar != null && this.menuBar.getParent () === this.layeredPane) this.layeredPane.remove (this.menuBar);
90 this.menuBar = menu;
91 if (this.menuBar != null) this.layeredPane.add (this.menuBar, javax.swing.JLayeredPane.FRAME_CONTENT_LAYER);
92 }, "javax.swing.JMenuBar");
93 Clazz.defineMethod (c$, "getJMenuBar", 
94 function () {
95 return this.menuBar;
96 });
97 Clazz.defineMethod (c$, "getMenuBar", 
98 function () {
99 return this.menuBar;
100 });
101 Clazz.defineMethod (c$, "setContentPane", 
102 function (content) {
103 if (content == null) throw  new java.awt.IllegalComponentStateException ("contentPane cannot be set to null.");
104 if (this.contentPane != null && this.contentPane.getParent () === this.layeredPane) this.layeredPane.remove (this.contentPane);
105 this.contentPane = content;
106 this.layeredPane.add (this.contentPane, javax.swing.JLayeredPane.FRAME_CONTENT_LAYER);
107 }, "java.awt.Container");
108 Clazz.defineMethod (c$, "getContentPane", 
109 function () {
110 return this.contentPane;
111 });
112 Clazz.defineMethod (c$, "setLayeredPane", 
113 function (layered) {
114 if (layered == null) throw  new java.awt.IllegalComponentStateException ("layeredPane cannot be set to null.");
115 if (this.layeredPane != null && this.layeredPane.getParent () === this) this.remove (this.layeredPane);
116 this.layeredPane = layered;
117 this.add (this.layeredPane, -1);
118 }, "javax.swing.JLayeredPane");
119 Clazz.defineMethod (c$, "getLayeredPane", 
120 function () {
121 return this.layeredPane;
122 });
123 Clazz.defineMethod (c$, "setGlassPane", 
124 function (glass) {
125 if (glass == null) {
126 throw  new NullPointerException ("glassPane cannot be set to null.");
127 }var visible = false;
128 if (this.glassPane != null && this.glassPane.getParent () === this) {
129 this.remove (this.glassPane);
130 visible = this.glassPane.isVisible ();
131 }glass.setVisible (visible);
132 this.glassPane = glass;
133 this.add (this.glassPane, 0);
134 if (visible) {
135 this.repaint ();
136 }}, "java.awt.Component");
137 Clazz.defineMethod (c$, "getGlassPane", 
138 function () {
139 return this.glassPane;
140 });
141 Clazz.overrideMethod (c$, "isValidateRoot", 
142 function () {
143 return true;
144 });
145 Clazz.overrideMethod (c$, "isOptimizedDrawingEnabled", 
146 function () {
147 return !this.glassPane.isVisible ();
148 });
149 Clazz.defineMethod (c$, "addNotify", 
150 function () {
151 Clazz.superCall (this, javax.swing.JRootPane, "addNotify", []);
152 this.enableEvents (8);
153 });
154 Clazz.defineMethod (c$, "setDefaultButton", 
155 function (defaultButton) {
156 var oldDefault = this.defaultButton;
157 if (oldDefault !== defaultButton) {
158 this.defaultButton = defaultButton;
159 if (oldDefault != null) {
160 oldDefault.repaint ();
161 }if (defaultButton != null) {
162 defaultButton.repaint ();
163 }}this.firePropertyChangeObject ("defaultButton", oldDefault, defaultButton);
164 }, "javax.swing.JButton");
165 Clazz.defineMethod (c$, "getDefaultButton", 
166 function () {
167 return this.defaultButton;
168 });
169 Clazz.defineMethod (c$, "setUseTrueDoubleBuffering", 
170 function (useTrueDoubleBuffering) {
171 this.useTrueDoubleBuffering = useTrueDoubleBuffering;
172 }, "~B");
173 Clazz.defineMethod (c$, "getUseTrueDoubleBuffering", 
174 function () {
175 return this.useTrueDoubleBuffering;
176 });
177 Clazz.defineMethod (c$, "disableTrueDoubleBuffering", 
178 function () {
179 });
180 Clazz.overrideMethod (c$, "addImpl", 
181 function (comp, constraints, index) {
182 this.addImplSAEM (comp, constraints, index);
183 if (this.glassPane != null && this.glassPane.getParent () === this && this.getComponent (0) !== this.glassPane) {
184 this.add (this.glassPane, 0);
185 }return comp;
186 }, "java.awt.Component,~O,~N");
187 c$.$JRootPane$RootLayout$ = function () {
188 Clazz.pu$h(self.c$);
189 c$ = Clazz.decorateAsClass (function () {
190 Clazz.prepareCallback (this, arguments);
191 Clazz.instantialize (this, arguments);
192 }, javax.swing.JRootPane, "RootLayout", null, java.awt.LayoutManager2);
193 Clazz.overrideMethod (c$, "preferredLayoutSize", 
194 function (a) {
195 var b;
196 var c;
197 var d = this.b$["javax.swing.JRootPane"].getInsets ();
198 if (this.b$["javax.swing.JRootPane"].contentPane != null) {
199 b = this.b$["javax.swing.JRootPane"].contentPane.getPreferredSize ();
200 } else {
201 b = a.getSize ();
202 }if (this.b$["javax.swing.JRootPane"].menuBar != null && this.b$["javax.swing.JRootPane"].menuBar.isVisible ()) {
203 c = this.b$["javax.swing.JRootPane"].menuBar.getPreferredSize ();
204 } else {
205 c =  new java.awt.Dimension (0, 0);
206 }return  new java.awt.Dimension (Math.max (b.width, c.width) + d.left + d.right, b.height + c.height + d.top + d.bottom);
207 }, "java.awt.Container");
208 Clazz.overrideMethod (c$, "minimumLayoutSize", 
209 function (a) {
210 var b;
211 var c;
212 var d = this.b$["javax.swing.JRootPane"].getInsets ();
213 if (this.b$["javax.swing.JRootPane"].contentPane != null) {
214 b = this.b$["javax.swing.JRootPane"].contentPane.getMinimumSize ();
215 } else {
216 b = a.getSize ();
217 }if (this.b$["javax.swing.JRootPane"].menuBar != null && this.b$["javax.swing.JRootPane"].menuBar.isVisible ()) {
218 c = this.b$["javax.swing.JRootPane"].menuBar.getMinimumSize ();
219 } else {
220 c =  new java.awt.Dimension (0, 0);
221 }return  new java.awt.Dimension (Math.max (b.width, c.width) + d.left + d.right, b.height + c.height + d.top + d.bottom);
222 }, "java.awt.Container");
223 Clazz.overrideMethod (c$, "maximumLayoutSize", 
224 function (a) {
225 var b;
226 var c;
227 var d = this.b$["javax.swing.JRootPane"].getInsets ();
228 if (this.b$["javax.swing.JRootPane"].menuBar != null && this.b$["javax.swing.JRootPane"].menuBar.isVisible ()) {
229 c = this.b$["javax.swing.JRootPane"].menuBar.getMaximumSize ();
230 } else {
231 c =  new java.awt.Dimension (0, 0);
232 }if (this.b$["javax.swing.JRootPane"].contentPane != null) {
233 b = this.b$["javax.swing.JRootPane"].contentPane.getMaximumSize ();
234 } else {
235 b =  new java.awt.Dimension (2147483647, 2147483647 - d.top - d.bottom - c.height - 1);
236 }return  new java.awt.Dimension (Math.min (b.width, c.width) + d.left + d.right, b.height + c.height + d.top + d.bottom);
237 }, "java.awt.Container");
238 Clazz.overrideMethod (c$, "layoutContainer", 
239 function (a) {
240 var b = a.getBounds ();
241 var c = this.b$["javax.swing.JRootPane"].getInsets ();
242 var d = 0;
243 var e = b.width - c.right - c.left;
244 var f = b.height - c.top - c.bottom;
245 if (this.b$["javax.swing.JRootPane"].layeredPane != null) {
246 this.b$["javax.swing.JRootPane"].layeredPane.setBounds (c.left, c.top, e, f);
247 }if (this.b$["javax.swing.JRootPane"].glassPane != null) {
248 this.b$["javax.swing.JRootPane"].glassPane.setBounds (c.left, c.top, e, f);
249 }if (this.b$["javax.swing.JRootPane"].menuBar != null && this.b$["javax.swing.JRootPane"].menuBar.isVisible ()) {
250 var g = this.b$["javax.swing.JRootPane"].menuBar.getPreferredSize ();
251 this.b$["javax.swing.JRootPane"].menuBar.setBounds (0, 0, e, g.height);
252 d += g.height;
253 }if (this.b$["javax.swing.JRootPane"].contentPane != null) {
254 this.b$["javax.swing.JRootPane"].contentPane.setBounds (0, d, e, f - d);
255 }}, "java.awt.Container");
256 Clazz.defineMethod (c$, "addLayoutComponent", 
257 function (a, b) {
258 }, "~S,java.awt.Component");
259 Clazz.overrideMethod (c$, "removeLayoutComponent", 
260 function (a) {
261 }, "java.awt.Component");
262 Clazz.defineMethod (c$, "addLayoutComponent", 
263 function (a, b) {
264 }, "java.awt.Component,~O");
265 Clazz.overrideMethod (c$, "getLayoutAlignmentX", 
266 function (a) {
267 return 0.0;
268 }, "java.awt.Container");
269 Clazz.overrideMethod (c$, "getLayoutAlignmentY", 
270 function (a) {
271 return 0.0;
272 }, "java.awt.Container");
273 Clazz.overrideMethod (c$, "invalidateLayout", 
274 function (a) {
275 }, "java.awt.Container");
276 c$ = Clazz.p0p ();
277 };
278 c$.$JRootPane$1$ = function () {
279 Clazz.pu$h(self.c$);
280 c$ = Clazz.declareAnonymous (javax.swing, "JRootPane$1", java.awt.BorderLayout);
281 Clazz.defineMethod (c$, "addLayoutComponent", 
282 function (comp, constraints) {
283 if (constraints == null) {
284 constraints = "Center";
285 }Clazz.superCall (this, javax.swing.JRootPane$1, "addLayoutComponent", [comp, constraints]);
286 }, "java.awt.Component,~O");
287 c$ = Clazz.p0p ();
288 };
289 Clazz.pu$h(self.c$);
290 c$ = Clazz.decorateAsClass (function () {
291 this.owner = null;
292 this.root = null;
293 this.press = false;
294 Clazz.instantialize (this, arguments);
295 }, javax.swing.JRootPane, "DefaultAction", javax.swing.AbstractAction);
296 Clazz.makeConstructor (c$, 
297 function (a, b) {
298 Clazz.superConstructor (this, javax.swing.JRootPane.DefaultAction, []);
299 this.root = a;
300 this.press = b;
301 }, "javax.swing.JRootPane,~B");
302 Clazz.defineMethod (c$, "setOwner", 
303 function (a) {
304 this.owner = a;
305 }, "javax.swing.JButton");
306 Clazz.overrideMethod (c$, "actionPerformed", 
307 function (a) {
308 if (this.owner != null && javax.swing.SwingUtilities.getRootPane (this.owner) === this.root) {
309 var b = this.owner.getModel ();
310 if (this.press) {
311 b.setArmed (true);
312 b.setPressed (true);
313 } else {
314 b.setPressed (false);
315 }}}, "java.awt.event.ActionEvent");
316 Clazz.overrideMethod (c$, "isEnabled", 
317 function () {
318 return this.owner.getModel ().isEnabled ();
319 });
320 c$ = Clazz.p0p ();
321 Clazz.defineStatics (c$,
322 "$uiClassID", "RootPaneUI",
323 "NONE", 0,
324 "FRAME", 1,
325 "PLAIN_DIALOG", 2,
326 "INFORMATION_DIALOG", 3,
327 "ERROR_DIALOG", 4,
328 "COLOR_CHOOSER_DIALOG", 5,
329 "FILE_CHOOSER_DIALOG", 6,
330 "QUESTION_DIALOG", 7,
331 "WARNING_DIALOG", 8);
332 });