X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F20_ui%2F14_ChromeBox.js;h=06ea4a5f0b005961b22e6512a2d7972a6874a032;hb=3d352d8bf476ab57cc333e8d02d0e6ea5efa69b7;hp=065af2aac1a63122b24a8c4bbe666376f193d802;hpb=a130cabd01fde8865990a59d849f5d5d08ed2119;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/20_ui/14_ChromeBox.js b/0.6.x/js/20_ui/14_ChromeBox.js index 065af2a..06ea4a5 100644 --- a/0.6.x/js/20_ui/14_ChromeBox.js +++ b/0.6.x/js/20_ui/14_ChromeBox.js @@ -1,27 +1,28 @@ -X.UI._ChromeBox = X.UI._Box.inherits( +var XUI_ChromeBox = XUI_Box.inherits( '_ChromeBox', - X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS, + X_Class.NONE, { chromeNodes : null, containerNode : null, - Constructor : function( layout, args ){ + Constructor : function( user, layout, args ){ var uinodes, i, l, node, after, index = 0; - this.Super( layout, args ); + this[ 'Super' ]( user, layout, args ); uinodes = this.uinodes; l = i = uinodes.length; for( ; i; ){ node = uinodes[ --i ]; - if( node.forContainer === true ){ + if( node.role === 3 ){ if( this.containerNode ){ //throw new Error( 'ContainerNode が複数設定されています!ContainerNode はクロームボックスにひとつ、生成時に設定できます ' + node ); }; - this.containerNode = node; + this.containerNode = node.User; + this._containerNode = node; } else { - if( !this.chromeNodes ) this.chromeNodes = []; + if( !this.chromeNodes ) this.chromeNodes = []; this.chromeNodes[ this.chromeNodes.length ] = node; }; }; @@ -35,7 +36,7 @@ X.UI._ChromeBox = X.UI._Box.inherits( after = true; index = 0; }; - if( node.instanceOf && node.instanceOf( Node ) ){ + if( node[ 'instanceOf' ] && node[ 'instanceOf' ]( Node ) ){ }; }; @@ -45,57 +46,44 @@ X.UI._ChromeBox = X.UI._Box.inherits( X.UI.ChromeBox = X.UI.Box.inherits( 'ChromeBox', - X.Class.SUPER_ACCESS, - X.UI._ChromeBox, + X_Class.NONE, { Constructor : function(){ - X_Class_newPrivate( this, X.UI.Layout.Canvas, arguments ); + X_Pair_create( this, XUI_ChromeBox( this, XUI_Layout_Canvas, arguments ) ); }, - add : function( node /* , node, node ... */ ){ - X_Class_getPrivate( this ).containerNode.addAt( this.numNodes(), Array.prototype.slice.call( arguments ) ); + add : function( /* node, node, node ... */ ){ + X_Pair_get( this ).containerNode.addAt( this.numNodes(), X_Array_copy( arguments ) ); return this; }, - addAt : function( index, node /* , node, node ... */ ){ - X_Class_getPrivate( this ).containerNode.addAt( index, Array.prototype.slice.call( arguments, 1 ) ); + addAt : function( index /* , node, node, node ... */ ){ + var nodes; + if( index < 0 ) index = 0; + nodes = X_Array_copy( arguments ); + X_Pair_get( this ).containerNode.addAt( nodes.shift(), nodes ); return this; }, remove : function( node /* , node, node ... */ ){ - X_Class_getPrivate( this ).containerNode.remove( arguments ); + X_Pair_get( this ).containerNode.remove( arguments ); return this; }, removeAt : function( from, length ){ - X_Class_getPrivate( this ).containerNode.removeAt( from, length ); + X_Pair_get( this ).containerNode.removeAt( from, length ); return this; }, getNodesByClass : function( klass ){ - return X_Class_getPrivate( this ).containerNode.User.getNodesByClass( klass ); + return X_Pair_get( this ).containerNode.User.getNodesByClass( klass ); }, getFirstChild : function(){ - return X_Class_getPrivate( this ).containerNode.User.getFirstChild(); + return X_Pair_get( this ).containerNode.User.getFirstChild(); }, getLastChild : function(){ - return X_Class_getPrivate( this ).containerNode.User.getLastChild(); - }, - getNodeByUID : function( uid ){ - return X_Class_getPrivate( this ).containerNode.User.getNodeByUID(); + return X_Pair_get( this ).containerNode.User.getLastChild(); }, getNodeAt : function( index ){ - return X_Class_getPrivate( this ).containerNode.User.getNodeAt( index ); + return X_Pair_get( this ).containerNode.User.getNodeAt( index ); }, numNodes : function(){ - return X_Class_getPrivate( this ).containerNode.User.numNodes(); - }, - getContainerNode : function(){ - return X_Class_getPrivate( this ).containerNode.User; - }, - getChromeNodeAt : function( index ){ - if( index < 0 ) return null; - var nodes = X_Class_getPrivate( this ).chromeNodes; - return nodes ? nodes[ index ].User || null : null; - }, - numChromeNodes : function(){ - var nodes = X_Class_getPrivate( this ).chromeNodes; - return nodes ? nodes.length : 0; + return X_Pair_get( this ).containerNode.User.numNodes(); } } ); \ No newline at end of file