OSDN Git Service

Version 0.6.133, fix for closure compiler - ADVANCED_OPTIMIZATIONS
[pettanr/clientJs.git] / 0.6.x / js / 20_ui / 14_ChromeBox.js
1 X.UI._ChromeBox = X.UI._Box.inherits(\r
2         '_ChromeBox',\r
3         X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS,\r
4         {\r
5                 chromeNodes   : null,\r
6                 containerNode : null,\r
7                 \r
8                 Constructor : function( layout, args ){\r
9                         var uinodes, i, l, node, after, index = 0;\r
10                         \r
11                         this.Super( layout, args );\r
12 \r
13                         uinodes = this.uinodes;\r
14                         l = i   = uinodes.length;\r
15 \r
16                         for( ; i; ){\r
17                                 node = uinodes[ --i ];\r
18                                 if( node.forContainer === true ){\r
19                                         if( this.containerNode ){\r
20                                                 //throw new Error( 'ContainerNode が複数設定されています!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' + node );\r
21                                         };\r
22                                         this.containerNode = node;\r
23                                 } else {\r
24                                         if( !this.chromeNodes  ) this.chromeNodes = [];\r
25                                         this.chromeNodes[ this.chromeNodes.length ] = node;\r
26                                 };\r
27                         };\r
28                         if( !this.containerNode ){\r
29                                 //throw new Error( 'ContainerNode が設定されてい\ません!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' );\r
30                         };\r
31                         \r
32                         for( i = 0, l = args.length; i < l; ++i ){\r
33                                 node = args[ i ];\r
34                                 if( node === this.containerNode ){\r
35                                         after = true;\r
36                                         index = 0;\r
37                                 };\r
38                                 if( node.instanceOf && node.instanceOf( Node ) ){\r
39                                         \r
40                                 };\r
41                         };\r
42                 }\r
43         }\r
44 );\r
45 \r
46 X.UI.ChromeBox = X.UI.Box.inherits(\r
47         'ChromeBox',\r
48         X.Class.SUPER_ACCESS,\r
49         X.UI._ChromeBox,\r
50         {\r
51                 Constructor : function(){\r
52                         X_Class_newPrivate( this, X.UI.Layout.Canvas, arguments );\r
53                 },\r
54                 add : function( node /* , node, node ... */ ){\r
55                         X_Class_getPrivate( this ).containerNode.addAt( this.numNodes(), Array.prototype.slice.call( arguments ) );\r
56                         return this;\r
57                 },\r
58                 addAt : function( index, node /* , node, node ... */ ){\r
59                         X_Class_getPrivate( this ).containerNode.addAt( index, Array.prototype.slice.call( arguments, 1 ) );\r
60                         return this;\r
61                 },\r
62                 remove : function( node /* , node, node ... */ ){\r
63                         X_Class_getPrivate( this ).containerNode.remove( arguments );\r
64                         return this;\r
65                 },\r
66                 removeAt : function( from, length ){\r
67                         X_Class_getPrivate( this ).containerNode.removeAt( from, length );\r
68                         return this;\r
69                 },\r
70                 getNodesByClass : function( klass ){\r
71                         return X_Class_getPrivate( this ).containerNode.User.getNodesByClass( klass );\r
72                 },\r
73                 getFirstChild : function(){\r
74                         return X_Class_getPrivate( this ).containerNode.User.getFirstChild();\r
75                 },\r
76                 getLastChild : function(){\r
77                         return X_Class_getPrivate( this ).containerNode.User.getLastChild();\r
78                 },\r
79                 getNodeByUID : function( uid ){\r
80                         return X_Class_getPrivate( this ).containerNode.User.getNodeByUID();\r
81                 },\r
82                 getNodeAt : function( index ){\r
83                         return X_Class_getPrivate( this ).containerNode.User.getNodeAt( index );\r
84                 },\r
85                 numNodes : function(){\r
86                         return X_Class_getPrivate( this ).containerNode.User.numNodes();\r
87                 },\r
88                 getContainerNode : function(){\r
89                         return X_Class_getPrivate( this ).containerNode.User;\r
90                 },\r
91                 getChromeNodeAt : function( index ){\r
92                         if( index < 0 ) return null;\r
93                         var nodes = X_Class_getPrivate( this ).chromeNodes;\r
94                         return nodes ? nodes[ index ].User || null : null;\r
95                 },\r
96                 numChromeNodes : function(){\r
97                         var nodes = X_Class_getPrivate( this ).chromeNodes;\r
98                         return nodes ? nodes.length : 0;\r
99                 }\r
100         }\r
101 );