e2136c9f2eaef495828d7a360e3195efe1e57603
[jalviewjs.git] / site / j2s / javax / swing / JTabbedPane.js
1 Clazz.declarePackage ("javax.swing");\r
2 Clazz.load (["javax.swing.JComponent", "$.SwingConstants", "javax.swing.event.ChangeListener"], "javax.swing.JTabbedPane", ["java.lang.IllegalArgumentException", "$.IndexOutOfBoundsException", "java.util.ArrayList", "java.awt.Point", "javax.swing.DefaultSingleSelectionModel", "$.Icon", "$.SwingUtilities", "$.UIManager", "javax.swing.event.ChangeEvent", "javax.swing.plaf.UIResource"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.tabPlacement = 1;\r
5 this.tabLayoutPolicy = 0;\r
6 this.model = null;\r
7 this.haveRegistered = false;\r
8 this.changeListener = null;\r
9 this.pages = null;\r
10 this.visComp = null;\r
11 this.changeEvent = null;\r
12 if (!Clazz.isClassDefined ("javax.swing.JTabbedPane.ModelListener")) {\r
13 javax.swing.JTabbedPane.$JTabbedPane$ModelListener$ ();\r
14 }\r
15 if (!Clazz.isClassDefined ("javax.swing.JTabbedPane.Page")) {\r
16 javax.swing.JTabbedPane.$JTabbedPane$Page$ ();\r
17 }\r
18 Clazz.instantialize (this, arguments);\r
19 }, javax.swing, "JTabbedPane", javax.swing.JComponent, javax.swing.SwingConstants);\r
20 Clazz.makeConstructor (c$, \r
21 function () {\r
22 this.construct (1, 0);\r
23 });\r
24 Clazz.makeConstructor (c$, \r
25 function (tabPlacement) {\r
26 this.construct (tabPlacement, 0);\r
27 }, "~N");\r
28 Clazz.makeConstructor (c$, \r
29 function (tabPlacement, tabLayoutPolicy) {\r
30 Clazz.superConstructor (this, javax.swing.JTabbedPane, []);\r
31 this.setTabPlacement (tabPlacement);\r
32 this.setTabLayoutPolicy (tabLayoutPolicy);\r
33 this.pages =  new java.util.ArrayList (1);\r
34 this.setModel ( new javax.swing.DefaultSingleSelectionModel ());\r
35 this.updateUI ();\r
36 }, "~N,~N");\r
37 Clazz.overrideMethod (c$, "getUI", \r
38 function () {\r
39 return this.ui;\r
40 });\r
41 Clazz.defineMethod (c$, "setUI", \r
42 function (ui) {\r
43 Clazz.superCall (this, javax.swing.JTabbedPane, "setUI", [ui]);\r
44 for (var i = 0; i < this.getTabCount (); i++) {\r
45 var icon = this.pages.get (i).disabledIcon;\r
46 if (Clazz.instanceOf (icon, javax.swing.plaf.UIResource)) {\r
47 this.setDisabledIconAt (i, null);\r
48 }}\r
49 }, "javax.swing.plaf.TabbedPaneUI");\r
50 Clazz.overrideMethod (c$, "updateUI", \r
51 function () {\r
52 this.setUI (javax.swing.UIManager.getUI (this));\r
53 });\r
54 Clazz.overrideMethod (c$, "getUIClassID", \r
55 function () {\r
56 return "TabbedPaneUI";\r
57 });\r
58 Clazz.defineMethod (c$, "createChangeListener", \r
59 function () {\r
60 return Clazz.innerTypeInstance (javax.swing.JTabbedPane.ModelListener, this, null);\r
61 });\r
62 Clazz.defineMethod (c$, "addChangeListener", \r
63 function (l) {\r
64 this.listenerList.add (javax.swing.event.ChangeListener, l);\r
65 }, "javax.swing.event.ChangeListener");\r
66 Clazz.defineMethod (c$, "removeChangeListener", \r
67 function (l) {\r
68 this.listenerList.remove (javax.swing.event.ChangeListener, l);\r
69 }, "javax.swing.event.ChangeListener");\r
70 Clazz.defineMethod (c$, "getChangeListeners", \r
71 function () {\r
72 return this.listenerList.getListeners (javax.swing.event.ChangeListener);\r
73 });\r
74 Clazz.defineMethod (c$, "fireStateChanged", \r
75 function () {\r
76 var selIndex = this.getSelectedIndex ();\r
77 if (selIndex < 0) {\r
78 if (this.visComp != null && this.visComp.isVisible ()) {\r
79 this.visComp.setVisible (false);\r
80 }this.visComp = null;\r
81 } else {\r
82 var newComp = this.getComponentAt (selIndex);\r
83 if (newComp != null && newComp !== this.visComp) {\r
84 if (this.visComp != null) {\r
85 if (this.visComp.isVisible ()) {\r
86 this.visComp.setVisible (false);\r
87 }}if (!newComp.isVisible ()) {\r
88 newComp.setVisible (true);\r
89 }this.visComp = newComp;\r
90 }}var listeners = this.listenerList.getListenerList ();\r
91 for (var i = listeners.length - 2; i >= 0; i -= 2) {\r
92 if (listeners[i] === javax.swing.event.ChangeListener) {\r
93 if (this.changeEvent == null) this.changeEvent =  new javax.swing.event.ChangeEvent (this);\r
94 (listeners[i + 1]).stateChanged (this.changeEvent);\r
95 }}\r
96 });\r
97 Clazz.defineMethod (c$, "getModel", \r
98 function () {\r
99 return this.model;\r
100 });\r
101 Clazz.defineMethod (c$, "setModel", \r
102 function (model) {\r
103 var oldModel = this.getModel ();\r
104 if (oldModel != null) {\r
105 oldModel.removeChangeListener (this.changeListener);\r
106 this.changeListener = null;\r
107 }this.model = model;\r
108 if (model != null) {\r
109 this.changeListener = this.createChangeListener ();\r
110 model.addChangeListener (this.changeListener);\r
111 }this.firePropertyChangeObject ("model", oldModel, model);\r
112 this.repaint ();\r
113 }, "javax.swing.SingleSelectionModel");\r
114 Clazz.defineMethod (c$, "getTabPlacement", \r
115 function () {\r
116 return this.tabPlacement;\r
117 });\r
118 Clazz.defineMethod (c$, "setTabPlacement", \r
119 function (tabPlacement) {\r
120 if (tabPlacement != 1 && tabPlacement != 2 && tabPlacement != 3 && tabPlacement != 4) {\r
121 throw  new IllegalArgumentException ("illegal tab placement: must be TOP, BOTTOM, LEFT, or RIGHT");\r
122 }if (this.tabPlacement != tabPlacement) {\r
123 var oldValue = this.tabPlacement;\r
124 this.tabPlacement = tabPlacement;\r
125 this.firePropertyChangeInt ("tabPlacement", oldValue, tabPlacement);\r
126 this.revalidate ();\r
127 this.repaint ();\r
128 }}, "~N");\r
129 Clazz.defineMethod (c$, "getTabLayoutPolicy", \r
130 function () {\r
131 return this.tabLayoutPolicy;\r
132 });\r
133 Clazz.defineMethod (c$, "setTabLayoutPolicy", \r
134 function (tabLayoutPolicy) {\r
135 if (tabLayoutPolicy != 0 && tabLayoutPolicy != 1) {\r
136 throw  new IllegalArgumentException ("illegal tab layout policy: must be WRAP_TAB_LAYOUT or SCROLL_TAB_LAYOUT");\r
137 }if (this.tabLayoutPolicy != tabLayoutPolicy) {\r
138 var oldValue = this.tabLayoutPolicy;\r
139 this.tabLayoutPolicy = tabLayoutPolicy;\r
140 this.firePropertyChangeInt ("tabLayoutPolicy", oldValue, tabLayoutPolicy);\r
141 this.revalidate ();\r
142 this.repaint ();\r
143 }}, "~N");\r
144 Clazz.defineMethod (c$, "getSelectedIndex", \r
145 function () {\r
146 return this.model.getSelectedIndex ();\r
147 });\r
148 Clazz.defineMethod (c$, "setSelectedIndex", \r
149 function (index) {\r
150 if (index != -1) {\r
151 this.checkIndex (index);\r
152 }this.setSelectedIndexImpl (index, true);\r
153 }, "~N");\r
154 Clazz.defineMethod (c$, "setSelectedIndexImpl", \r
155  function (index, doAccessibleChanges) {\r
156 this.model.setSelectedIndex (index);\r
157 }, "~N,~B");\r
158 Clazz.defineMethod (c$, "getSelectedComponent", \r
159 function () {\r
160 var index = this.getSelectedIndex ();\r
161 if (index == -1) {\r
162 return null;\r
163 }return this.getComponentAt (index);\r
164 });\r
165 Clazz.defineMethod (c$, "setSelectedComponent", \r
166 function (c) {\r
167 var index = this.indexOfComponent (c);\r
168 if (index != -1) {\r
169 this.setSelectedIndex (index);\r
170 } else {\r
171 throw  new IllegalArgumentException ("component not found in tabbed pane");\r
172 }}, "java.awt.Component");\r
173 Clazz.defineMethod (c$, "insertTab", \r
174 function (title, icon, component, tip, index) {\r
175 var newIndex = index;\r
176 var removeIndex = this.indexOfComponent (component);\r
177 if (component != null && removeIndex != -1) {\r
178 this.removeTabAt (removeIndex);\r
179 if (newIndex > removeIndex) {\r
180 newIndex--;\r
181 }}var selectedIndex = this.getSelectedIndex ();\r
182 this.pages.add (newIndex, Clazz.innerTypeInstance (javax.swing.JTabbedPane.Page, this, null, this, title != null ? title : "", icon, null, component, tip));\r
183 if (component != null) {\r
184 this.addImplSAEM (component, null, -1);\r
185 component.setVisible (false);\r
186 } else {\r
187 this.firePropertyChangeInt ("indexForNullComponent", -1, index);\r
188 }if (this.pages.size () == 1) {\r
189 this.setSelectedIndex (0);\r
190 }if (selectedIndex >= newIndex) {\r
191 this.setSelectedIndexImpl (selectedIndex + 1, false);\r
192 }this.revalidate ();\r
193 this.repaint ();\r
194 }, "~S,javax.swing.Icon,java.awt.Component,~S,~N");\r
195 Clazz.defineMethod (c$, "addTab", \r
196 function (title, icon, component, tip) {\r
197 this.insertTab (title, icon, component, tip, this.pages.size ());\r
198 }, "~S,javax.swing.Icon,java.awt.Component,~S");\r
199 Clazz.defineMethod (c$, "addTab", \r
200 function (title, icon, component) {\r
201 this.insertTab (title, icon, component, null, this.pages.size ());\r
202 }, "~S,javax.swing.Icon,java.awt.Component");\r
203 Clazz.defineMethod (c$, "addTab", \r
204 function (title, component) {\r
205 this.insertTab (title, null, component, null, this.pages.size ());\r
206 }, "~S,java.awt.Component");\r
207 Clazz.defineMethod (c$, "add", \r
208 function (component) {\r
209 if (!(Clazz.instanceOf (component, javax.swing.plaf.UIResource))) {\r
210 this.addTab (component.getName (), component);\r
211 } else {\r
212 Clazz.superCall (this, javax.swing.JTabbedPane, "add", [component]);\r
213 }return component;\r
214 }, "java.awt.Component");\r
215 Clazz.defineMethod (c$, "add", \r
216 function (title, component) {\r
217 if (!(Clazz.instanceOf (component, javax.swing.plaf.UIResource))) {\r
218 this.addTab (title, component);\r
219 } else {\r
220 Clazz.superCall (this, javax.swing.JTabbedPane, "add", [title, component]);\r
221 }return component;\r
222 }, "~S,java.awt.Component");\r
223 Clazz.defineMethod (c$, "add", \r
224 function (component, index) {\r
225 if (!(Clazz.instanceOf (component, javax.swing.plaf.UIResource))) {\r
226 this.insertTab (component.getName (), null, component, null, index == -1 ? this.getTabCount () : index);\r
227 } else {\r
228 Clazz.superCall (this, javax.swing.JTabbedPane, "add", [component, index]);\r
229 }return component;\r
230 }, "java.awt.Component,~N");\r
231 Clazz.defineMethod (c$, "add", \r
232 function (component, constraints) {\r
233 if (!(Clazz.instanceOf (component, javax.swing.plaf.UIResource))) {\r
234 if (Clazz.instanceOf (constraints, String)) {\r
235 this.addTab (constraints, component);\r
236 } else if (Clazz.instanceOf (constraints, javax.swing.Icon)) {\r
237 this.addTab (null, constraints, component);\r
238 } else {\r
239 this.add (component);\r
240 }} else {\r
241 Clazz.superCall (this, javax.swing.JTabbedPane, "add", [component, constraints]);\r
242 }}, "java.awt.Component,~O");\r
243 Clazz.defineMethod (c$, "add", \r
244 function (component, constraints, index) {\r
245 if (!(Clazz.instanceOf (component, javax.swing.plaf.UIResource))) {\r
246 var icon = Clazz.instanceOf (constraints, javax.swing.Icon) ? constraints : null;\r
247 var title = Clazz.instanceOf (constraints, String) ? constraints : null;\r
248 this.insertTab (title, icon, component, null, index == -1 ? this.getTabCount () : index);\r
249 } else {\r
250 this.addImpl (component, constraints, index);\r
251 }return component;\r
252 }, "java.awt.Component,~O,~N");\r
253 Clazz.defineMethod (c$, "removeTabAt", \r
254 function (index) {\r
255 this.checkIndex (index);\r
256 var component = this.getComponentAt (index);\r
257 var selected = this.getSelectedIndex ();\r
258 if (component === this.visComp) {\r
259 this.visComp = null;\r
260 }this.setTabComponentAt (index, null);\r
261 this.pages.remove (index);\r
262 this.putClientProperty ("__index_to_remove__",  new Integer (index));\r
263 if (selected > index) {\r
264 this.setSelectedIndexImpl (selected - 1, false);\r
265 } else if (selected >= this.getTabCount ()) {\r
266 this.setSelectedIndexImpl (selected - 1, false);\r
267 } else if (index == selected) {\r
268 this.fireStateChanged ();\r
269 }if (component != null) {\r
270 var components = this.getComponents ();\r
271 for (var i = components.length; --i >= 0; ) {\r
272 if (components[i] === component) {\r
273 Clazz.superCall (this, javax.swing.JTabbedPane, "remove", [i]);\r
274 component.setVisible (true);\r
275 break;\r
276 }}\r
277 }this.revalidate ();\r
278 this.repaint ();\r
279 }, "~N");\r
280 Clazz.defineMethod (c$, "remove", \r
281 function (component) {\r
282 var index = this.indexOfComponent (component);\r
283 if (index != -1) {\r
284 this.removeTabAt (index);\r
285 } else {\r
286 var children = this.getComponents ();\r
287 for (var i = 0; i < children.length; i++) {\r
288 if (component === children[i]) {\r
289 Clazz.superCall (this, javax.swing.JTabbedPane, "remove", [i]);\r
290 break;\r
291 }}\r
292 }}, "java.awt.Component");\r
293 Clazz.defineMethod (c$, "remove", \r
294 function (index) {\r
295 this.removeTabAt (index);\r
296 }, "~N");\r
297 Clazz.overrideMethod (c$, "removeAll", \r
298 function () {\r
299 this.setSelectedIndexImpl (-1, true);\r
300 var tabCount = this.getTabCount ();\r
301 while (tabCount-- > 0) {\r
302 this.removeTabAt (tabCount);\r
303 }\r
304 });\r
305 Clazz.defineMethod (c$, "getTabCount", \r
306 function () {\r
307 return this.pages.size ();\r
308 });\r
309 Clazz.defineMethod (c$, "getTabRunCount", \r
310 function () {\r
311 if (this.ui != null) {\r
312 return (this.ui).getTabRunCount (this);\r
313 }return 0;\r
314 });\r
315 Clazz.defineMethod (c$, "getTitleAt", \r
316 function (index) {\r
317 return this.pages.get (index).title;\r
318 }, "~N");\r
319 Clazz.defineMethod (c$, "getIconAt", \r
320 function (index) {\r
321 return this.pages.get (index).icon;\r
322 }, "~N");\r
323 Clazz.defineMethod (c$, "getDisabledIconAt", \r
324 function (index) {\r
325 var page = this.pages.get (index);\r
326 if (page.disabledIcon == null) {\r
327 page.disabledIcon = javax.swing.UIManager.getLookAndFeel ().getDisabledIcon (this, page.icon);\r
328 }return page.disabledIcon;\r
329 }, "~N");\r
330 Clazz.defineMethod (c$, "getToolTipTextAt", \r
331 function (index) {\r
332 return this.pages.get (index).tip;\r
333 }, "~N");\r
334 Clazz.defineMethod (c$, "getBackgroundAt", \r
335 function (index) {\r
336 return this.pages.get (index).getBackground ();\r
337 }, "~N");\r
338 Clazz.defineMethod (c$, "getForegroundAt", \r
339 function (index) {\r
340 return this.pages.get (index).getForeground ();\r
341 }, "~N");\r
342 Clazz.defineMethod (c$, "isEnabledAt", \r
343 function (index) {\r
344 return this.pages.get (index).isEnabled ();\r
345 }, "~N");\r
346 Clazz.defineMethod (c$, "getComponentAt", \r
347 function (index) {\r
348 return this.pages.get (index).component;\r
349 }, "~N");\r
350 Clazz.defineMethod (c$, "getMnemonicAt", \r
351 function (tabIndex) {\r
352 this.checkIndex (tabIndex);\r
353 var page = this.pages.get (tabIndex);\r
354 return page.getMnemonic ();\r
355 }, "~N");\r
356 Clazz.defineMethod (c$, "getDisplayedMnemonicIndexAt", \r
357 function (tabIndex) {\r
358 this.checkIndex (tabIndex);\r
359 var page = this.pages.get (tabIndex);\r
360 return page.getDisplayedMnemonicIndex ();\r
361 }, "~N");\r
362 Clazz.defineMethod (c$, "getBoundsAt", \r
363 function (index) {\r
364 this.checkIndex (index);\r
365 if (this.ui != null) {\r
366 return (this.ui).getTabBounds (this, index);\r
367 }return null;\r
368 }, "~N");\r
369 Clazz.defineMethod (c$, "setTitleAt", \r
370 function (index, title) {\r
371 var page = this.pages.get (index);\r
372 var oldTitle = page.title;\r
373 page.title = title;\r
374 if (oldTitle !== title) {\r
375 this.firePropertyChangeInt ("indexForTitle", -1, index);\r
376 }page.updateDisplayedMnemonicIndex ();\r
377 if (title == null || oldTitle == null || !title.equals (oldTitle)) {\r
378 this.revalidate ();\r
379 this.repaint ();\r
380 }}, "~N,~S");\r
381 Clazz.defineMethod (c$, "setIconAt", \r
382 function (index, icon) {\r
383 var page = this.pages.get (index);\r
384 var oldIcon = page.icon;\r
385 if (icon !== oldIcon) {\r
386 page.icon = icon;\r
387 if (Clazz.instanceOf (page.disabledIcon, javax.swing.plaf.UIResource)) {\r
388 page.disabledIcon = null;\r
389 }this.revalidate ();\r
390 this.repaint ();\r
391 }}, "~N,javax.swing.Icon");\r
392 Clazz.defineMethod (c$, "setDisabledIconAt", \r
393 function (index, disabledIcon) {\r
394 var oldIcon = this.pages.get (index).disabledIcon;\r
395 this.pages.get (index).disabledIcon = disabledIcon;\r
396 if (disabledIcon !== oldIcon && !this.isEnabledAt (index)) {\r
397 this.revalidate ();\r
398 this.repaint ();\r
399 }}, "~N,javax.swing.Icon");\r
400 Clazz.defineMethod (c$, "setToolTipTextAt", \r
401 function (index, toolTipText) {\r
402 this.pages.get (index).tip = toolTipText;\r
403 }, "~N,~S");\r
404 Clazz.defineMethod (c$, "setBackgroundAt", \r
405 function (index, background) {\r
406 var oldBg = this.pages.get (index).background;\r
407 this.pages.get (index).setBackground (background);\r
408 if (background == null || oldBg == null || !background.equals (oldBg)) {\r
409 var tabBounds = this.getBoundsAt (index);\r
410 if (tabBounds != null) {\r
411 this.repaint (tabBounds);\r
412 }}}, "~N,java.awt.Color");\r
413 Clazz.defineMethod (c$, "setForegroundAt", \r
414 function (index, foreground) {\r
415 var oldFg = this.pages.get (index).foreground;\r
416 this.pages.get (index).setForeground (foreground);\r
417 if (foreground == null || oldFg == null || !foreground.equals (oldFg)) {\r
418 var tabBounds = this.getBoundsAt (index);\r
419 if (tabBounds != null) {\r
420 this.repaint (tabBounds);\r
421 }}}, "~N,java.awt.Color");\r
422 Clazz.defineMethod (c$, "setEnabledAt", \r
423 function (index, enabled) {\r
424 var oldEnabled = this.pages.get (index).isEnabled ();\r
425 this.pages.get (index).setEnabled (enabled);\r
426 if (enabled != oldEnabled) {\r
427 this.revalidate ();\r
428 this.repaint ();\r
429 }}, "~N,~B");\r
430 Clazz.defineMethod (c$, "setComponentAt", \r
431 function (index, component) {\r
432 var page = this.pages.get (index);\r
433 if (component !== page.component) {\r
434 if (page.component != null) {\r
435 {\r
436 var count = this.getComponentCount ();\r
437 var children = this.getComponents ();\r
438 for (var i = 0; i < count; i++) {\r
439 if (children[i] === page.component) {\r
440 Clazz.superCall (this, javax.swing.JTabbedPane, "remove", [i]);\r
441 }}\r
442 }}page.component = component;\r
443 var selectedPage = (this.getSelectedIndex () == index);\r
444 if (selectedPage) {\r
445 this.visComp = component;\r
446 }if (component != null) {\r
447 component.setVisible (selectedPage);\r
448 this.addImplSAEM (component, null, -1);\r
449 } else {\r
450 this.repaint ();\r
451 }this.revalidate ();\r
452 }}, "~N,java.awt.Component");\r
453 Clazz.defineMethod (c$, "setDisplayedMnemonicIndexAt", \r
454 function (tabIndex, mnemonicIndex) {\r
455 this.checkIndex (tabIndex);\r
456 var page = this.pages.get (tabIndex);\r
457 page.setDisplayedMnemonicIndex (mnemonicIndex);\r
458 }, "~N,~N");\r
459 Clazz.defineMethod (c$, "setMnemonicAt", \r
460 function (tabIndex, mnemonic) {\r
461 this.checkIndex (tabIndex);\r
462 var page = this.pages.get (tabIndex);\r
463 page.setMnemonic (mnemonic);\r
464 this.firePropertyChangeObject ("mnemonicAt", null, null);\r
465 }, "~N,~N");\r
466 Clazz.defineMethod (c$, "indexOfTab", \r
467 function (title) {\r
468 for (var i = 0; i < this.getTabCount (); i++) {\r
469 if (this.getTitleAt (i).equals (title == null ? "" : title)) {\r
470 return i;\r
471 }}\r
472 return -1;\r
473 }, "~S");\r
474 Clazz.defineMethod (c$, "indexOfTab", \r
475 function (icon) {\r
476 for (var i = 0; i < this.getTabCount (); i++) {\r
477 var tabIcon = this.getIconAt (i);\r
478 if ((tabIcon != null && tabIcon.equals (icon)) || (tabIcon == null && tabIcon === icon)) {\r
479 return i;\r
480 }}\r
481 return -1;\r
482 }, "javax.swing.Icon");\r
483 Clazz.defineMethod (c$, "indexOfComponent", \r
484 function (component) {\r
485 for (var i = 0; i < this.getTabCount (); i++) {\r
486 var c = this.getComponentAt (i);\r
487 if ((c != null && c.equals (component)) || (c == null && c === component)) {\r
488 return i;\r
489 }}\r
490 return -1;\r
491 }, "java.awt.Component");\r
492 Clazz.defineMethod (c$, "indexAtLocation", \r
493 function (x, y) {\r
494 if (this.ui != null) {\r
495 return (this.ui).tabForCoordinate (this, x, y);\r
496 }return -1;\r
497 }, "~N,~N");\r
498 Clazz.defineMethod (c$, "getToolTipText", \r
499 function (event) {\r
500 if (this.ui != null) {\r
501 var index = (this.ui).tabForCoordinate (this, event.getX (), event.getY ());\r
502 if (index != -1) {\r
503 return this.pages.get (index).tip;\r
504 }}return Clazz.superCall (this, javax.swing.JTabbedPane, "getToolTipText", [event]);\r
505 }, "java.awt.event.MouseEvent");\r
506 Clazz.defineMethod (c$, "checkIndex", \r
507  function (index) {\r
508 if (index < 0 || index >= this.pages.size ()) {\r
509 throw  new IndexOutOfBoundsException ("Index: " + index + ", Tab count: " + this.pages.size ());\r
510 }}, "~N");\r
511 Clazz.defineMethod (c$, "paramString", \r
512 function () {\r
513 var tabPlacementString;\r
514 if (this.tabPlacement == 1) {\r
515 tabPlacementString = "TOP";\r
516 } else if (this.tabPlacement == 3) {\r
517 tabPlacementString = "BOTTOM";\r
518 } else if (this.tabPlacement == 2) {\r
519 tabPlacementString = "LEFT";\r
520 } else if (this.tabPlacement == 4) {\r
521 tabPlacementString = "RIGHT";\r
522 } else tabPlacementString = "";\r
523 var haveRegisteredString = (this.haveRegistered ? "true" : "false");\r
524 return Clazz.superCall (this, javax.swing.JTabbedPane, "paramString", []) + ",haveRegistered=" + haveRegisteredString + ",tabPlacement=" + tabPlacementString;\r
525 });\r
526 Clazz.defineMethod (c$, "setTabComponentAt", \r
527 function (index, component) {\r
528 if (component != null && this.indexOfComponent (component) != -1) {\r
529 throw  new IllegalArgumentException ("Component is already added to this JTabbedPane");\r
530 }var oldValue = this.getTabComponentAt (index);\r
531 if (component !== oldValue) {\r
532 var tabComponentIndex = this.indexOfTabComponent (component);\r
533 if (tabComponentIndex != -1) {\r
534 this.setTabComponentAt (tabComponentIndex, null);\r
535 }this.pages.get (index).tabComponent = component;\r
536 this.firePropertyChangeInt ("indexForTabComponent", -1, index);\r
537 }}, "~N,java.awt.Component");\r
538 Clazz.defineMethod (c$, "getTabComponentAt", \r
539 function (index) {\r
540 return this.pages.get (index).tabComponent;\r
541 }, "~N");\r
542 Clazz.defineMethod (c$, "indexOfTabComponent", \r
543 function (tabComponent) {\r
544 for (var i = 0; i < this.getTabCount (); i++) {\r
545 var c = this.getTabComponentAt (i);\r
546 if (c === tabComponent) {\r
547 return i;\r
548 }}\r
549 return -1;\r
550 }, "java.awt.Component");\r
551 c$.$JTabbedPane$ModelListener$ = function () {\r
552 Clazz.pu$h(self.c$);\r
553 c$ = Clazz.decorateAsClass (function () {\r
554 Clazz.prepareCallback (this, arguments);\r
555 Clazz.instantialize (this, arguments);\r
556 }, javax.swing.JTabbedPane, "ModelListener", null, javax.swing.event.ChangeListener);\r
557 Clazz.overrideMethod (c$, "stateChanged", \r
558 function (a) {\r
559 this.b$["javax.swing.JTabbedPane"].fireStateChanged ();\r
560 }, "javax.swing.event.ChangeEvent");\r
561 c$ = Clazz.p0p ();\r
562 };\r
563 c$.$JTabbedPane$Page$ = function () {\r
564 Clazz.pu$h(self.c$);\r
565 c$ = Clazz.decorateAsClass (function () {\r
566 Clazz.prepareCallback (this, arguments);\r
567 this.title = null;\r
568 this.background = null;\r
569 this.foreground = null;\r
570 this.icon = null;\r
571 this.disabledIcon = null;\r
572 this.parent = null;\r
573 this.component = null;\r
574 this.tip = null;\r
575 this.enabled = true;\r
576 this.mnemonic = -1;\r
577 this.mnemonicIndex = -1;\r
578 this.tabComponent = null;\r
579 Clazz.instantialize (this, arguments);\r
580 }, javax.swing.JTabbedPane, "Page");\r
581 Clazz.makeConstructor (c$, \r
582 function (a, b, c, d, e, f) {\r
583 this.title = b;\r
584 this.icon = c;\r
585 this.disabledIcon = d;\r
586 this.parent = a;\r
587 this.component = e;\r
588 this.tip = f;\r
589 }, "javax.swing.JTabbedPane,~S,javax.swing.Icon,javax.swing.Icon,java.awt.Component,~S");\r
590 Clazz.defineMethod (c$, "setMnemonic", \r
591 function (a) {\r
592 this.mnemonic = a;\r
593 this.updateDisplayedMnemonicIndex ();\r
594 }, "~N");\r
595 Clazz.defineMethod (c$, "getMnemonic", \r
596 function () {\r
597 return this.mnemonic;\r
598 });\r
599 Clazz.defineMethod (c$, "setDisplayedMnemonicIndex", \r
600 function (a) {\r
601 if (this.mnemonicIndex != a) {\r
602 if (a != -1 && (this.title == null || a < 0 || a >= this.title.length)) {\r
603 throw  new IllegalArgumentException ("Invalid mnemonic index: " + a);\r
604 }this.mnemonicIndex = a;\r
605 this.b$["javax.swing.JTabbedPane"].firePropertyChangeObject ("displayedMnemonicIndexAt", null, null);\r
606 }}, "~N");\r
607 Clazz.defineMethod (c$, "getDisplayedMnemonicIndex", \r
608 function () {\r
609 return this.mnemonicIndex;\r
610 });\r
611 Clazz.defineMethod (c$, "updateDisplayedMnemonicIndex", \r
612 function () {\r
613 this.setDisplayedMnemonicIndex (javax.swing.SwingUtilities.findDisplayedMnemonicIndex (this.title, this.mnemonic));\r
614 });\r
615 Clazz.defineMethod (c$, "getBackground", \r
616 function () {\r
617 return this.background != null ? this.background : this.parent.getBackground ();\r
618 });\r
619 Clazz.defineMethod (c$, "setBackground", \r
620 function (a) {\r
621 this.background = a;\r
622 }, "java.awt.Color");\r
623 Clazz.defineMethod (c$, "getForeground", \r
624 function () {\r
625 return this.foreground != null ? this.foreground : this.parent.getForeground ();\r
626 });\r
627 Clazz.defineMethod (c$, "setForeground", \r
628 function (a) {\r
629 this.foreground = a;\r
630 }, "java.awt.Color");\r
631 Clazz.defineMethod (c$, "isEnabled", \r
632 function () {\r
633 return this.enabled;\r
634 });\r
635 Clazz.defineMethod (c$, "setEnabled", \r
636 function (a) {\r
637 this.enabled = a;\r
638 }, "~B");\r
639 Clazz.defineMethod (c$, "isVisible", \r
640 function () {\r
641 return this.parent.isVisible ();\r
642 });\r
643 Clazz.defineMethod (c$, "setVisible", \r
644 function (a) {\r
645 this.parent.setVisible (a);\r
646 }, "~B");\r
647 Clazz.defineMethod (c$, "isShowing", \r
648 function () {\r
649 return this.parent.isShowing ();\r
650 });\r
651 Clazz.defineMethod (c$, "contains", \r
652 function (a) {\r
653 var b = this.getBounds ();\r
654 return b.contains (a);\r
655 }, "java.awt.Point");\r
656 Clazz.defineMethod (c$, "getLocationOnScreen", \r
657 function () {\r
658 var a = this.parent.getLocationOnScreen ();\r
659 var b = this.getLocation ();\r
660 b.translate (a.x, a.y);\r
661 return b;\r
662 });\r
663 Clazz.defineMethod (c$, "getLocation", \r
664 function () {\r
665 var a = this.getBounds ();\r
666 return  new java.awt.Point (a.x, a.y);\r
667 });\r
668 Clazz.defineMethod (c$, "getBounds", \r
669 function () {\r
670 return this.parent.getUI ().getTabBounds (this.parent, this.parent.indexOfTab (this.title));\r
671 });\r
672 c$ = Clazz.p0p ();\r
673 };\r
674 Clazz.defineStatics (c$,\r
675 "WRAP_TAB_LAYOUT", 0,\r
676 "SCROLL_TAB_LAYOUT", 1,\r
677 "$uiClassID", "TabbedPaneUI");\r
678 });\r