OSDN Git Service

Version 0.6.57, fixed NS of X.UI & X.Class for __proto__.
[pettanr/clientJs.git] / 0.6.x / js / 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                 Constructor : function( layout, args ){\r
8                         \r
9                         this.SuperConstructor( layout, args );\r
10                         \r
11                         // xnode の追加が可能\r
12                         \r
13                         var uinodes = this.uinodes,\r
14                                 i     = uinodes.length,\r
15                                 node;\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         }\r
33 );\r
34 \r
35 X.UI.ChromeBox = X.UI.Box.inherits(\r
36         'ChromeBox',\r
37         X.Class.SUPER_ACCESS,\r
38         X.UI._ChromeBox,\r
39         {\r
40                 Constructor : function(){\r
41                         X.Class._newPrivate( this, X.UI.Layout.Canvas, arguments );\r
42                 },\r
43                 add : function( node /* , node, node ... */ ){\r
44                         X.Class._getPrivate( this ).containerNode.addAt( this.numNodes(), Array.prototype.slice.call( arguments ) );\r
45                         return this;\r
46                 },\r
47                 addAt : function( index, node /* , node, node ... */ ){\r
48                         X.Class._getPrivate( this ).containerNode.addAt( index, Array.prototype.slice.call( arguments, 1 ) );\r
49                         return this;\r
50                 },\r
51                 remove : function( node /* , node, node ... */ ){\r
52                         X.Class._getPrivate( this ).containerNode.remove( arguments );\r
53                         return this;\r
54                 },\r
55                 removeAt : function( from, length ){\r
56                         X.Class._getPrivate( this ).containerNode.removeAt( from, length );\r
57                         return this;\r
58                 },\r
59                 getNodesByClass : function( klass ){\r
60                         return X.Class._getPrivate( this ).containerNode.User.getNodesByClass( klass );\r
61                 },\r
62                 getFirstChild : function(){\r
63                         return X.Class._getPrivate( this ).containerNode.User.getFirstChild();\r
64                 },\r
65                 getLastChild : function(){\r
66                         return X.Class._getPrivate( this ).containerNode.User.getLastChild();\r
67                 },\r
68                 getNodeByUID : function( uid ){\r
69                         return X.Class._getPrivate( this ).containerNode.User.getNodeByUID();\r
70                 },\r
71                 getNodeAt : function( index ){\r
72                         return X.Class._getPrivate( this ).containerNode.User.getNodeAt( index );\r
73                 },\r
74                 numNodes : function(){\r
75                         return X.Class._getPrivate( this ).containerNode.User.numNodes();\r
76                 },\r
77                 getContainerNode : function(){\r
78                         return X.Class._getPrivate( this ).containerNode.User;\r
79                 },\r
80                 getChromeNodeAt : function( index ){\r
81                         if( index < 0 ) return null;\r
82                         var nodes = X.Class._getPrivate( this ).chromeNodes;\r
83                         return nodes ? nodes[ index ].User || null : null;\r
84                 },\r
85                 numChromeNodes : function(){\r
86                         var nodes = X.Class._getPrivate( this ).chromeNodes;\r
87                         return nodes ? nodes.length : 0;\r
88                 }\r
89         }\r
90 );