360cb23584bb5c524c8db3f927dc80166a2d723b
[jalviewjs.git] / site / j2s / javax / swing / ComponentInputMap.js
1 Clazz.declarePackage ("javax.swing");\r
2 Clazz.load (["javax.swing.InputMap"], "javax.swing.ComponentInputMap", ["java.lang.IllegalArgumentException"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.component = null;\r
5 Clazz.instantialize (this, arguments);\r
6 }, javax.swing, "ComponentInputMap", javax.swing.InputMap);\r
7 Clazz.makeConstructor (c$, \r
8 function (component) {\r
9 Clazz.superConstructor (this, javax.swing.ComponentInputMap, []);\r
10 this.component = component;\r
11 if (component == null) {\r
12 throw  new IllegalArgumentException ("ComponentInputMaps must be associated with a non-null JComponent");\r
13 }}, "javax.swing.JComponent");\r
14 Clazz.defineMethod (c$, "setParent", \r
15 function (map) {\r
16 if (this.getParent () === map) {\r
17 return;\r
18 }if (map != null && (!(Clazz.instanceOf (map, javax.swing.ComponentInputMap)) || (map).getComponent () !== this.getComponent ())) {\r
19 throw  new IllegalArgumentException ("ComponentInputMaps must have a parent ComponentInputMap associated with the same component");\r
20 }Clazz.superCall (this, javax.swing.ComponentInputMap, "setParent", [map]);\r
21 this.getComponent ().componentInputMapChanged (this);\r
22 }, "javax.swing.InputMap");\r
23 Clazz.defineMethod (c$, "getComponent", \r
24 function () {\r
25 return this.component;\r
26 });\r
27 Clazz.defineMethod (c$, "put", \r
28 function (keyStroke, actionMapKey) {\r
29 Clazz.superCall (this, javax.swing.ComponentInputMap, "put", [keyStroke, actionMapKey]);\r
30 if (this.getComponent () != null) {\r
31 this.getComponent ().componentInputMapChanged (this);\r
32 }}, "javax.swing.KeyStroke,~O");\r
33 Clazz.defineMethod (c$, "remove", \r
34 function (key) {\r
35 Clazz.superCall (this, javax.swing.ComponentInputMap, "remove", [key]);\r
36 if (this.getComponent () != null) {\r
37 this.getComponent ().componentInputMapChanged (this);\r
38 }}, "javax.swing.KeyStroke");\r
39 Clazz.defineMethod (c$, "clear", \r
40 function () {\r
41 var oldSize = this.size ();\r
42 Clazz.superCall (this, javax.swing.ComponentInputMap, "clear", []);\r
43 if (oldSize > 0 && this.getComponent () != null) {\r
44 this.getComponent ().componentInputMapChanged (this);\r
45 }});\r
46 });\r