OSDN Git Service

Version 0.6.169, add doc comment.
[pettanr/clientJs.git] / 0.6.x / js / 20_ui / 06_AbstractUINode.js
index 249bec3..5e0dce7 100644 (file)
@@ -1,7 +1,10 @@
+// TODO -> Node[ 'inherits' ]\r
 var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](\r
        'X.UI._AbstractUINode',\r
-       X_Class.ABSTRACT | X_Class.PRIVATE_DATA,\r
+       X_Class.ABSTRACT,\r
        {\r
+               itemData          : null,\r
+               \r
                phase             : 0,\r
                dirty             : XUI_Dirty.CLEAN,\r
                \r
@@ -12,7 +15,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                parentData        : null,\r
                xnode             : null,\r
 \r
-               supportAttrs      : XUI_Attr_Support,\r
+               usableAttrs       : XUI_Attr_Support,\r
                attrClass         : XUI_AttrClass,\r
                attrObject        : null,\r
                unverifiedAttrs   : null,\r
@@ -30,28 +33,30 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                \r
                boxX              : 0,\r
                boxY              : 0,\r
-               scrollWidth       : 0, // remove?\r
-               scrollHeight      : 0, // remove?\r
                boxWidth          : XUI_Attr_AUTO,\r
-               minBoxWidth       : 0,\r
-               maxBoxWidth       : XUI_Attr_AUTO,      \r
+               boxWidthMin       : 0,\r
+               boxWidthMax       : XUI_Attr_AUTO,      \r
                boxHeight         : XUI_Attr_AUTO,\r
-               minBoxHeight      : 0,\r
-               maxBoxHeight      : XUI_Attr_AUTO,\r
+               boxHeightMin      : 0,\r
+               boxHeightMax      : XUI_Attr_AUTO,\r
                contentL          : 0,\r
                contentT          : 0,\r
                contentR          : 0,\r
                contentB          : 0,\r
+               paddingL          : 0,\r
+               paddingT          : 0,\r
+               borderL           : 0,\r
+               borderT           : 0,\r
                boxSizingOffsetLR : 0,\r
                boxSizingOffsetTB : 0,          \r
                contentWidth      : XUI_Attr_AUTO,\r
-               minContentWidth   : 0,\r
-               maxContentWidth   : XUI_Attr_AUTO,\r
-               lastContentWidth  : -1,\r
+               contentWidthMin   : 0,\r
+               contentWidthMax   : XUI_Attr_AUTO,\r
+               contentWidthLast  : -1,\r
                contentHeight     : XUI_Attr_AUTO,\r
-               minContentHeight  : 0,\r
-               maxContentHeight  : XUI_Attr_AUTO,\r
-               lastContentHeight : -1,\r
+               contentHeightMin  : 0,\r
+               contentHeightMax  : XUI_Attr_AUTO,\r
+               contentHeightLast : -1,\r
                \r
                constraintW       : false,\r
                constraintH       : false,\r
@@ -68,15 +73,27 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                        this.rootData   = rootData;\r
                        this.parent     = parent;\r
                        this.parentData = parentData;\r
-                       //this.xnode      = X_Doc_create( 'div' );\r
                        this.phase      = 1;\r
                        \r
                        this[ 'dispatch' ]( XUI_Event.INIT );\r
                },\r
                \r
                addToParent : function( xnodeParent ){\r
+                       var attr = this.attrObject || this.attrClass.prototype,\r
+                               usableAttrs = this.usableAttrs,\r
+                               i = 0, l = usableAttrs.length, def;\r
+                       \r
                        xnodeParent && xnodeParent[ 'append' ]( this.xnode );\r
                        \r
+                       if( attr ){\r
+                               for( k in usableAttrs ){\r
+                                       def = usableAttrs[ k ];\r
+                                       if( def[ 2 ] === XUI_Attr_USER.XNODE && X_Object_inObject( def.No, attr ) && attr[ k ] !== def[ 0 ] ){\r
+                                               this.xnode[ 'css' ]( XUI_Attr_Rename[ k ] || k, XUI_AbstractUINode_createCssText( this, k ) );\r
+                                       };\r
+                               };\r
+                       };\r
+                       \r
                        this.phase = 2;\r
                        this[ 'dispatch' ]( XUI_Event.ADDED );\r
                },\r
@@ -89,6 +106,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                        this.User[ 'dispatch' ]( XUI_Event.CREATION_COMPLETE );\r
                        \r
                        // html 要素が親に追加されるまで控えていたイベントの登録\r
+                       // TODO listenOnce\r
                        if( events && ( l = events.length ) ){\r
                                for( i = 0; i < l; ++i ){\r
                                        this.listen.apply( this, events[ i ] );\r
@@ -227,6 +245,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
 \r
                        if( !v && v !== 0 ) v = defaultVal;\r
                        \r
+                       // UIAttrClass の初期設定の場合、ここで終わる\r
                        if( XUI_attrClassProto ){\r
                                attrs[ propID ] = v;\r
                                return;                 \r
@@ -277,7 +296,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
 \r
                getAttr : function( name ){\r
                        var attrs   = this.attrObject || this.attrClass.prototype || XUI_AttrClass,\r
-                               support = this.supportAttrs[ name ],\r
+                               support = this.usableAttrs[ name ],\r
                 v, type, list;\r
                        if( !support ) return;\r
                        \r
@@ -348,19 +367,21 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                        };\r
                },\r
                \r
-               /**\r
+               /*\r
                 * X_Node_BoxModel の情報を引きながら top,left,width,height,padding,border の設定\r
                 */\r
                updateLayout : function(){\r
-                       var x = this.boxX,\r
-                               y = this.boxY;\r
+                       var x = this.boxX + ( this.parentData ? this.parentData.paddingL : 0 ),\r
+                               y = this.boxY + ( this.parentData ? this.parentData.paddingT : 0 ),\r
+                               w = X_UA[ 'IE5x' ] ? this.boxWidth  : this.contentWidth, // IE6 の互換モードも\r
+                               h = X_UA[ 'IE5x' ] ? this.boxHeight : this.contentHeight;\r
 \r
                        this.xnode\r
-                               [ 'css' ]( 'left',        x ? x + 'em' : 0 )\r
-                               [ 'css' ]( 'top',         y ? y + 'em' : 0 )\r
-                               [ 'css' ]( 'width',       this.noWidth  ? 'auto' : this.contentWidth  ? this.contentWidth  + 'em' : 0 )\r
-                               [ 'css' ]( 'height',      this.noHeight ? 'auto' : this.contentHeight ? this.contentHeight + 'em' : 0 )\r
-                               [ 'css' ]( 'padding',     XUI_AbstractUINode_createCssText( this, 'padding' ) )\r
+                               [ 'css' ]( 'left',        x ? x + 'em' : 0 ) // 親の padding 分ずらす\r
+                               [ 'css' ]( 'top',         y ? y + 'em' : 0 ) // 親の padding 分ずらす\r
+                               [ 'css' ]( 'width',       this.noWidth  ? 'auto' : w ? w + 'em' : 0 )\r
+                               [ 'css' ]( 'height',      this.noHeight ? 'auto' : h ? h + 'em' : 0 )\r
+                               [ 'css' ]( 'padding',     XUI_AbstractUINode_createCssText( this, 'padding' ) ) // TODO 不要? その分 w, h に足す\r
                                [ 'css' ]( 'borderWidth', XUI_AbstractUINode_createCssText( this, 'borderWidth' ) );\r
                },\r
 \r
@@ -394,6 +415,8 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                        };\r
                        this.contentL = borderL + paddingL;\r
                        this.contentR = borderR + paddingR;\r
+                       this.paddingL = paddingL;\r
+                       this.borderL  = borderL;\r
                        \r
                        if( this.constraintW ? allowedW !== XUI_Attr_AUTO : !this.autoWidth && ( allowedW !== XUI_Attr_AUTO || !this.percentWidth ) ){\r
                                if( this.constraintW ){ // 制約レイアウト\r
@@ -401,24 +424,21 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                } else {\r
                                        contentW = XUI_AbstractUINode_calcFinalValue( attrs[ XUI_Attr_Support.width.No ], attrs[ XUI_Attr_Support.minWidth.No ], attrs[ XUI_Attr_Support.maxWidth.No ], allowedW );                                     \r
                                };\r
-                               this.contentWidth = contentW + boxMinus;\r
-                               //this.scrollWidth  = this.contentWidth + this.contentL + this.contentR;\r
-                               this.boxWidth     = contentW - boxMinus + this.contentL + this.contentR;\r
+                               this.contentWidth      = contentW + boxMinus;\r
+                               this.boxWidth          = this.contentWidth + this.contentL + this.contentR;\r
                                this.boxSizingOffsetLR = boxMinus;\r
-                               delete this.minContentWidth;\r
-                               delete this.maxContentWidth;\r
-                               delete this.minBoxWidth;\r
-                               delete this.maxBoxWidth;\r
+                               delete this.contentWidthMin;\r
+                               delete this.contentWidthMax;\r
+                               delete this.boxWidthMin;\r
+                               delete this.boxWidthMax;\r
                        } else {        \r
-                               this.minContentWidth = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minWidth.No ], allowedW ) + boxMinus );\r
-                               this.maxContentWidth = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxWidth.No ], allowedW ) + boxMinus );\r
-                               //this.scrollWidth     = this.contentWidth + this.contentL + this.contentR;\r
-                               this.minBoxWidth     = this.minContentWidth - boxMinus + this.contentL + this.contentR;\r
-                               this.maxBoxWidth     = this.maxContentWidth - boxMinus + this.contentL + this.contentR;\r
-                               //delete this.contentWidth;\r
-                               //delete this.scrollWidth;\r
-                               //delete this.boxWidth;\r
-                               //delete this.boxSizingOffsetLR;\r
+                               this.contentWidthMin   = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minWidth.No ], allowedW ) + boxMinus );\r
+                               this.contentWidthMax   = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxWidth.No ], allowedW ) + boxMinus );\r
+                               this.boxWidthMin       = this.contentWidthMin + this.contentL + this.contentR;\r
+                               this.boxWidthMax       = this.contentWidthMax + this.contentL + this.contentR;\r
+                               this.contentWidth      = this.contentWidthMin;\r
+                               this.boxWidth          = this.boxWidthMin;\r
+                               this.boxSizingOffsetLR = boxMinus;\r
                        };\r
                        \r
                        paddingT  = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.padding.No + 0 ], allowedH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して\r
