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