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