@@ -435,6 +455,8 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                        };\r
                        this.contentT = borderT + paddingT;\r
                        this.contentB = borderB + paddingB;\r
+                       this.paddingT = paddingT;\r
+                       this.borderT  = borderT;\r
                        \r
                        // Height\r
                        if( this.constraintH ? allowedH !== XUI_Attr_AUTO : !this.autoHeight && ( allowedH !== XUI_Attr_AUTO || !this.percentHeight ) ){\r
@@ -443,44 +465,37 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                } else {\r
                                        contentH = XUI_AbstractUINode_calcFinalValue( attrs[ XUI_Attr_Support.height.No ], attrs[ XUI_Attr_Support.minHeight.No ], attrs[ XUI_Attr_Support.maxHeight.No ], allowedH );\r
                                };                      \r
-                               this.contentHeight = contentH + boxMinus;\r
-                               //this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
-                               this.boxHeight     = contentH - boxMinus + this.contentT + this.contentB; // padding-box の場合 border だけ足される\r
+                               this.contentHeight     = contentH + boxMinus;\r
+                               this.boxHeight         = this.contentHeight + this.contentT + this.contentB; // padding-box の場合 border だけ足される\r
                                this.boxSizingOffsetTB = boxMinus;\r
-                               delete this.minContentHeight;\r
-                               delete this.maxContentHeight;\r
-                               delete this.minBoxHeight;\r
-                               delete this.maxBoxHeight;\r
+                               delete this.contentHeightMin;\r
+                               delete this.contentHeightMax;\r
+                               delete this.boxHeightMin;\r
+                               delete this.boxHeightMax;\r
                        } else {\r
-                               this.minContentHeight = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minHeight.No ], allowedH ) + boxMinus );\r
-                               this.maxContentHeight = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxHeight.No ], allowedH ) + boxMinus );                         \r
-                               this.minBoxHeight = this.minContentHeight - boxMinus + this.contentT + this.contentB;\r
-                               this.maxBoxHeight = this.maxContentHeight - boxMinus + this.contentT + this.contentB;\r
-               \r
-                               //delete this.contentHeight;\r
-                               //delete this.scrollHeight;\r
-                               //delete this.boxHeight;\r
-                               //delete this.boxSizingOffsetTB;\r
+                               this.contentHeightMin  = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minHeight.No ], allowedH ) + boxMinus );\r
+                               this.contentHeightMax  = XUI_AbstractUINode_ceil( XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxHeight.No ], allowedH ) + boxMinus );                                \r
+                               this.boxHeightMin      = this.contentHeightMin + this.contentT + this.contentB;\r
+                               this.boxHeightMax      = this.contentHeightMax + this.contentT + this.contentB;\r
+                               this.contentHeight     = this.contentHeightMin;\r
+                               this.boxHeight         = this.boxHeightMin;\r
+                               this.boxSizingOffsetTB = boxMinus;\r
                        };\r
                        \r
