JAL-1807 update
[jalviewjs.git] / site / j2s / swingjs / plaf / LazyActionMap.js
1 Clazz.declarePackage ("swingjs.plaf");
2 Clazz.load (["javax.swing.plaf.ActionMapUIResource"], "swingjs.plaf.LazyActionMap", ["javax.swing.SwingUtilities", "$.UIManager"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this._loader = null;
5 Clazz.instantialize (this, arguments);
6 }, swingjs.plaf, "LazyActionMap", javax.swing.plaf.ActionMapUIResource);
7 c$.installLazyActionMap = Clazz.defineMethod (c$, "installLazyActionMap", 
8 function (c, loaderClass, defaultsKey) {
9 var map = javax.swing.UIManager.get (defaultsKey);
10 if (map == null) {
11 map =  new swingjs.plaf.LazyActionMap (loaderClass);
12 }javax.swing.SwingUtilities.replaceUIActionMap (c, map);
13 }, "javax.swing.JComponent,Class,~S");
14 c$.getActionMap = Clazz.defineMethod (c$, "getActionMap", 
15 function (loaderClass, defaultsKey) {
16 var map = javax.swing.UIManager.get (defaultsKey);
17 if (map == null) {
18 map =  new swingjs.plaf.LazyActionMap (loaderClass);
19 }return map;
20 }, "Class,~S");
21 Clazz.makeConstructor (c$, 
22  function (loader) {
23 Clazz.superConstructor (this, swingjs.plaf.LazyActionMap, []);
24 this._loader = loader;
25 }, "Class");
26 Clazz.defineMethod (c$, "put", 
27 function (action) {
28 this.put (action.getValue ("Name"), action);
29 }, "javax.swing.Action");
30 Clazz.defineMethod (c$, "put", 
31 function (key, action) {
32 this.loadIfNecessary ();
33 Clazz.superCall (this, swingjs.plaf.LazyActionMap, "put", [key, action]);
34 }, "~O,javax.swing.Action");
35 Clazz.defineMethod (c$, "get", 
36 function (key) {
37 this.loadIfNecessary ();
38 return Clazz.superCall (this, swingjs.plaf.LazyActionMap, "get", [key]);
39 }, "~O");
40 Clazz.defineMethod (c$, "remove", 
41 function (key) {
42 this.loadIfNecessary ();
43 Clazz.superCall (this, swingjs.plaf.LazyActionMap, "remove", [key]);
44 }, "~O");
45 Clazz.defineMethod (c$, "clear", 
46 function () {
47 this.loadIfNecessary ();
48 Clazz.superCall (this, swingjs.plaf.LazyActionMap, "clear", []);
49 });
50 Clazz.defineMethod (c$, "keys", 
51 function () {
52 this.loadIfNecessary ();
53 return Clazz.superCall (this, swingjs.plaf.LazyActionMap, "keys", []);
54 });
55 Clazz.defineMethod (c$, "size", 
56 function () {
57 this.loadIfNecessary ();
58 return Clazz.superCall (this, swingjs.plaf.LazyActionMap, "size", []);
59 });
60 Clazz.defineMethod (c$, "allKeys", 
61 function () {
62 this.loadIfNecessary ();
63 return Clazz.superCall (this, swingjs.plaf.LazyActionMap, "allKeys", []);
64 });
65 Clazz.defineMethod (c$, "setParent", 
66 function (map) {
67 this.loadIfNecessary ();
68 Clazz.superCall (this, swingjs.plaf.LazyActionMap, "setParent", [map]);
69 }, "javax.swing.ActionMap");
70 Clazz.defineMethod (c$, "loadIfNecessary", 
71  function () {
72 if (this._loader != null) {
73 {
74 this._loader.loadActionMap(this);
75 this._loader = null;
76 }}});
77 });