JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / swingjs / j2s / javax / swing / AbstractAction.js
1 Clazz.declarePackage ("javax.swing");\r
2 Clazz.load (["javax.swing.Action", "$.ArrayTable"], "javax.swing.AbstractAction", ["java.lang.Boolean", "javax.swing.event.SwingPropertyChangeSupport"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.enabled = true;\r
5 this.arrayTable = null;\r
6 this.changeSupport = null;\r
7 Clazz.instantialize (this, arguments);\r
8 }, javax.swing, "AbstractAction", null, [javax.swing.Action, Cloneable]);\r
9 c$.shouldReconfigure = Clazz.defineMethod (c$, "shouldReconfigure", \r
10 function (e) {\r
11 if (e.getPropertyName () == null) {\r
12 javax.swing.AbstractAction.RECONFIGURE_ON_NULL = new Boolean (false);\r
13 }return false;\r
14 }, "java.beans.PropertyChangeEvent");\r
15 c$.setEnabledFromAction = Clazz.defineMethod (c$, "setEnabledFromAction", \r
16 function (c, a) {\r
17 c.setEnabled ((a != null) ? a.isEnabled () : true);\r
18 }, "javax.swing.JComponent,javax.swing.Action");\r
19 c$.setToolTipTextFromAction = Clazz.defineMethod (c$, "setToolTipTextFromAction", \r
20 function (c, a) {\r
21 c.setToolTipText (a != null ? a.getValue ("ShortDescription") : null);\r
22 }, "javax.swing.JComponent,javax.swing.Action");\r
23 c$.hasSelectedKey = Clazz.defineMethod (c$, "hasSelectedKey", \r
24 function (a) {\r
25 return (a != null && a.getValue ("SwingSelectedKey") != null);\r
26 }, "javax.swing.Action");\r
27 c$.isSelected = Clazz.defineMethod (c$, "isSelected", \r
28 function (a) {\r
29 return Boolean.TRUE.equals (a.getValue ("SwingSelectedKey"));\r
30 }, "javax.swing.Action");\r
31 Clazz.makeConstructor (c$, \r
32 function () {\r
33 });\r
34 Clazz.makeConstructor (c$, \r
35 function (name) {\r
36 this.putValue ("Name", name);\r
37 }, "~S");\r
38 Clazz.makeConstructor (c$, \r
39 function (name, icon) {\r
40 this.construct (name);\r
41 this.putValue ("SmallIcon", icon);\r
42 }, "~S,javax.swing.Icon");\r
43 Clazz.defineMethod (c$, "getValue", \r
44 function (key) {\r
45 if (key === "enabled") {\r
46 return this.enabled;\r
47 }if (this.arrayTable == null) {\r
48 return null;\r
49 }return this.arrayTable.get (key);\r
50 }, "~S");\r
51 Clazz.overrideMethod (c$, "putValue", \r
52 function (key, newValue) {\r
53 var oldValue = null;\r
54 if (key === "enabled") {\r
55 if (newValue == null || !(Clazz.instanceOf (newValue, Boolean))) {\r
56 newValue = new Boolean (false);\r
57 }oldValue = new Boolean (this.enabled);\r
58 this.enabled = (newValue).booleanValue ();\r
59 } else {\r
60 if (this.arrayTable == null) {\r
61 this.arrayTable =  new javax.swing.ArrayTable ();\r
62 }if (this.arrayTable.containsKey (key)) oldValue = this.arrayTable.get (key);\r
63 if (newValue == null) {\r
64 this.arrayTable.remove (key);\r
65 } else {\r
66 this.arrayTable.put (key, newValue);\r
67 }}this.firePropertyChange (key, oldValue, newValue);\r
68 }, "~S,~O");\r
69 Clazz.defineMethod (c$, "isEnabled", \r
70 function () {\r
71 return this.enabled;\r
72 });\r
73 Clazz.overrideMethod (c$, "setEnabled", \r
74 function (newValue) {\r
75 var oldValue = this.enabled;\r
76 if (oldValue != newValue) {\r
77 this.enabled = newValue;\r
78 this.firePropertyChange ("enabled", Boolean.$valueOf (oldValue), Boolean.$valueOf (newValue));\r
79 }}, "~B");\r
80 Clazz.defineMethod (c$, "getKeys", \r
81 function () {\r
82 if (this.arrayTable == null) {\r
83 return null;\r
84 }var keys =  new Array (this.arrayTable.size ());\r
85 this.arrayTable.getKeys (keys);\r
86 return keys;\r
87 });\r
88 Clazz.defineMethod (c$, "firePropertyChange", \r
89 function (propertyName, oldValue, newValue) {\r
90 if (this.changeSupport == null || (oldValue != null && newValue != null && oldValue.equals (newValue))) {\r
91 return;\r
92 }this.changeSupport.firePropertyChange (propertyName, oldValue, newValue);\r
93 }, "~S,~O,~O");\r
94 Clazz.overrideMethod (c$, "addPropertyChangeListener", \r
95 function (listener) {\r
96 if (this.changeSupport == null) {\r
97 this.changeSupport =  new javax.swing.event.SwingPropertyChangeSupport (this);\r
98 }this.changeSupport.addPropertyChangeListener (listener);\r
99 }, "java.beans.PropertyChangeListener");\r
100 Clazz.overrideMethod (c$, "removePropertyChangeListener", \r
101 function (listener) {\r
102 if (this.changeSupport == null) {\r
103 return;\r
104 }this.changeSupport.removePropertyChangeListener (listener);\r
105 }, "java.beans.PropertyChangeListener");\r
106 Clazz.defineMethod (c$, "getPropertyChangeListeners", \r
107 function () {\r
108 if (this.changeSupport == null) {\r
109 return  new Array (0);\r
110 }return this.changeSupport.getPropertyChangeListeners ();\r
111 });\r
112 Clazz.defineMethod (c$, "clone", \r
113 function () {\r
114 var newAction = Clazz.superCall (this, javax.swing.AbstractAction, "clone", []);\r
115 {\r
116 if (this.arrayTable != null) {\r
117 newAction.arrayTable = this.arrayTable.clone ();\r
118 }}return newAction;\r
119 });\r
120 Clazz.defineStatics (c$,\r
121 "RECONFIGURE_ON_NULL", null);\r
122 });\r