+                       // x\r
                        if( this.parentData && this.parentData.layout.overrideAttrsForChild.left ){\r
-                               if( this.constraintW ){\r
-                                       this.boxX = ( boxL || boxL === 0 ) ? boxL : XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.left.No ], allowedW );\r
-                               } else\r
-                               if( attrs[ XUI_Attr_Support.right.No ] === null ){\r
+                               if( this.constraintW || attrs[ XUI_Attr_Support.right.No ] === null ){\r
                                        this.boxX = ( boxL || boxL === 0 ) ? boxL : XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.left.No ], allowedW );\r
                                } else {\r
-                                       this.boxX = alllowW - this.boxWidth - ( ( boxR || boxR === 0 ) ? boxR : XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.right.No ], allowedW ) );\r
+                                       this.boxX = allowedW - this.boxWidth - ( ( boxR || boxR === 0 ) ? boxR : XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.right.No ], allowedW ) );\r
                                };\r
                        } else {\r
                                delete this.boxX;\r
                        };\r
                        \r
+                       // y\r
                        if( this.parentData && this.parentData.layout.overrideAttrsForChild.top ){\r
-                               if( this.constraintH ){\r
-                                       this.boxY = ( boxT || boxT === 0 ) ? boxT : XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.top.No ], allowedH );\r
-                               } else\r
-                               if( attrs[ XUI_Attr_Support.bottom.No ] === null ){\r
+                               if( this.constraintH || attrs[ XUI_Attr_Support.bottom.No ] === null ){\r
                                        this.boxY = ( boxT || boxT === 0 ) ? boxT : XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.top.No ], allowedH );\r
                                } else {\r
                                        this.boxY = allowedH - this.boxHeight - ( ( boxB || boxB === 0 ) ? boxB : XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.bottom.No ], allowedH ) );\r
