OSDN Git Service

Version 0.6.90, files & folders renamed.
[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                         \r
10                         this.SuperConstructor( layout, args );\r
11                         \r
12                         // xnode の追加が可能\r
13                         \r
14                         var uinodes = this.uinodes,\r
15                                 i     = uinodes.length,\r
16                                 node;\r
17                         for( ; i; ){\r
18                                 node = uinodes[ --i ];\r
19                                 if( node.forContainer === true ){\r
20                                         if( this.containerNode ){\r
21                                                 //throw new Error( 'ContainerNode が複数設定されています!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' + node );\r
22                                         };\r
23                                         this.containerNode = node;\r
24                                 } else {\r
25                                         if( !this.chromeNodes  ) this.chromeNodes = [];\r
26                                         this.chromeNodes[ this.chromeNodes.length ] = node;\r
27                                 };\r
28                         };\r
29                         if( !this.containerNode ){\r
30                                 //throw new Error( 'ContainerNode が設定されてい\ません!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' );\r
31                         };\r
32                 }\r
33         }\r
34 );\r
35 \r
36 X.UI.ChromeBox = X.UI.Box.inherits(\r
37         'ChromeBox',\r
38         X.Class.SUPER_ACCESS,\r
39         X.UI._ChromeBox,\r
40         {\r
41                 Constructor : function(){\r
42                         X.Class._newPrivate( this, X.UI.Layout.Canvas, arguments );\r
43                 },\r
44                 add : function( node /* , node, node ... */ ){\r
45                         X.Class._getPrivate( this ).containerNode.addAt( this.numNodes(), Array.prototype.slice.call( arguments ) );\r
46                         return this;\r
47                 },\r
48                 addAt : function( index, node /* , node, node ... */ ){\r
49                         X.Class._getPrivate( this ).containerNode.addAt( index, Array.prototype.slice.call( arguments, 1 ) );\r
50                         return this;\r
51                 },\r
52                 remove : function( node /* , node, node ... */ ){\r
53                         X.Class._getPrivate( this ).containerNode.remove( arguments );\r
54                         return this;\r
55                 },\r
56                 removeAt : function( from, length ){\r
57                         X.Class._getPrivate( this ).containerNode.removeAt( from, length );\r
58                         return this;\r
59                 },\r
60                 getNodesByClass : function( klass ){\r
61                         return X.Class._getPrivate( this ).containerNode.User.getNodesByClass( klass );\r
62                 },\r
63                 getFirstChild : function(){\r
64                         return X.Class._getPrivate( this ).containerNode.User.getFirstChild();\r
65                 },\r
66                 getLastChild : function(){\r
67                         return X.Class._getPrivate( this ).containerNode.User.getLastChild();\r
68                 },\r
69                 getNodeByUID : function( uid ){\r
70                         return X.Class._getPrivate( this ).containerNode.User.getNodeByUID();\r
71                 },\r
72                 getNodeAt : function( index ){\r
73                         return X.Class._getPrivate( this ).containerNode.User.getNodeAt( index );\r
74                 },\r
75                 numNodes : function(){\r
76                         return X.Class._getPrivate( this ).containerNode.User.numNodes();\r
77                 },\r
78                 getContainerNode : function(){\r
79                         return X.Class._getPrivate( this ).containerNode.User;\r
80                 },\r
81                 getChromeNodeAt : function( index ){\r
82                         if( index < 0 ) return null;\r
83                         var nodes = X.Class._getPrivate( this ).chromeNodes;\r
84                         return nodes ? nodes[ index ].User || null : null;\r
85                 },\r
86                 numChromeNodes : function(){\r
87                         var nodes = X.Class._getPrivate( this ).chromeNodes;\r
88                         return nodes ? nodes.length : 0;\r
89                 }\r
90         }\r
91 );