X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F20_ui%2F06_AbstractUINode.js;h=f649cd5aa03aed0c063ab7c5c74f3be5b1f22dc0;hb=eedd028ba64be2ea0828cf686f1d0ec3bb4010d5;hp=13af1bc2221a6176bf35e200f58112886587b160;hpb=50462b7b22a3c42bdbf2fb84d782937f817368f4;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/20_ui/06_AbstractUINode.js b/0.6.x/js/20_ui/06_AbstractUINode.js index 13af1bc..f649cd5 100644 --- a/0.6.x/js/20_ui/06_AbstractUINode.js +++ b/0.6.x/js/20_ui/06_AbstractUINode.js @@ -17,7 +17,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( attrObject : null, unverifiedAttrs : null, - role : null, + role : 1, pointerDisabled : false, hoverClassName : null, hovering : false, @@ -30,8 +30,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( boxX : 0, boxY : 0, - scrollWidth : 0, - scrollHeight : 0, + scrollWidth : 0, // remove? + scrollHeight : 0, // remove? boxWidth : X.UI.Attr.AUTO, minBoxWidth : 0, maxBoxWidth : X.UI.Attr.AUTO, @@ -133,6 +133,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( } else if( list && ( _v = list[ v ] ) ){ // good + console.log( v + ' ' + _v ); v = _v; } else if( ( percent || minusPct ) && v.lastIndexOf( '%' ) !== -1 && isFinite( _v = parseFloat( v ) ) && v === _v + '%' ){ @@ -216,8 +217,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( }; if( !X.UI.attrClassProto && user === X.UI.Attr.USER.XNODE && this.xnode ){ - this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, this._createCssText( name ) ); - //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + this._createCssText( name ) + ' ' + propID + ' ' + attrs[ propID ] ); + this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, XUI_AbstractUINode_createCssText( this, name ) ); + //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + XUI_AbstractUINode_createCssText( this, name ) + ' ' + propID + ' ' + attrs[ propID ] ); }; return; }; @@ -260,87 +261,15 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( attrs[ propID ] = v; }; + if( name && user === X.UI.Attr.USER.UINODE ){ + this[ name ] = v; + }; + if( name && user === X.UI.Attr.USER.XNODE && this.xnode ){ - this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, this._createCssText( name ) ); - //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + this._createCssText( name ) + ' ' + propID + ' ' + attrs[ propID ] ); + this.xnode[ 'css' ]( X.UI.Attr.Rename[ name ] || name, XUI_AbstractUINode_createCssText( this, name ) ); + //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + XUI_AbstractUINode_createCssText( this, name ) + ' ' + propID + ' ' + attrs[ propID ] ); } else - if( this.dirty < dirty ) this.dirty = dirty; - }; - }, - - _createCssText : function( name ){ - var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass, - def = this.supportAttrs[ name ], - no = def.No, - v = attrs[ def.No ], - type = def[ 3 ], - list = def[ 4 ], - flag = !!( type & X.UI.Attr.Type.BOOLEAN ), - combi = !!( type & X.UI.Attr.Type.COMBI ), - quartet = !!( type & X.UI.Attr.Type.QUARTET ); - - if( quartet ){ - if( attrs[ no + 1 ] === attrs[ no + 3 ] ){ - if( v === attrs[ no + 2 ] ){ - if( v === attrs[ no + 1 ] ){ - return this._createCssValue( v, type, list ); - }; - return [ - this._createCssValue( v, type, list ), - this._createCssValue( attrs[ no + 1 ], type, list ) - ].join( ' ' ); - }; - return [ - this._createCssValue( v, type, list ), - this._createCssValue( attrs[ no + 1 ], type, list ), - this._createCssValue( attrs[ no + 2 ], type, list ) - ].join( ' ' ); - }; - return [ - this._createCssValue( v, type, list ), - this._createCssValue( attrs[ no + 1 ], type, list ), - this._createCssValue( attrs[ no + 2 ], type, list ), - this._createCssValue( attrs[ no + 3 ], type, list ) - ].join( ' ' ); - } else - if( combi ){ - return [ - this._createCssValue( v, type, list ), - this._createCssValue( attrs[ no + 1 ], type, list ) - ].join( ' ' ); - } else - if( flag ){ - return v ? list : 'normal'; // - }; - return this._createCssValue( v, type, list ); - }, - - _createCssValue : function( v, type, list ){ - var length = !!( type & X.UI.Attr.Type.LENGTH ), - minusLen = !!( type & X.UI.Attr.Type.MINUS_LENGTH ), - percent = !!( type & X.UI.Attr.Type.PERCENT ), - minusPct = !!( type & X.UI.Attr.Type.MINUS_PERCENT ), - numerical = !!( type & X.UI.Attr.Type.NUMERICAL ), - auto = !!( type & X.UI.Attr.Type.AUTO ), - color = !!( type & X.UI.Attr.Type.COLOR ), - url = !!( type & X.UI.Attr.Type.URL ), - fontName = !!( type & X.UI.Attr.Type.FONT_NAME ); - - if( X_Type_isNumber( v ) ){ - if( auto && v === X.UI.Attr.AUTO ) return 'auto'; - if( length || minusLen ) return v + 'em'; - if( numerical ) return v; - if( list && list[ v ] ) return list[ v ]; - if( color ){ - if( v < 0x100000 ){ - v = '00000' + v.toString( 16 ); - return '#' + v.substr( v.length - 6 ); - }; - return '#' + v.toString( 16 ); - }; - }; - if( X_Type_isString( v ) ){ - if( percent || minusPct || url || fontName ) return v; + if( this.dirty < dirty ) this.dirty = dirty; }; }, @@ -420,10 +349,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( this.xnode [ 'css' ]( 'left', x ? x + 'em' : 0 ) [ 'css' ]( 'top', y ? y + 'em' : 0 ) - [ 'css' ]( 'width', this.contentWidth ? X.UI._AbstractUINode.ceil( this.contentWidth ) + 'em' : 0 ) - [ 'css' ]( 'height', this.contentHeight ? X.UI._AbstractUINode.ceil( this.contentHeight ) + 'em' : 0 ) - [ 'css' ]( 'padding', this._createCssText( 'padding' ) ) - [ 'css' ]( 'borderWidth', this._createCssText( 'borderWidth' ) ); + [ 'css' ]( 'width', this.contentWidth ? XUI_AbstractUINode_ceil( this.contentWidth ) + 'em' : 0 ) + [ 'css' ]( 'height', this.contentHeight ? XUI_AbstractUINode_ceil( this.contentHeight ) + 'em' : 0 ) + [ 'css' ]( 'padding', XUI_AbstractUINode_createCssText( this, 'padding' ) ) + [ 'css' ]( 'borderWidth', XUI_AbstractUINode_createCssText( this, 'borderWidth' ) ); }, /* @@ -431,7 +360,6 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( */ preMesure : function( allowedW, allowedH ){ var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass, - calc = X.UI._AbstractUINode.calcValue, box = attrs[ X.UI.Attr.Support.sizing.No ], min, max, boxL, boxT, boxR, boxB, @@ -443,10 +371,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( // 自身が constraintW の場合 親が AUTO ではない // 自身が constraintW でない場合自身が AUTO はなくかつ親 が AUTO の場合 or 自身は % でない - paddingR = calc( attrs[ X.UI.Attr.Support.padding.No + 1 ], allowedW ); - paddingL = calc( attrs[ X.UI.Attr.Support.padding.No + 3 ], allowedW ); - borderR = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], allowedW ); - borderL = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], allowedW ); + paddingR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 1 ], allowedW ); + paddingL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 3 ], allowedW ); + borderR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], allowedW ); + borderL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], allowedW ); boxMinus = 0; switch( box ){ case 3 : // border-box @@ -460,9 +388,9 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( if( this.constraintW ? allowedW !== X.UI.Attr.AUTO : !this.autoWidth && ( allowedW !== X.UI.Attr.AUTO || !this.percentWidth ) ){ if( this.constraintW ){ // 制約レイアウト - contentW = allowedW - ( boxL = calc( attrs[ X.UI.Attr.Support.left.No ], allowedW ) ) - ( boxR = calc( attrs[ X.UI.Attr.Support.right.No ], allowedW ) ); + contentW = allowedW - ( boxL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.left.No ], allowedW ) ) - ( boxR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.right.No ], allowedW ) ); } else { - contentW = X.UI._AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.width.No ], attrs[ X.UI.Attr.Support.minWidth.No ], attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ); + contentW = XUI_AbstractUINode_calcFinalValue( attrs[ X.UI.Attr.Support.width.No ], attrs[ X.UI.Attr.Support.minWidth.No ], attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ); }; this.contentWidth = contentW + boxMinus; this.scrollWidth = this.contentWidth + this.contentL + this.contentR; @@ -473,8 +401,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( delete this.minBoxWidth; delete this.maxBoxWidth; } else { - this.minContentWidth = calc( attrs[ X.UI.Attr.Support.minWidth.No ], allowedW ) + boxMinus; - this.maxContentWidth = calc( attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ) + boxMinus; + this.minContentWidth = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minWidth.No ], allowedW ) + boxMinus; + this.maxContentWidth = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ) + boxMinus; this.scrollWidth = this.contentWidth + this.contentL + this.contentR; this.minBoxWidth = this.minContentWidth - boxMinus + this.contentL + this.contentR; this.maxBoxWidth = this.maxContentWidth - boxMinus + this.contentL + this.contentR; @@ -484,10 +412,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( //delete this.boxSizingOffsetLR; }; - paddingT = calc( attrs[ X.UI.Attr.Support.padding.No + 0 ], allowedH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して - paddingB = calc( attrs[ X.UI.Attr.Support.padding.No + 2 ], allowedH ); - borderT = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], allowedH ); - borderB = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], allowedH ); + paddingT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 0 ], allowedH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して + paddingB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 2 ], allowedH ); + borderT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], allowedH ); + borderB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], allowedH ); boxMinus = 0; switch( box ){ case 3 : // border-box @@ -502,9 +430,9 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( // Height if( this.constraintH ? allowedH !== X.UI.Attr.AUTO : !this.autoHeight && ( allowedH !== X.UI.Attr.AUTO || !this.percentHeight ) ){ if( this.constraintH ){ // 制約レイアウト - contentH = allowedH - ( boxT = calc( attrs[ X.UI.Attr.Support.top.No ], allowedH ) ) - ( boxB = calc( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) ); + contentH = allowedH - ( boxT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.top.No ], allowedH ) ) - ( boxB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) ); } else { - contentH = X.UI._AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.height.No ], attrs[ X.UI.Attr.Support.minHeight.No ], attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ); + contentH = XUI_AbstractUINode_calcFinalValue( attrs[ X.UI.Attr.Support.height.No ], attrs[ X.UI.Attr.Support.minHeight.No ], attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ); }; this.contentHeight = contentH + boxMinus; this.scrollHeight = this.contentHeight + this.contentT + this.contentB; @@ -515,8 +443,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( delete this.minBoxHeight; delete this.maxBoxHeight; } else { - this.minContentHeight = calc( attrs[ X.UI.Attr.Support.minHeight.No ], allowedH ) + boxMinus; - this.maxContentHeight = calc( attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ) + boxMinus; + this.minContentHeight = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minHeight.No ], allowedH ) + boxMinus; + this.maxContentHeight = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ) + boxMinus; this.minBoxHeight = this.minContentHeight - boxMinus + this.contentT + this.contentB; this.maxBoxHeight = this.maxContentHeight - boxMinus + this.contentT + this.contentB; @@ -528,12 +456,12 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( if( this.parentData && this.parentData.layout.overrideAttrsForChild.left ){ if( this.constraintW ){ - this.boxX = ( boxL || boxL === 0 ) ? boxL : calc( attrs[ X.UI.Attr.Support.left.No ], allowedW ); + this.boxX = ( boxL || boxL === 0 ) ? boxL : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.left.No ], allowedW ); } else if( attrs[ X.UI.Attr.Support.right.No ] === null ){ - this.boxX = ( boxL || boxL === 0 ) ? boxL : calc( attrs[ X.UI.Attr.Support.left.No ], allowedW ); + this.boxX = ( boxL || boxL === 0 ) ? boxL : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.left.No ], allowedW ); } else { - this.boxX = alllowW - this.boxWidth - ( ( boxR || boxR === 0 ) ? boxR : calc( attrs[ X.UI.Attr.Support.right.No ], allowedW ) ); + this.boxX = alllowW - this.boxWidth - ( ( boxR || boxR === 0 ) ? boxR : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.right.No ], allowedW ) ); }; } else { delete this.boxX; @@ -541,12 +469,12 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( if( this.parentData && this.parentData.layout.overrideAttrsForChild.top ){ if( this.constraintH ){ - this.boxY = ( boxT || boxT === 0 ) ? boxT : calc( attrs[ X.UI.Attr.Support.top.No ], allowedH ); + this.boxY = ( boxT || boxT === 0 ) ? boxT : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.top.No ], allowedH ); } else if( attrs[ X.UI.Attr.Support.bottom.No ] === null ){ - this.boxY = ( boxT || boxT === 0 ) ? boxT : calc( attrs[ X.UI.Attr.Support.top.No ], allowedH ); + this.boxY = ( boxT || boxT === 0 ) ? boxT : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.top.No ], allowedH ); } else { - this.boxY = allowedH - this.boxHeight - ( ( boxB || boxB === 0 ) ? boxB : calc( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) ); + this.boxY = allowedH - this.boxHeight - ( ( boxB || boxB === 0 ) ? boxB : XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) ); }; } else { delete this.boxY; @@ -608,7 +536,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( if( w - this.boxSizingOffsetLR < this.minContentWidth ) this.contentWidth = this.minContentWidth + this.boxSizingOffsetLR; this.lastContentWidth = this.contentWidth; - w !== this.contentWidth && xnode[ 'css' ]( 'width', X.UI._AbstractUINode.ceil( this.contentWidth ) + 'em' ); + w !== this.contentWidth && xnode[ 'css' ]( 'width', XUI_AbstractUINode_ceil( this.contentWidth ) + 'em' ); if( h === X.UI.Attr.AUTO ){ this.contentHeight = h = xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ); // scrollHeight() ?? @@ -623,7 +551,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( } else if( h === X.UI.Attr.AUTO ){ if( w !== this.lastContentWidth ){ - xnode[ 'css' ]( 'width', X.UI._AbstractUINode.ceil( w ) + 'em' ); + xnode[ 'css' ]( 'width', XUI_AbstractUINode_ceil( w ) + 'em' ); this.lastContentWidth = w; this.contentHeight = h = xnode[ 'css' ]( 'height', 'auto' )[ 'scrollHeight' ]() / X_Node_CSS_getCharSize( xnode ); @@ -666,7 +594,6 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( */ postMesure : function(){ var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass, - calc = X.UI._AbstractUINode.calcValue, box = attrs[ X.UI.Attr.Support.sizing.No ], contentW, contentH, contentPlus, @@ -677,10 +604,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( // Width if( this.boxWidth === X.UI.Attr.AUTO ){ contentW = this.contentWidth; - paddingR = calc( attrs[ X.UI.Attr.Support.padding.No + 1 ], contentW ); - paddingL = calc( attrs[ X.UI.Attr.Support.padding.No + 3 ], contentW ); - borderR = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], contentW ); - borderL = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], contentW ); + paddingR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 1 ], contentW ); + paddingL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 3 ], contentW ); + borderR = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], contentW ); + borderL = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], contentW ); contentPlus = 0; switch( box ){ case 3 : // border-box @@ -692,8 +619,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( if( !this.constraintW ){ contentW += contentPlus; - min = calc( attrs[ X.UI.Attr.Support.minWidth.No ], contentW ); - max = calc( attrs[ X.UI.Attr.Support.maxWidth.No ], contentW ); + min = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minWidth.No ], contentW ); + max = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxWidth.No ], contentW ); if( contentW < min && contentPlus < min ){ this.contentWidth = min - contentPlus; } else @@ -708,10 +635,10 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( // Height if( this.boxHeight === X.UI.Attr.AUTO ){ contentH = this.contentHeight; - paddingT = calc( attrs[ X.UI.Attr.Support.padding.No + 0 ], contentH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して - paddingB = calc( attrs[ X.UI.Attr.Support.padding.No + 2 ], contentH ); - borderT = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], contentH ); - borderB = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], contentH ); + paddingT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 0 ], contentH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して + paddingB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.padding.No + 2 ], contentH ); + borderT = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 0 ], contentH ); + borderB = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.borderWidth.No + 2 ], contentH ); contentPlus = 0; switch( box ){ case 3 : // border-box @@ -722,8 +649,8 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( }; if( !this.constraintH ){ contentH += contentPlus; - min = calc( attrs[ X.UI.Attr.Support.minHeight.No ], contentH ); - max = calc( attrs[ X.UI.Attr.Support.maxHeight.No ], contentH ); + min = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.minHeight.No ], contentH ); + max = XUI_AbstractUINode_calcValue( attrs[ X.UI.Attr.Support.maxHeight.No ], contentH ); if( contentH < min && contentPlus < min ){ this.contentHeight = min - contentPlus; } else @@ -750,7 +677,9 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( }; }, - + /* + * context を明示しない場合、User が context になる! + */ listen : function( type, arg1, arg2, arg3 ){ var root, events, counter, f; if( X.UI.Event._START_POINTER <= type && type <= X.UI.Event._END_POINTER ){ @@ -777,7 +706,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( }; }; }; - f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ); + arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) ); if( !f.kind ){ return X_EventDispatcher_listen.call( this, type, this.User, f ); } else @@ -814,7 +743,7 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( }; }; }; - f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ); + arg1 && arg1.kind ? ( f = arg1 ) : ( f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ) ); if( !f.kind ){ return X_EventDispatcher_unlisten.apply( this, [ type, this.User, f ] ); } else @@ -843,7 +772,83 @@ X.UI._AbstractUINode = X_EventDispatcher[ 'inherits' ]( } ); -X.UI._AbstractUINode.calcValue = function( styleValue, srcValue ){ +function XUI_AbstractUINode_createCssText( that, name ){ + var attrs = that.attrObject || that.attrClass.prototype || X.UI.AttrClass, + def = that.supportAttrs[ name ], + no = def.No, + v = attrs[ def.No ], + type = def[ 3 ], + list = def[ 4 ], + flag = !!( type & X.UI.Attr.Type.BOOLEAN ), + combi = !!( type & X.UI.Attr.Type.COMBI ), + quartet = !!( type & X.UI.Attr.Type.QUARTET ); + + if( quartet ){ + if( attrs[ no + 1 ] === attrs[ no + 3 ] ){ + if( v === attrs[ no + 2 ] ){ + if( v === attrs[ no + 1 ] ){ + return XUI_AbstractUINode_createCssValue( v, type, list ); + }; + return [ + XUI_AbstractUINode_createCssValue( v, type, list ), + XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list ) + ].join( ' ' ); + }; + return [ + XUI_AbstractUINode_createCssValue( v, type, list ), + XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list ), + XUI_AbstractUINode_createCssValue( attrs[ no + 2 ], type, list ) + ].join( ' ' ); + }; + return [ + XUI_AbstractUINode_createCssValue( v, type, list ), + XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list ), + XUI_AbstractUINode_createCssValue( attrs[ no + 2 ], type, list ), + XUI_AbstractUINode_createCssValue( attrs[ no + 3 ], type, list ) + ].join( ' ' ); + } else + if( combi ){ + return [ + XUI_AbstractUINode_createCssValue( v, type, list ), + XUI_AbstractUINode_createCssValue( attrs[ no + 1 ], type, list ) + ].join( ' ' ); + } else + if( flag ){ + return v ? list : 'normal'; // + }; + return XUI_AbstractUINode_createCssValue( v, type, list ); +}; + +function XUI_AbstractUINode_createCssValue( v, type, list ){ + var length = !!( type & X.UI.Attr.Type.LENGTH ), + minusLen = !!( type & X.UI.Attr.Type.MINUS_LENGTH ), + percent = !!( type & X.UI.Attr.Type.PERCENT ), + minusPct = !!( type & X.UI.Attr.Type.MINUS_PERCENT ), + numerical = !!( type & X.UI.Attr.Type.NUMERICAL ), + auto = !!( type & X.UI.Attr.Type.AUTO ), + color = !!( type & X.UI.Attr.Type.COLOR ), + url = !!( type & X.UI.Attr.Type.URL ), + fontName = !!( type & X.UI.Attr.Type.FONT_NAME ); + + if( X_Type_isNumber( v ) ){ + if( auto && v === X.UI.Attr.AUTO ) return 'auto'; + if( length || minusLen ) return v + 'em'; + if( numerical ) return v; + if( list && list[ v ] ) return list[ v ]; + if( color ){ + if( v < 0x100000 ){ + v = '00000' + v.toString( 16 ); + return '#' + v.substr( v.length - 6 ); + }; + return '#' + v.toString( 16 ); + }; + }; + if( X_Type_isString( v ) ){ + if( percent || minusPct || url || fontName ) return v; + }; +}; + +function XUI_AbstractUINode_calcValue( styleValue, srcValue ){ /* * String の場合は必ず % */ @@ -854,14 +859,13 @@ X.UI._AbstractUINode.calcValue = function( styleValue, srcValue ){ return styleValue; }; -X.UI._AbstractUINode.finalValue = function( styleValue, styleMin, styleMax, srcValue ){ - var calc = X.UI._AbstractUINode.calcValue, - v = calc( styleValue, srcValue ), - min = calc( styleMin, srcValue ), - max = calc( styleMax, srcValue ); +function XUI_AbstractUINode_calcFinalValue( styleValue, styleMin, styleMax, srcValue ){ + var v = XUI_AbstractUINode_calcValue( styleValue, srcValue ), + min = XUI_AbstractUINode_calcValue( styleMin, srcValue ), + max = XUI_AbstractUINode_calcValue( styleMax, srcValue ); return v <= min ? min : max <= v ? max : v; }; -X.UI._AbstractUINode.ceil = function( v ){ +function XUI_AbstractUINode_ceil( v ){ if( 0 <= v ){ return ( v * 10 + 0.999 | 0 ) / 10; }; @@ -939,10 +943,10 @@ X.UI.AbstractUINode = X_Class_create( return X_Class_getPrivate( this )[ 'dispatch' ]( e ); }, - getNextNode : function(){ + nextNode : function(){ }, - getPrevNode : function(){ + prevNode : function(){ }, nodeIndex : function( v ){ @@ -979,23 +983,6 @@ X.UI.AbstractUINode = X_Class_create( getHeight : function(){ // dirty の場合、rootData.calculate return X_Class_getPrivate( this ).boxHeight; - }, - scrollTo : function( x, y ){ - X_Class_getPrivate( this ).scrollTo( x, y ); - }, - getScrollX : function( v ){ - // dirty の場合、rootData.calculate - return X_Class_getPrivate( this ).scrollX( v ); - }, - getScrollY : function( v ){ - // dirty の場合、rootData.calculate - return X_Class_getPrivate( this ).scrollY( v ); - }, - disabled : function( v ){ - return X_Class_getPrivate( this ).disabled( v ); - }, - cursor : function( v ){ - return X_Class_getPrivate( this ).cursor( v ); } } );