@@ -490,12 +505,11 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                        };\r
                },\r
                \r
-               /**\r
+               /*\r
                 * 描画・計測を行って、contentSize の決定\r
                 */\r
                mesure : function(){\r
                        var dirty = this.dirty,\r
-                               //sup   = X_UA[ 'Gecko' ] || ( X_UA[ 'Safari' ] && X_UA[ 'Windows' ] ) ? .01251 : 0,\r
                                w, _w, h, xnode;\r
                        \r
                        if( dirty === XUI_Dirty.CLEAN ){\r
@@ -508,12 +522,12 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                \r
                                case XUI_Dirty.CONTENT : // コンテンツが変更された\r
                                case XUI_Dirty.FONT    : // フォントサイズが変更された\r
-                                       delete this.lastContentWidth;\r
-                                       delete this.lastContentHeight;\r
+                                       delete this.contentWidthLast;\r
+                                       delete this.contentHeightLast;\r
                                        \r
                                case XUI_Dirty.LAYOUT : // レイアウトの再計算が必要\r
                                \r
-                               default : // TODO レイアウト崩れに対処 パフォーマンス悪い!\r
+                               default : // TODO レイアウト指定が不正な場合 bgcolor を変更、これ以下のレイアウトの中止\r
                                \r
                                        w     = this.contentWidth;\r
                                        h     = this.contentHeight;\r
@@ -542,13 +556,13 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                                        \r
                                                        w = _w = XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'width', 'auto' )[ 'clientWidth' ]() / X_Node_CSS_getCharSize( xnode ) );\r
 \r
-                                                       if( this.maxContentWidth < w - this.boxSizingOffsetLR ){\r
+                                                       if( this.contentWidthMax < w - this.boxSizingOffsetLR ){\r
                                                                this.noWidth = false;\r
-                                                               w = this.maxContentWidth + this.boxSizingOffsetLR;\r
+                                                               w = this.contentWidthMax + this.boxSizingOffsetLR;\r
                                                        };\r
-                                                       if( w - this.boxSizingOffsetLR < this.minContentWidth ){\r
+                                                       if( w - this.boxSizingOffsetLR < this.contentWidthMin ){\r
                                                                this.noWidth = false;\r
-                                                               w = this.minContentWidth + this.boxSizingOffsetLR;\r
+                                                               w = this.contentWidthMin + this.boxSizingOffsetLR;\r
                                                        };\r
 \r
                                                        if( h === XUI_Attr_AUTO ){\r
@@ -557,42 +571,42 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                                                w !== _w && xnode[ 'css' ]( 'width', 'auto' );\r
                                                        };\r
 \r
-                                                       this.lastContentWidth = this.contentWidth = w;\r
+                                                       this.contentWidthLast = this.contentWidth = w;\r
 \r
                                                } else\r
                                                if( h === XUI_Attr_AUTO ){\r
-                                                       if( w !== this.lastContentWidth ){\r
+                                                       if( w !== this.contentWidthLast ){\r
                                                                xnode[ 'css' ]( 'width', w + 'em' );                                                            \r
-                                                               this.lastContentWidth = w;\r
+                                                               this.contentWidthLast = w;\r
                                                                \r
                                                                // ie8 clientHeight, ff scrollHeight & clientHeight\r
                                                                h = XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) );\r
                                                        } else {\r
-                                                               h = this.lastContentHeight === -1 ?\r
+                                                               h = this.contentHeightLast === -1 ?\r
                                                                                XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) ) :\r
