c2d7e9be22517acad15dc43c5d824cfa850b9f75
[jalviewjs.git] / site / j2s / javax / swing / colorchooser / AbstractColorChooserPanel.js
1 Clazz.declarePackage ("javax.swing.colorchooser");\r
2 Clazz.load (["javax.swing.JPanel", "javax.swing.event.ChangeListener"], "javax.swing.colorchooser.AbstractColorChooserPanel", ["java.lang.RuntimeException", "javax.swing.UIManager"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.chooser = null;\r
5 this.colorListener = null;\r
6 this.dirty = true;\r
7 if (!Clazz.isClassDefined ("javax.swing.colorchooser.AbstractColorChooserPanel.ModelListener")) {\r
8 javax.swing.colorchooser.AbstractColorChooserPanel.$AbstractColorChooserPanel$ModelListener$ ();\r
9 }\r
10 Clazz.instantialize (this, arguments);\r
11 }, javax.swing.colorchooser, "AbstractColorChooserPanel", javax.swing.JPanel);\r
12 Clazz.defineMethod (c$, "getMnemonic", \r
13 function () {\r
14 return 0;\r
15 });\r
16 Clazz.defineMethod (c$, "getDisplayedMnemonicIndex", \r
17 function () {\r
18 return -1;\r
19 });\r
20 Clazz.defineMethod (c$, "installChooserPanel", \r
21 function (enclosingChooser) {\r
22 if (this.chooser != null) {\r
23 throw  new RuntimeException ("This chooser panel is already installed");\r
24 }this.chooser = enclosingChooser;\r
25 this.buildChooser ();\r
26 this.updateChooser ();\r
27 this.colorListener = Clazz.innerTypeInstance (javax.swing.colorchooser.AbstractColorChooserPanel.ModelListener, this, null);\r
28 this.getColorSelectionModel ().addChangeListener (this.colorListener);\r
29 }, "javax.swing.JColorChooser");\r
30 Clazz.defineMethod (c$, "uninstallChooserPanel", \r
31 function (enclosingChooser) {\r
32 this.getColorSelectionModel ().removeChangeListener (this.colorListener);\r
33 this.chooser = null;\r
34 }, "javax.swing.JColorChooser");\r
35 Clazz.defineMethod (c$, "getColorSelectionModel", \r
36 function () {\r
37 return this.chooser.getSelectionModel ();\r
38 });\r
39 Clazz.defineMethod (c$, "getColorFromModel", \r
40 function () {\r
41 return this.getColorSelectionModel ().getSelectedColor ();\r
42 });\r
43 Clazz.defineMethod (c$, "paint", \r
44 function (g) {\r
45 if (this.dirty) {\r
46 this.updateChooser ();\r
47 this.dirty = false;\r
48 }Clazz.superCall (this, javax.swing.colorchooser.AbstractColorChooserPanel, "paint", [g]);\r
49 }, "java.awt.Graphics");\r
50 c$.getInt = Clazz.defineMethod (c$, "getInt", \r
51 function (key, defaultValue) {\r
52 var value = javax.swing.UIManager.get (key);\r
53 if (Clazz.instanceOf (value, Integer)) {\r
54 return (value).intValue ();\r
55 }if (Clazz.instanceOf (value, String)) {\r
56 try {\r
57 return Integer.parseInt (value);\r
58 } catch (nfe) {\r
59 if (Clazz.exceptionOf (nfe, NumberFormatException)) {\r
60 } else {\r
61 throw nfe;\r
62 }\r
63 }\r
64 }return defaultValue;\r
65 }, "~O,~N");\r
66 c$.$AbstractColorChooserPanel$ModelListener$ = function () {\r
67 Clazz.pu$h(self.c$);\r
68 c$ = Clazz.decorateAsClass (function () {\r
69 Clazz.prepareCallback (this, arguments);\r
70 Clazz.instantialize (this, arguments);\r
71 }, javax.swing.colorchooser.AbstractColorChooserPanel, "ModelListener", null, javax.swing.event.ChangeListener);\r
72 Clazz.overrideMethod (c$, "stateChanged", \r
73 function (a) {\r
74 if (this.b$["javax.swing.colorchooser.AbstractColorChooserPanel"].isShowing ()) {\r
75 this.b$["javax.swing.colorchooser.AbstractColorChooserPanel"].updateChooser ();\r
76 this.b$["javax.swing.colorchooser.AbstractColorChooserPanel"].dirty = false;\r
77 } else {\r
78 this.b$["javax.swing.colorchooser.AbstractColorChooserPanel"].dirty = true;\r
79 }}, "javax.swing.event.ChangeEvent");\r
80 c$ = Clazz.p0p ();\r
81 };\r
82 });\r