OSDN Git Service

Version 0.6.168, fix X.UI.Repeater.
[pettanr/clientJs.git] / 0.6.x / js / 20_ui / 14_ChromeBox.js
index 4089730..06ea4a5 100644 (file)
@@ -1,91 +1,89 @@
-X.UI._ChromeBox = X.UI._Box.inherits(\r
+var XUI_ChromeBox = XUI_Box.inherits(\r
        '_ChromeBox',\r
-       X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS,\r
+       X_Class.NONE,\r
        {\r
                chromeNodes   : null,\r
                containerNode : null,\r
                \r
-               Constructor : function( layout, args ){\r
+               Constructor : function( user, layout, args ){\r
+                       var uinodes, i, l, node, after, index = 0;\r
                        \r
-                       this.Super( layout, args );\r
-                       \r
-                       // xnode の追加が可能\r
-                       \r
-                       var uinodes = this.uinodes,\r
-                               i     = uinodes.length,\r
-                               node;\r
+                       this[ 'Super' ]( user, layout, args );\r
+\r
+                       uinodes = this.uinodes;\r
+                       l = i   = uinodes.length;\r
+\r
                        for( ; i; ){\r
                                node = uinodes[ --i ];\r
-                               if( node.forContainer === true ){\r
+                               if( node.role === 3 ){\r
                                        if( this.containerNode ){\r
                                                //throw new Error( 'ContainerNode が複数設定されています!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' + node );\r
                                        };\r
-                                       this.containerNode = node;\r
+                                       this.containerNode  = node.User;\r
+                                       this._containerNode = node;\r
                                } else {\r
-                                       if( !this.chromeNodes  ) this.chromeNodes = [];\r
+                                       if( !this.chromeNodes ) this.chromeNodes = [];\r
                                        this.chromeNodes[ this.chromeNodes.length ] = node;\r
                                };\r
                        };\r
                        if( !this.containerNode ){\r
                                //throw new Error( 'ContainerNode が設定されてい\ません!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' );\r
                        };\r
+                       \r
+                       for( i = 0, l = args.length; i < l; ++i ){\r
+                               node = args[ i ];\r
+                               if( node === this.containerNode ){\r
+                                       after = true;\r
+                                       index = 0;\r
+                               };\r
+                               if( node[ 'instanceOf' ] && node[ 'instanceOf' ]( Node ) ){\r
+                                       \r
+                               };\r
+                       };\r
                }\r
        }\r
 );\r
 \r
 X.UI.ChromeBox = X.UI.Box.inherits(\r
        'ChromeBox',\r
-       X.Class.SUPER_ACCESS,\r
-       X.UI._ChromeBox,\r
+       X_Class.NONE,\r
        {\r
                Constructor : function(){\r
-                       X_Class_newPrivate( this, X.UI.Layout.Canvas, arguments );\r
+                       X_Pair_create( this, XUI_ChromeBox( this, XUI_Layout_Canvas, arguments ) );\r
                },\r
-               add : function( node /* , node, node ... */ ){\r
-                       X_Class_getPrivate( this ).containerNode.addAt( this.numNodes(), Array.prototype.slice.call( arguments ) );\r
+               add : function( /* node, node, node ... */ ){\r
+                       X_Pair_get( this ).containerNode.addAt( this.numNodes(), X_Array_copy( arguments ) );\r
                        return this;\r
                },\r
-               addAt : function( index, node /* , node, node ... */ ){\r
-                       X_Class_getPrivate( this ).containerNode.addAt( index, Array.prototype.slice.call( arguments, 1 ) );\r
+               addAt : function( index /* , node, node, node ... */ ){\r
+                       var nodes;\r
+                       if( index < 0 ) index = 0;\r
+                       nodes = X_Array_copy( arguments );\r
+                       X_Pair_get( this ).containerNode.addAt( nodes.shift(), nodes );\r
                        return this;\r
                },\r
                remove : function( node /* , node, node ... */ ){\r
-                       X_Class_getPrivate( this ).containerNode.remove( arguments );\r
+                       X_Pair_get( this ).containerNode.remove( arguments );\r
                        return this;\r
                },\r
                removeAt : function( from, length ){\r
-                       X_Class_getPrivate( this ).containerNode.removeAt( from, length );\r
+                       X_Pair_get( this ).containerNode.removeAt( from, length );\r
                        return this;\r
                },\r
                getNodesByClass : function( klass ){\r
-                       return X_Class_getPrivate( this ).containerNode.User.getNodesByClass( klass );\r
+                       return X_Pair_get( this ).containerNode.User.getNodesByClass( klass );\r
                },\r
                getFirstChild : function(){\r
-                       return X_Class_getPrivate( this ).containerNode.User.getFirstChild();\r
+                       return X_Pair_get( this ).containerNode.User.getFirstChild();\r
                },\r
                getLastChild : function(){\r
-                       return X_Class_getPrivate( this ).containerNode.User.getLastChild();\r
-               },\r
-               getNodeByUID : function( uid ){\r
-                       return X_Class_getPrivate( this ).containerNode.User.getNodeByUID();\r
+                       return X_Pair_get( this ).containerNode.User.getLastChild();\r
                },\r
                getNodeAt : function( index ){\r
-                       return X_Class_getPrivate( this ).containerNode.User.getNodeAt( index );\r
+                       return X_Pair_get( this ).containerNode.User.getNodeAt( index );\r
                },\r
                numNodes : function(){\r
-                       return X_Class_getPrivate( this ).containerNode.User.numNodes();\r
-               },\r
-               getContainerNode : function(){\r
-                       return X_Class_getPrivate( this ).containerNode.User;\r
-               },\r
-               getChromeNodeAt : function( index ){\r
-                       if( index < 0 ) return null;\r
-                       var nodes = X_Class_getPrivate( this ).chromeNodes;\r
-                       return nodes ? nodes[ index ].User || null : null;\r
-               },\r
-               numChromeNodes : function(){\r
-                       var nodes = X_Class_getPrivate( this ).chromeNodes;\r
-                       return nodes ? nodes.length : 0;\r
+                       return X_Pair_get( this ).containerNode.User.numNodes();\r
                }\r
        }\r
 );
\ No newline at end of file