-                                                                               this.lastContentHeight;\r
+                                                                               this.contentHeightLast;\r
                                                        };\r
                                                } else\r
                                                if( dirty !== XUI_Dirty.LAYOUT ){\r
-                                                       this.contentWidth  = this.lastContentWidth  = w;\r
+                                                       this.contentWidth  = this.contentWidthLast  = w;\r
                                                        h = XUI_AbstractUINode_ceil( xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ) );\r
                                                };\r
                                                \r
-                                               if( this.maxContentHeight < h - this.boxSizingOffsetTB ){\r
+                                               if( this.contentHeightMax < h - this.boxSizingOffsetTB ){\r
                                                        this.noHeight = false;\r
-                                                       h = this.maxContentHeight + this.boxSizingOffsetTB;\r
+                                                       h = this.contentHeightMax + this.boxSizingOffsetTB;\r
                                                };\r
-                                               if( h - this.boxSizingOffsetTB < this.minContentHeight ){\r
+                                               if( h - this.boxSizingOffsetTB < this.contentHeightMin ){\r
                                                        this.noHeight = false;\r
-                                                       h = this.minContentHeight + this.boxSizingOffsetTB;\r
+                                                       h = this.contentHeightMin + this.boxSizingOffsetTB;\r
                                                };\r
                                                \r
-                                               this.contentHeight = this.lastContentHeight = h;\r
+                                               this.contentHeight = this.contentHeightLast = h;\r
                                                \r
                                        } else {\r
                                                // コンテンツを持たないため基本のサイズは0\r
-                                               if( w === XUI_Attr_AUTO ) this.contentWidth  = w = 0 < this.minContentWidth  ? this.minContentWidth  : 0;\r
-                                               if( h === XUI_Attr_AUTO ) this.contentHeight = h = 0 < this.minContentHeight ? this.minContentHeight : 0;\r
+                                               if( w === XUI_Attr_AUTO ) this.contentWidth  = w = 0 < this.contentWidthMin  ? this.contentWidthMin  : 0;\r
+                                               if( h === XUI_Attr_AUTO ) this.contentHeight = h = 0 < this.contentHeightMin ? this.contentHeightMin : 0;\r
                                                this.noWidth = this.noHeight = false;\r
                                        };\r
                                        \r
@@ -602,7 +616,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                //      break;\r
                        };\r
                },\r
-               /**\r
+               /*\r
                 * 自身の contentWidth, contentHeight を元に AUTO な width, height を確定していく\r
                 */\r
                postMesure : function(){\r
@@ -623,17 +637,17 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                borderL  = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.borderWidth.No + 3 ], contentW );\r
                                contentPlus = 0;\r
                                switch( box ){\r
-                                       case 3 : // border-box\r
-                                                contentPlus  = borderR + borderL;\r
+                                       case 1 : // content-box\r
+                                                contentPlus  = paddingR + paddingL;\r
                                        case 2 : // padding-box\r
-                                                contentPlus += paddingR + paddingL;\r
-                                       // case 1 : // content-box\r
+                                                contentPlus += borderR + borderL;\r
+                                       // case 3 : // border-box\r
                                };\r
                                \r
                                if( !this.constraintW ){\r
                                        contentW += contentPlus;\r
-                                       min = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minWidth.No ], contentW );\r
-                                       max = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxWidth.No ], contentW );\r
+                                       min = this.boxWidthMin = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minWidth.No ], contentW );\r
+                                       max = this.boxWidthMax = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxWidth.No ], contentW );\r
                                        if( contentW < min && contentPlus < min ){\r
                                                this.contentWidth = min - contentPlus;\r
                                        } else\r
@@ -643,6 +657,8 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                };\r
                                this.contentL = borderL + paddingL;\r
                                this.contentR = borderR + paddingR;\r
+                               this.paddingL = paddingL;\r
+                               this.borderL  = borderL;\r
                                this.boxWidth = this.contentWidth + this.contentL + this.contentR;\r
                        };\r
                        // Height\r
@@ -654,16 +670,16 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                borderB     = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.borderWidth.No  + 2 ], contentH );\r
                                contentPlus = 0;\r
                                switch( box ){\r
-                                       case 3 : // border-box\r
-                                                contentPlus  = borderT + borderB;\r
+                                       case 1 : // content-box\r
+                                                contentPlus  = paddingT + paddingB;\r
                                        case 2 : // padding-box\r
-                                                contentPlus += paddingT + paddingB;\r
-                                       // case 1 : // content-box\r
+                                                contentPlus += borderT + borderB;\r
+                                       // case 3 : // border-box\r
                                };\r
                                if( !this.constraintH ){\r
                                        contentH += contentPlus;\r
-                                       min = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minHeight.No ], contentH );\r
-                                       max = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxHeight.No ], contentH );\r
+                                       min = this.boxHeightMin = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.minHeight.No ], contentH );\r
+                                       max = this.boxHeightMax = XUI_AbstractUINode_calcValue( attrs[ XUI_Attr_Support.maxHeight.No ], contentH );\r
                                        if( contentH < min && contentPlus < min ){\r
                                                this.contentHeight = min - contentPlus;\r
                                        } else\r
