JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / javajs / awt / Container.js
1 Clazz.declarePackage ("javajs.awt");
2 Clazz.load (["javajs.awt.Component"], "javajs.awt.Container", ["javajs.util.Lst"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.list = null;
5 this.cList = null;
6 Clazz.instantialize (this, arguments);
7 }, javajs.awt, "Container", javajs.awt.Component);
8 Clazz.defineMethod (c$, "getComponent", 
9 function (i) {
10 return this.list.get (i);
11 }, "~N");
12 Clazz.defineMethod (c$, "getComponentCount", 
13 function () {
14 return (this.list == null ? 0 : this.list.size ());
15 });
16 Clazz.defineMethod (c$, "getComponents", 
17 function () {
18 if (this.cList == null) {
19 if (this.list == null) return  new Array (0);
20 this.cList = this.list.toArray ();
21 }return this.cList;
22 });
23 Clazz.defineMethod (c$, "add", 
24 function (component) {
25 return this.addComponent (component);
26 }, "javajs.awt.Component");
27 Clazz.defineMethod (c$, "addComponent", 
28 function (component) {
29 if (this.list == null) this.list =  new javajs.util.Lst ();
30 this.list.addLast (component);
31 this.cList = null;
32 component.parent = this;
33 return component;
34 }, "javajs.awt.Component");
35 Clazz.defineMethod (c$, "insertComponent", 
36 function (component, index) {
37 if (this.list == null) return this.addComponent (component);
38 this.list.add (index, component);
39 this.cList = null;
40 component.parent = this;
41 return component;
42 }, "javajs.awt.Component,~N");
43 Clazz.defineMethod (c$, "remove", 
44 function (i) {
45 var c = this.list.remove (i);
46 c.parent = null;
47 this.cList = null;
48 }, "~N");
49 Clazz.defineMethod (c$, "removeAll", 
50 function () {
51 if (this.list != null) {
52 for (var i = this.list.size (); --i >= 0; ) this.list.get (i).parent = null;
53
54 this.list.clear ();
55 }this.cList = null;
56 });
57 Clazz.defineMethod (c$, "getSubcomponentWidth", 
58 function () {
59 return (this.list != null && this.list.size () == 1 ? this.list.get (0).getSubcomponentWidth () : 0);
60 });
61 Clazz.defineMethod (c$, "getSubcomponentHeight", 
62 function () {
63 return (this.list != null && this.list.size () == 1 ? this.list.get (0).getSubcomponentHeight () : 0);
64 });
65 });