@@ -673,10 +689,13 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                };\r
                                this.contentT  = borderT + paddingT;\r
                                this.contentB  = borderB + paddingB;\r
+                               this.paddingT  = paddingT;\r
+                               this.borderT   = borderT;\r
                                this.boxHeight = this.contentHeight + this.contentT + this.contentB;\r
                        };\r
                },\r
 \r
+               // TODO fontsize が変わることもある\r
                capcher : function( x, y ){\r
                        if( this.pointerDisabled ) return false;\r
                        \r
@@ -695,6 +714,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                 */\r
                listen : function( type, arg1, arg2, arg3 ){\r
                        var root, events, counter, f;\r
+                       \r
                        if( XUI_Event._START_POINTER <= type && type <= XUI_Event._END_POINTER ){\r
                                if( this.phase < 3 ){\r
                                        if( !( events = this.reserveEvents ) ) this.reserveEvents = events = [];\r
@@ -719,11 +739,12 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                        };\r
                                };\r
                        };\r
-                       arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) );\r
+                       \r
+                       arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ) );\r
                        if( !f.kind ){\r
                                return X_EventDispatcher_listen.call( this, type, this.User, f );\r
                        } else\r
-                       if( f.kind === X_Callback_FUNC_ONLY ){\r
+                       if( f.kind === X_CLOSURE_FUNC_ONLY ){\r
                                return X_EventDispatcher_listen.call( this, type, this.User, f.func, f.supplement );\r
                        };\r
                        return X_EventDispatcher_listen.apply( this, arguments );\r
@@ -756,11 +777,11 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                        };\r
                                };\r
                        };\r
-                       arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) );\r
+                       arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ) );\r
                        if( !f.kind ){\r
                                return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f ] );\r
                        } else\r
-                       if( f.kind === X_Callback_FUNC_ONLY ){\r
+                       if( f.kind === X_CLOSURE_FUNC_ONLY ){\r
                                return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f.func, f.supplement ] );\r
                        };\r
                        return X_EventDispatcher_unlisten.apply( this, arguments );\r
@@ -773,13 +794,25 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
                                type = e.type || e;\r
                        \r
                        // TODO captureEvent PointerEvent\r
-                       if( ret & X_Callback_CAPTURE_POINTER && !this.hitChildData && XUI_Event._POINTER_MOVE === type ){\r
+                       if( ret & X_CALLBACK_CAPTURE_POINTER && !this.hitChildData && XUI_Event._POINTER_MOVE === type ){\r
                                this.rootData.monopolyNodeData = this;\r
                                return ret;\r
                        };\r
                        this.rootData.monopolyNodeData = null;\r
-                       if( xve._START_BUBLEUP < type && this.parentData && !( ret & X_Callback_STOP_PROPAGATION ) && !( ret & X_Callback_STOP_NOW ) ) return this.parentData[ 'dispatch' ]( e );\r
+                       if( xve._START_BUBLEUP < type && this.parentData && !( ret & X_CALLBACK_STOP_PROPAGATION ) && !( ret & X_CALLBACK_STOP_NOW ) ) return this.parentData[ 'dispatch' ]( e );\r
                        return ret;\r
+               },\r
+               \r
+               setItemData : function( itemData ){\r
+                       if( this.itemData === itemData ) return;\r
+\r
+                       this.itemData = itemData;\r
+\r
+                       this[ 'dispatch' ]( { type : XUI_Event.ITEMDATA_CHANGED, itemData : itemData } );\r
+                       // itemData && itemData.listen( X_Event_CHANGED )\r
+                       // dataFeild dataFormatter dataValidator\r
+                       \r
+                       // itemData.listen( X_Event_CHANGED ) -> this[ 'dispatch' ]( UI_Event.ITEMDATA_UPDATED );\r
                }\r
                \r
        }\r
@@ -787,7 +820,7 @@ var XUI_AbstractUINode = X_EventDispatcher[ 'inherits' ](
 \r
 function XUI_AbstractUINode_createCssText( that, name ){\r
        var attrs      = that.attrObject || that.attrClass.prototype || XUI_AttrClass,\r
-               def        = that.supportAttrs[ name ],\r
+               def        = that.usableAttrs[ name ],\r
                no         = def.No,\r
                v          = attrs[ def.No ],\r
                type       = def[ 3 ],\r
@@ -890,10 +923,10 @@ X.UI.AbstractUINode = X_Class_create(
        X_Class.ABSTRACT,\r
        {\r
                parent : function(){\r
-                       return X_Class_getPrivate( this ).parent;\r
+                       return X_Pair_get( this ).parent;\r
                },\r
                root : function(){\r
-                       return X_Class_getPrivate( this ).root;\r
+                       return X_Pair_get( this ).root;\r
                },\r
                \r
                /*\r
@@ -901,7 +934,7 @@ X.UI.AbstractUINode = X_Class_create(
                 * サポートされていない場合は無視される.親のレイアウトによって変わる\r
                 */\r
                attr : function( nameOrObject, valueOrUnit ){\r
-                       var p = X_Class_getPrivate( this ),\r
+                       var p = X_Pair_get( this ),\r
                                layout, k, def, attrs, v;\r
                        if( nameOrObject && X_Type_isObject( nameOrObject ) ){\r
                                // setter\r
@@ -912,16 +945,16 @@ X.UI.AbstractUINode = X_Class_create(
                                        if( layout && !layout[ k ] ){\r
                                                continue;\r
                                        };\r
-                                       if( def = p.supportAttrs[ k ] ){\r
+                                       if( def = p.usableAttrs[ k ] ){\r
                                                p.setAttr( k, def, nameOrObject[ k ] );\r
                                        };\r
                                };\r
                        } else\r
-                       if( X_Type_isString( nameOrObject ) ){\r
+                       if( X_Type_isString( nameOrObject ) && ( def = p.usableAttrs[ nameOrObject ] ) ){\r
                                if( valueOrUnit !== undefined ){\r
                                        if( 'em,%'.indexOf( valueOrUnit ) === -1 ){\r
                                                // setter\r
-                                               p.setAttr( nameOrObject, valueOrUnit );\r
+                                               p.setAttr( nameOrObject, def, valueOrUnit );\r
                                        } else {\r
                                                // getter with unit\r
                                                return p.getAttrWithUnit( nameOrObject, valueOrUnit );\r
@@ -929,7 +962,7 @@ X.UI.AbstractUINode = X_Class_create(
                                };\r
                                // getter\r
                                if( attrs = ( p.attrObject || p.attrClass.prototype || XUI_AttrClass ) ){\r
-                                       def = p.supportAttrs[ nameOrObject ];\r
+                                       def = p.usableAttrs[ nameOrObject ];\r
                                        return def && attrs[ def.No ];\r
                                };\r
                                return v;\r
@@ -938,22 +971,22 @@ X.UI.AbstractUINode = X_Class_create(
                },\r
                \r
                listen : function( type, arg1, arg2, arg3 ){\r
-                       X_Class_getPrivate( this )[ 'listen' ]( type, arg1, arg2, arg3 );\r
+                       X_Pair_get( this )[ 'listen' ]( type, arg1, arg2, arg3 );\r
                        return this;\r
                },\r
                listenOnce : function( type, arg1, arg2, arg3 ){\r
-                       X_Class_getPrivate( this )[ 'listenOnce' ]( type, arg1, arg2, arg3 );\r
+                       X_Pair_get( this )[ 'listenOnce' ]( type, arg1, arg2, arg3 );\r
                        return this;\r
                },\r
                listening : function( type, arg1, arg2, arg3 ){\r
-                       return X_Class_getPrivate( this )[ 'listening' ]( type, arg1, arg2, arg3 );\r
+                       return X_Pair_get( this )[ 'listening' ]( type, arg1, arg2, arg3 );\r
                },\r
                unlisten : function( type, arg1, arg2, arg3 ){\r
-                       X_Class_getPrivate( this )[ 'unlisten' ]( type, arg1, arg2, arg3 );\r
+                       X_Pair_get( this )[ 'unlisten' ]( type, arg1, arg2, arg3 );\r
                        return this;\r
                },\r
                dispatch : function( e ){\r
-                       return X_Class_getPrivate( this )[ 'dispatch' ]( e );\r
+                       return X_Pair_get( this )[ 'dispatch' ]( e );\r
                },\r
                        \r
                nextNode : function(){\r
@@ -963,7 +996,7 @@ X.UI.AbstractUINode = X_Class_create(
                        \r
                },\r
                nodeIndex : function( v ){\r
-                       var data = X_Class_getPrivate( this );\r
+                       var data = X_Pair_get( this );\r
                        if( typeof v === 'number' ){\r
                                // data.nodeIndex( v );\r
                                return this;\r
@@ -975,27 +1008,108 @@ X.UI.AbstractUINode = X_Class_create(
                },\r
                getX : function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X_Class_getPrivate( this ).boxX;\r
+                       return X_Pair_get( this ).boxX;\r
                },\r
                getY : function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X_Class_getPrivate( this ).boxY;\r
+                       return X_Pair_get( this ).boxY;\r
                },\r
                getAbsoluteX : function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X_Class_getPrivate( this ).absoluteX;\r
+                       return X_Pair_get( this ).absoluteX;\r
                },\r
                getAbsoluteY: function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X_Class_getPrivate( this ).absoluteY;\r
+                       return X_Pair_get( this ).absoluteY;\r
                },\r
                getWidth : function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X_Class_getPrivate( this ).boxWidth;\r
+                       return X_Pair_get( this ).boxWidth;\r
                },\r
                getHeight : function(){\r
                        // dirty の場合、rootData.calculate\r
-                       return X_Class_getPrivate( this ).boxHeight;\r
+                       return X_Pair_get( this ).boxHeight;\r
+               },\r
+               \r
+               /*\r
+                * Repeater に於いて、繰り返されるアイテムの元(itemRenderer)からの複製に使用\r
+                */\r
+               clone : function( opt_cloneListener ){\r
+                       var newNode,\r
+                               //newPair = X_Pair_get( newNode ),\r
+                               pair    = X_Pair_get( this ),\r
+                               attr, listeners, type, list, i, l;\r
+\r
+                       // attr もコピー\r
+                       if( pair.attrObject ){\r
+                               attr = {};\r
+                               for( k in pair.usableAttrs ){\r
+                                       def = pair.usableAttrs[ k ];\r
+                                       attr[ k ] = pair.attrObject[ def.No ];\r
+                               };\r
+                               newNode = this.constructor( attr );\r
+                       };\r
+\r
+                       // handleEvent 等の拡張されたオブジェクトもコピーする!\r
+                       for( k in this ){\r
+                               if( this[ k ] !== newNode[ k ] && !newNode[ k ] ) newNode[ k ] = this[ k ];\r
+                       };\r
+                       \r
+                       // User.UINODE な値は pair にコピーされているのでこれをコピー\r
+                       for( k in pair ){\r
+                               //pair[ k ] !== newPair[ k ] && !newPair[ k ] && console.log( k );\r
+                               //if( pair[ k ] !== newPair[ k ] && !newPair[ k ] && k !== 'attrObject' && k !== '_listeners' ){\r
+                                       //newPair[ k ] = pair[ k ];\r
+                                       //console.log( k );\r
+                               //};\r
+                       };\r
+                       \r
+\r
+                       \r
+                       // listener もコピーする!\r
+                       if( opt_cloneListener && ( listeners = pair[ '_listeners' ] ) ){\r
+                               for( type in listeners ){\r
+                                       list = listeners[ type ];\r
+                                       for( i = 0, l = list.length; i < l; ++i ){\r
+                                               f = list[ i ];\r
+                                               switch( f.kind ){\r
+                                                       case X_CLOSURE_THIS_FUNC :\r
+                                                               if( f.lock ){\r
+                                                                       X_EventDispatcher_systemListen( newNode, type, f.context === this ? newNode : f.context, f.func, f.supplement );\r
+                                                               } else {\r
+                                                                       newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.context === this ? newNode : f.context, f.func, f.supplement );\r
+                                                               };\r
+                                                               break;\r
+                                                       case X_CLOSURE_HANDLEEVENT :\r
+                                                               if( f.lock ){\r
+                                                                       X_EventDispatcher_systemListen( newNode, type, f.context === this ? newNode : f.context, f.supplement );\r
+                                                               } else {\r
+                                                                       newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.context === this ? newNode : f.context, f.supplement );\r
+                                                               };\r
+                                                               break;\r
+                                                       /*\r
+                                                       case X_CLOSURE_FUNC_ONLY :\r
+                                                               if( f.lock ){\r
+                                                                       X_EventDispatcher_systemListen( newNode, type, f.func, f.supplement );\r
+                                                               } else {\r
+                                                                       newNode[ f.once ? 'listenOnce' : 'listen' ]( type, f.func, f.supplement );\r
+                                                               };\r
+                                                               break;\r
+                                                       default :\r
+                                                               newNode[ 'listen' ]( type, f );\r
+                                                               break; */\r
+                                               };\r
+                                       };                              \r
+                               };\r
+                       } else\r
+                       if( opt_cloneListener && ( list = this.reserveEvents ) ){\r
+                               for( i = 0, l = list.length; i < l; ++i ){\r
+                                       f = list[ i ];\r
+                                       newNode[ f.once ? 'listenOnce' : 'listen' ]( f[ 0 ], newNode, f[ 1 ], f[ 2 ] );\r
+                               };      \r
+                       };\r
+                       \r
+                       return newNode;\r
                }\r
        }\r
 );\r