OSDN Git Service

8a356d036ff6c686b67d0789ca34a14045563a2f
[pettanr/clientJs.git] / 0.6.x / js / ui / 06_AbstractUINode.js
1 var _AbstractUINode = X.EventDispatcher.inherits(\r
2         '_AbstractUINode',\r
3         X.Class.ABSTRACT | X.Class.PRIVATE_DATA,\r
4         {\r
5                 phase             : 0,\r
6                 dirty             : X.UI.Dirty.CLEAN,\r
7                 \r
8                 root              : null,\r
9                 rootData          : null,\r
10                 hoverList         : null,\r
11                 parent            : null,\r
12                 parentData        : null,\r
13                 xnode             : null,\r
14 \r
15                 supportAttrs      : X.UI.Attr.Support,\r
16                 attrClass         : X.UI.AttrClass,\r
17                 attrObject        : null,\r
18                 unverifiedAttrs   : null,\r
19                 \r
20                 role              : null,\r
21                 pointerDisabled   : false,\r
22                 hoverClassName    : null,\r
23                 hovering          : false,\r
24                 \r
25                 reserveEvents     : null,\r
26                 gesture           : null,\r
27 \r
28                 x                 : 0,\r
29                 y                 : 0,\r
30                 \r
31                 t                 : 0, // top\r
32                 l                 : 0, // left\r
33                 b                 : 0, // bottom\r
34                 r                 : 0, // right\r
35                 absoluteX         : 0,\r
36                 absoluteY         : 0,\r
37                 \r
38                 boxX              : 0,\r
39                 boxY              : 0,\r
40                 scrollWidth       : 0,\r
41                 scrollHeight      : 0,          \r
42                 boxWidth          : X.UI.Attr.AUTO,\r
43                 minBoxWidth       : 0,\r
44                 maxBoxWidth       : X.UI.Attr.AUTO,     \r
45                 boxHeight         : X.UI.Attr.AUTO,\r
46                 minBoxHeight      : 0,\r
47                 maxBoxHeight      : X.UI.Attr.AUTO,\r
48                 contentL          : 0,\r
49                 contentT          : 0,\r
50                 contentR          : 0,\r
51                 contentB          : 0,\r
52                 boxSizingOffsetLR : 0,\r
53                 boxSizingOffsetTB : 0,          \r
54                 contentWidth      : X.UI.Attr.AUTO,\r
55                 minContentWidth   : 0,\r
56                 maxContentWidth   : X.UI.Attr.AUTO,\r
57                 lastContentWidth  : -1,\r
58                 contentHeight     : X.UI.Attr.AUTO,\r
59                 minContentHeight  : 0,\r
60                 maxContentHeight  : X.UI.Attr.AUTO,\r
61                 \r
62                 constraintW       : false,\r
63                 constraintH       : false,\r
64                 autoWidth         : false,\r
65                 autoHeight        : false,\r
66                 percentWidth      : false,\r
67                 percentHeight     : false,\r
68                 // :hover, :focus, :disabled\r
69                 \r
70                 initialize : function( root, rootData, parent, parentData ){\r
71                         var events = this.reserveEvents,\r
72                                 l, i;                   \r
73                         \r
74                         this.root       = root;\r
75                         this.rootData   = rootData;\r
76                         this.hoverList  = rootData.hoverList;\r
77                         this.parent     = parent;\r
78                         this.parentData = parentData;\r
79                         //this.xnode      = X.Dom.Node.create( 'div' );\r
80                         this.phase      = 1;\r
81                         \r
82                         this.dispatch( { type : X.UI.Event.INIT } );\r
83                         \r
84                         // html 要素が親に追加されるまで控えていたイベントの登録\r
85                         if( events && ( l = events.length ) ){\r
86                                 for( i = 0; i < l; ++i ){\r
87                                         this.listen.apply( this, events[ i ] );\r
88                                 };\r
89                                 events.length = 0;\r
90                                 delete this.reserveEvents;\r
91                         };                      \r
92                 },\r
93                 \r
94                 addToParent : function( parentElement ){\r
95                         parentElement && parentElement.append( this.xnode );\r
96                         \r
97                         this.phase = 2;\r
98                         this.dispatch( { type : X.UI.Event.ADDED } );\r
99                 },\r
100                 \r
101                 creationComplete : function(){\r
102                         this.phase = 3;\r
103                         this.User.dispatch( { type : X.UI.Event.CREATION_COMPLETE } );\r
104                 },\r
105                 \r
106                 /*\r
107                  * _UINode への setAttr の他、attrClass.prototype への setAttr にも対応する\r
108                  * 親要素が変化した場合、unverifiedAttrs を元に attrObject を再設定.\r
109                  */\r
110                 setAttr : function( name, def, v ){\r
111                         var attrs      = X.UI.attrClassProto || this.attrObject,\r
112                                 propID     = def.No || def[ 5 ],\r
113                                 defaultVal = X.UI.attrClassProto ? attrs[ propID ] : this.attrClass.prototype[ propID ], // def[ 0 ],\r
114                                 currentVal = attrs ? attrs[ propID ] : defaultVal,\r
115                                 dirty      = def[ 1 ],\r
116                                 user       = def[ 2 ],\r
117                                 type       = def[ 3 ],\r
118                                 list       = def[ 4 ],\r
119                                 length     = !!( type & X.UI.Attr.Type.LENGTH        ),\r
120                                 minusLen   = !!( type & X.UI.Attr.Type.MINUS_LENGTH  ),\r
121                                 percent    = !!( type & X.UI.Attr.Type.PERCENT       ),\r
122                                 minusPct   = !!( type & X.UI.Attr.Type.MINUS_PERCENT ),\r
123                                 numerical  = !!( type & X.UI.Attr.Type.NUMERICAL     ),\r
124                                 auto       = !!( type & X.UI.Attr.Type.AUTO          ),\r
125                                 color      = !!( type & X.UI.Attr.Type.COLOR         ),\r
126                                 url        = !!( type & X.UI.Attr.Type.URL           ),\r
127                                 fontName   = !!( type & X.UI.Attr.Type.FONT_NAME     ),\r
128                                 flag       = !!( type & X.UI.Attr.Type.BOOLEAN       ),\r
129                                 combi      = !!( type & X.UI.Attr.Type.COMBI         ),\r
130                                 quartet    = !!( type & X.UI.Attr.Type.QUARTET       ),\r
131                                 _v, i, l, nodes, root, roots;\r
132                 \r
133                         if( X.Type.isString( v ) ){\r
134                                 //v = v.toLowercase();\r
135                                 if( url || fontName ){\r
136                                         // good\r
137                                 } else\r
138                                 if( auto && v === 'auto' ){\r
139                                         v = X.UI.Attr.AUTO;\r
140                                 } else\r
141                                 if( list && ( _v = list[ v ] ) ){\r
142                                         // good\r
143                                         v = _v;\r
144                                 } else\r
145                                 if( ( percent || minusPct ) && v.lastIndexOf( '%' ) !== -1 && isFinite( _v = parseFloat( v ) ) && v === _v + '%' ){\r
146                                         // good\r
147                                 } else\r
148                                 if( ( length || minusLen ) && v.lastIndexOf( 'em' ) !== -1 && isFinite( _v = parseFloat( v ) ) && v === _v + 'em' ){\r
149                                         v = _v;\r
150                                 } else                          \r
151                                 if( v.indexOf( ' ' ) !== -1 ){\r
152                                         v = v.split( ' ' );\r
153                                 } else\r
154                                 if( color && X.Type.isNumber( _v = X.Dom.Style.parseColor( v ) ) ){\r
155                                         v = _v;\r
156                                 } else {\r
157                                         // bad\r
158                                         return;\r
159                                 };\r
160                         };\r
161                         \r
162                         if( ( quartet || combi ) && !X.Type.isArray( v ) ){\r
163                                 v = [ v ];\r
164                         };\r
165                         \r
166                         if( X.Type.isNumber( v ) ){\r
167                                 if( \r
168                                     ( length    && ( 0 <= v ) ) ||\r
169                                     ( minusLen  && ( v <= 0 ) ) ||\r
170                                     ( percent   && 0 <= v && v <= 1 ) ||\r
171                                         ( minusPct  && -1 <= v && v < 0 ) ||\r
172                                     ( numerical && 0 <= v ) ||\r
173                                     ( auto      && v === X.UI.Attr.AUTO ) ||\r
174                                     ( color     && 0 <= v && v <= 0xFFFFFF ) ||\r
175                                     ( list      && list[ v ] )\r
176                                 ){\r
177                                         // good\r
178                                 } else {\r
179                                         // bad\r
180                                         return;\r
181                                 };\r
182                         } else\r
183                         if( X.Type.isBoolean( v ) && !flag ){\r
184                                 return;\r
185                         } else\r
186                         if( X.Type.isArray( v ) ){\r
187                                 if( v.length <= 4 && quartet ){\r
188                                         type &= ~X.UI.Attr.Type.QUARTET;\r
189                                         switch( v.length ){\r
190                                                 case 1 :\r
191                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list,   propID ], v[ 0 ] );\r
192                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 0 ] );\r
193                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 0 ] );\r
194                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 0 ] );\r
195                                                         break;\r
196                                                 case 2 :\r
197                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list,   propID ], v[ 0 ] );\r
198                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 1 ] );\r
199                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 0 ] );\r
200                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 1 ] );\r
201                                                         break;\r
202                                                 case 3 :\r
203                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list,   propID ], v[ 0 ] );\r
204                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 1 ] );\r
205                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 2 ] );\r
206                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 1 ] );\r
207                                                         break;\r
208                                                 case 4 :\r
209                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list,   propID ], v[ 0 ] );\r
210                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 1 ] );\r
211                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 2 ] );\r
212                                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 3 ] );\r
213                                                         break;\r
214                                         };                                      \r
215                                 } else\r
216                                 if( v.length === 2 && combi ){\r
217                                         type &= ~X.UI.Attr.Type.COMBI;\r
218                                         this.setAttr( false, [ defaultVal, user, dirty, type, list,   propID ], v[ 0 ] );\r
219                                         this.setAttr( false, [ defaultVal, user, dirty, type, list, ++propID ], v[ 1 ] );\r
220                                 } else {\r
221                                         // bad\r
222                                         return;\r
223                                 };\r
224 \r
225                                 if( !X.UI.attrClassProto && user === X.UI.Attr.USER.XNODE && this.xnode ){\r
226                                         this.xnode.css( X.UI.Attr.Rename[ name ] || name, this._createCssText( name ) );\r
227                                         //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + this._createCssText( name ) + ' ' + propID + ' ' + attrs[ propID ] );\r
228                                 };\r
229                                 return;\r
230                         };\r
231 \r
232                         if( !v && v !== 0 ) v = defaultVal;\r
233                         \r
234                         if( X.UI.attrClassProto ){\r
235                                 attrs[ propID ] = v;\r
236                                 return;                 \r
237                         };              \r
238 \r
239                         if( currentVal !== v ){\r
240                                 switch( propID ){\r
241                                         case X.UI.Attr.Support.left.No :\r
242                                                 this.constraintW = attrs[ X.UI.Attr.Support.right.No ] !== null;\r
243                                                 break;\r
244                                         case X.UI.Attr.Support.right.No :\r
245                                                 this.constraintW = attrs[ X.UI.Attr.Support.left.No ] !== null;\r
246                                                 break;\r
247                                         case X.UI.Attr.Support.top.No :\r
248                                                 this.constraintH = attrs[ X.UI.Attr.Support.bottom.No ] !== null;\r
249                                                 break;\r
250                                         case X.UI.Attr.Support.bottom.No :\r
251                                                 this.constraintH = attrs[ X.UI.Attr.Support.top.No ] !== null;\r
252                                                 break;\r
253                                         case X.UI.Attr.Support.width.No :\r
254                                                 this.autoWidth    = v === X.UI.Attr.AUTO;\r
255                                                 this.percentWidth = X.Type.isString( v );\r
256                                                 break;\r
257                                         case X.UI.Attr.Support.height.No :\r
258                                                 this.autoHeight    = v === X.UI.Attr.AUTO;\r
259                                                 this.percentHeight = X.Type.isString( v );\r
260                                                 break;\r
261                                 };\r
262                                 \r
263                                 if( defaultVal === v ){\r
264                                         if( attrs ) delete attrs[ propID ];\r
265                                 } else {\r
266                                         if( !attrs ) attrs = this.attrObject = new this.attrClass;\r
267                                         attrs[ propID ] = v;\r
268                                 };\r
269                                 \r
270                                 if( name && user === X.UI.Attr.USER.XNODE && this.xnode ){\r
271                                         this.xnode.css( X.UI.Attr.Rename[ name ] || name, this._createCssText( name ) );\r
272                                         //console.log( ( X.UI.Attr.Rename[ name ] || name ) + ' ' + this._createCssText( name ) + ' ' + propID + ' ' + attrs[ propID ] );\r
273                                 } else\r
274                                 if( this.dirty < dirty ) this.dirty = dirty;                                                    \r
275                         };\r
276                 },\r
277 \r
278                 _createCssText : function( name ){\r
279                         var attrs      = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
280                                 def        = this.supportAttrs[ name ],\r
281                                 no         = def.No,\r
282                                 v          = attrs[ def.No ],\r
283                                 type       = def[ 3 ],\r
284                                 list       = def[ 4 ],\r
285                                 flag       = !!( type & X.UI.Attr.Type.BOOLEAN ),\r
286                                 combi      = !!( type & X.UI.Attr.Type.COMBI   ),\r
287                                 quartet    = !!( type & X.UI.Attr.Type.QUARTET );\r
288 \r
289                         if( quartet ){\r
290                                 if( attrs[ no + 1 ] === attrs[ no + 3 ] ){\r
291                                         if( v === attrs[ no + 2 ] ){\r
292                                                 if( v === attrs[ no + 1 ] ){\r
293                                                         return this._createCssValue( v, type, list );\r
294                                                 };\r
295                                                 return [\r
296                                                         this._createCssValue( v, type, list ),\r
297                                                         this._createCssValue( attrs[ no + 1 ], type, list )\r
298                                                 ].join( ' ' );\r
299                                         };\r
300                                         return [\r
301                                                 this._createCssValue( v, type, list ),\r
302                                                 this._createCssValue( attrs[ no + 1 ], type, list ),\r
303                                                 this._createCssValue( attrs[ no + 2 ], type, list )\r
304                                         ].join( ' ' );\r
305                                 };\r
306                                 return [\r
307                                         this._createCssValue( v, type, list ),\r
308                                         this._createCssValue( attrs[ no + 1 ], type, list ),\r
309                                         this._createCssValue( attrs[ no + 2 ], type, list ),\r
310                                         this._createCssValue( attrs[ no + 3 ], type, list )\r
311                                 ].join( ' ' );\r
312                         } else\r
313                         if( combi ){\r
314                                 return [\r
315                                         this._createCssValue( v, type, list ),\r
316                                         this._createCssValue( attrs[ no + 1 ], type, list )\r
317                                 ].join( ' ' );\r
318                         } else\r
319                         if( flag ){\r
320                                 return v ? list : 'normal'; // \r
321                         };\r
322                         return this._createCssValue( v, type, list );\r
323                 },\r
324 \r
325                 _createCssValue : function( v, type, list ){\r
326                         var length     = !!( type & X.UI.Attr.Type.LENGTH        ),\r
327                                 minusLen   = !!( type & X.UI.Attr.Type.MINUS_LENGTH  ),\r
328                                 percent    = !!( type & X.UI.Attr.Type.PERCENT       ),\r
329                                 minusPct   = !!( type & X.UI.Attr.Type.MINUS_PERCENT ),\r
330                                 numerical  = !!( type & X.UI.Attr.Type.NUMERICAL     ),\r
331                                 auto       = !!( type & X.UI.Attr.Type.AUTO          ),\r
332                                 color      = !!( type & X.UI.Attr.Type.COLOR         ),\r
333                                 url        = !!( type & X.UI.Attr.Type.URL           ),\r
334                                 fontName   = !!( type & X.UI.Attr.Type.FONT_NAME     );\r
335                         \r
336                         if( X.Type.isNumber( v ) ){\r
337                                 if( auto && v === X.UI.Attr.AUTO ) return 'auto';\r
338                                 if( length || minusLen ) return v + 'em';\r
339                                 if( numerical ) return v;\r
340                                 if( list && list[ v ] ) return list[ v ];\r
341                                 if( color ){\r
342                                         if( v < 0x100000 ){\r
343                                                 v = '00000' + v.toString( 16 );\r
344                                                 return '#' + v.substr( v.length - 6 );\r
345                                         };\r
346                                         return '#' + v.toString( 16 );\r
347                                 };\r
348                         };\r
349                         if( X.Type.isString( v ) ){\r
350                                 if( percent || minusPct || url || fontName ) return v;\r
351                         };\r
352                 },\r
353 \r
354                 getAttr : function( name ){\r
355                         var attrs   = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
356                                 support = this.supportAttrs[ name ],\r
357                                 v;\r
358                         if( !support ) return;\r
359                         \r
360                         if( name.indexOf( 'border' ) === 0 ){\r
361                                 name = name.substr( 6 );\r
362                                 return [ this.getAttr( 'borderTop' + name ), this.getAttr( 'borderRight' + name ), this.getAttr( 'borderBottom' + name ), this.getAttr( 'borderLeft' + name ) ];\r
363                         };\r
364                         \r
365                         type = support[ 3 ];\r
366                         // Unit\r
367                         if( type & X.UI.Attr.Type.QUARTET ){\r
368                                 return [ this.getAttr( name + 'Top' ), this.getAttr( name + 'Right' ), this.getAttr( name + 'Bottom' ), this.getAttr( name + 'Left' ) ];\r
369                         };\r
370                         if( type & X.UI.Attr.Type.COMBI   ) return [ v, data[ ++propID ] ];\r
371                         \r
372                         v    = attrs[ support.No ];             \r
373                         if( type & X.UI.Attr.Type.AUTO && v === X.UI.Attr.AUTO ) return 'auto'; \r
374                         \r
375                         list = support[ 4 ];\r
376                         if( list ) return list[ v ];\r
377                         \r
378                         if( type & X.UI.Attr.Type.COLOR && X.Type.isNumber( v ) ) return v;\r
379                         if( !( type & X.UI.Attr.Type.NUMERICAL ) && X.Type.isNumber( v ) ) return v + 'em';\r
380                         return v;\r
381                 },\r
382                 \r
383                 // em, px, %\r
384                 getAttrWithUnit : function( prop, unit ){\r
385                         \r
386                 },\r
387 \r
388                 _remove : function(){\r
389                         switch( this.phase ){\r
390                                 case 4:\r
391                                 case 3:\r
392 \r
393                                 case 2:\r
394                                         \r
395                                 case 1:\r
396                                         this.xnode.destroy();\r
397                                 \r
398                                         delete this.root;\r
399                                         delete this.rootData;\r
400                                         delete this.parent;\r
401                                         delete this.parentData;\r
402                                         delete this.xnode;\r
403                                         \r
404                                         delete this.phase;\r
405                         };\r
406                         \r
407                 },\r
408                 //killed\r
409 \r
410                 calculate : function( isNeedsDetection, x, y, allowedW, allowedH ){\r
411                         this.preMesure( allowedW, allowedH );\r
412                         \r
413                         if( this.boxWidth === X.UI.Attr.AUTO || this.boxHeight === X.UI.Attr.AUTO ){\r
414                                 this.mesure();\r
415                                 this.postMesure();\r
416                         };\r
417                         \r
418                         !isNeedsDetection && this.updateLayout( x, y );\r
419                 },\r
420                 \r
421                 /**\r
422                  * X.Dom.BoxModel の情報を引きながら top,left,width,height,padding,border の設定\r
423                  */\r
424                 updateLayout : function( x, y ){\r
425                         x += this.boxX;\r
426                         y += this.boxY;\r
427                         this.xnode\r
428                                 .css( 'left',        x ? x + 'em' : 0 )\r
429                                 .css( 'top',         y ? y + 'em' : 0 )\r
430                                 .css( 'width',       this.contentWidth  ? this.contentWidth  + 'em' : 0 )\r
431                                 .css( 'height',      this.contentHeight ? this.contentHeight + 'em' : 0 )\r
432                                 .css( 'padding',     this._createCssText( 'padding' ) )\r
433                                 .css( 'borderWidth', this._createCssText( 'borderWidth' ) );\r
434                 },\r
435 \r
436                 /*\r
437                  * 親の サイズを元に自身のサイズを計算していく\r
438                  */\r
439                 preMesure : function( allowedW, allowedH ){\r
440                         var attrs = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
441                                 calc  = _AbstractUINode.calcValue,\r
442                                 box   = attrs[ X.UI.Attr.Support.sizing.No ],\r
443                                 min, max,\r
444                                 boxL, boxT, boxR, boxB,\r
445                                 contentW, contentH, boxMinus,\r
446                                 paddingT, paddingR, paddingB, paddingL,\r
447                                 borderT, borderR, borderB, borderL;\r
448                         \r
449                         // Width が確定するパターン\r
450                         // 自身が constraintW の場合 親が AUTO ではない\r
451                         // 自身が constraintW でない場合自身が  AUTO はなくかつ親 が AUTO の場合 or 自身は % でない\r
452                         \r
453                         paddingR = calc( attrs[ X.UI.Attr.Support.padding.No + 1 ], allowedW );\r
454                         paddingL = calc( attrs[ X.UI.Attr.Support.padding.No + 3 ], allowedW );\r
455                         borderR  = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], allowedW );\r
456                         borderL  = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], allowedW );\r
457                         boxMinus = 0;\r
458                         switch( box ){\r
459                                 case 3 : // border-box\r
460                                          boxMinus -= borderR + borderL;\r
461                                 case 2 : // padding-box\r
462                                          boxMinus -= paddingR + paddingL;\r
463                                 // case 1 : // content-box\r
464                         };\r
465                         this.contentL = borderL + paddingL;\r
466                         this.contentR = borderR + paddingR;\r
467                         \r
468                         if( this.constraintW ? allowedW !== X.UI.Attr.AUTO : !this.autoWidth && ( allowedW !== X.UI.Attr.AUTO || !this.percentWidth ) ){\r
469                                 if( this.constraintW ){ // 制約レイアウト\r
470                                         contentW = allowedW - ( boxL = calc( attrs[ X.UI.Attr.Support.left.No ], allowedW ) ) - ( boxR = calc( attrs[ X.UI.Attr.Support.right.No ], allowedW ) );\r
471                                 } else {\r
472                                         contentW = _AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.width.No ], attrs[ X.UI.Attr.Support.minWidth.No ], attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW );                                 \r
473                                 };\r
474                                 this.contentWidth = contentW + boxMinus;\r
475                                 this.scrollWidth  = this.contentWidth + this.contentL + this.contentR;\r
476                                 this.boxWidth     = contentW - boxMinus + this.contentL + this.contentR;\r
477                                 this.boxSizingOffsetLR = boxMinus;\r
478                                 delete this.minContentWidth;\r
479                                 delete this.maxContentWidth;\r
480                                 delete this.minBoxWidth;\r
481                                 delete this.maxBoxWidth;\r
482                         } else {        \r
483                                 this.minContentWidth = calc( attrs[ X.UI.Attr.Support.minWidth.No ], allowedW ) + boxMinus;\r
484                                 this.maxContentWidth = calc( attrs[ X.UI.Attr.Support.maxWidth.No ], allowedW ) + boxMinus;\r
485                                 this.scrollWidth     = this.contentWidth + this.contentL + this.contentR;\r
486                                 this.minBoxWidth     = this.minContentWidth - boxMinus + this.contentL + this.contentR;\r
487                                 this.maxBoxWidth     = this.maxContentWidth - boxMinus + this.contentL + this.contentR;\r
488                                 //delete this.contentWidth;\r
489                                 //delete this.scrollWidth;\r
490                                 //delete this.boxWidth;\r
491                                 //delete this.boxSizingOffsetLR;\r
492                         };\r
493                         \r
494                         paddingT  = calc( attrs[ X.UI.Attr.Support.padding.No + 0 ], allowedH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して\r
495                         paddingB  = calc( attrs[ X.UI.Attr.Support.padding.No + 2 ], allowedH );\r
496                         borderT   = calc( attrs[ X.UI.Attr.Support.borderWidth.No  + 0 ], allowedH );\r
497                         borderB   = calc( attrs[ X.UI.Attr.Support.borderWidth.No  + 2 ], allowedH );\r
498                         boxMinus = 0;\r
499                         switch( box ){\r
500                                 case 3 : // border-box\r
501                                          boxMinus -= borderT + borderB;\r
502                                 case 2 : // padding-box\r
503                                          boxMinus -= paddingT + paddingB;\r
504                                 // case 1 : // content-box\r
505                         };\r
506                         this.contentT = borderT + paddingT;\r
507                         this.contentB = borderB + paddingB;\r
508                         \r
509                         // Height\r
510                         if( this.constraintH ? allowedH !== X.UI.Attr.AUTO : !this.autoHeight && ( allowedH !== X.UI.Attr.AUTO || !this.percentHeight ) ){\r
511                                 if( this.constraintH ){ // 制約レイアウト\r
512                                         contentH = allowedH - ( boxT = calc( attrs[ X.UI.Attr.Support.top.No ], allowedH ) ) - ( boxB = calc( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) );\r
513                                 } else {\r
514                                         contentH = _AbstractUINode.finalValue( attrs[ X.UI.Attr.Support.height.No ], attrs[ X.UI.Attr.Support.minHeight.No ], attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH );\r
515                                 };                      \r
516                                 this.contentHeight = contentH + boxMinus;\r
517                                 this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
518                                 this.boxHeight     = contentH - boxMinus + this.contentT + this.contentB; // padding-box の場合 border だけ足される\r
519                                 this.boxSizingOffsetTB = boxMinus;\r
520                                 delete this.minContentHeight;\r
521                                 delete this.maxContentHeight;\r
522                                 delete this.minBoxHeight;\r
523                                 delete this.maxBoxHeight;\r
524                         } else {\r
525                                 this.minContentHeight = calc( attrs[ X.UI.Attr.Support.minHeight.No ], allowedH ) + boxMinus;\r
526                                 this.maxContentHeight = calc( attrs[ X.UI.Attr.Support.maxHeight.No ], allowedH ) + boxMinus;                           \r
527                                 this.minBoxHeight = this.minContentHeight - boxMinus + this.contentT + this.contentB;\r
528                                 this.maxBoxHeight = this.maxContentHeight - boxMinus + this.contentT + this.contentB;\r
529                 \r
530                                 //delete this.contentHeight;\r
531                                 //delete this.scrollHeight;\r
532                                 //delete this.boxHeight;\r
533                                 //delete this.boxSizingOffsetTB;\r
534                         };\r
535                         \r
536                         if( this.parentData && this.parentData.layout.overrideAttrsForChild.left ){\r
537                                 if( this.constraintW ){\r
538                                         this.boxX = ( boxL || boxL === 0 ) ? boxL : calc( attrs[ X.UI.Attr.Support.left.No ], allowedW );\r
539                                 } else\r
540                                 if( attrs[ X.UI.Attr.Support.right.No ] === null ){\r
541                                         this.boxX = ( boxL || boxL === 0 ) ? boxL : calc( attrs[ X.UI.Attr.Support.left.No ], allowedW );\r
542                                 } else {\r
543                                         this.boxX = alllowW - this.boxWidth - ( ( boxR || boxR === 0 ) ? boxR : calc( attrs[ X.UI.Attr.Support.right.No ], allowedW ) );\r
544                                 };\r
545                         } else {\r
546                                 delete this.boxX;\r
547                         };\r
548                         \r
549                         if( this.parentData && this.parentData.layout.overrideAttrsForChild.top ){\r
550                                 if( this.constraintH ){\r
551                                         this.boxY = ( boxT || boxT === 0 ) ? boxT : calc( attrs[ X.UI.Attr.Support.top.No ], allowedH );\r
552                                 } else\r
553                                 if( attrs[ X.UI.Attr.Support.bottom.No ] === null ){\r
554                                         this.boxY = ( boxT || boxT === 0 ) ? boxT : calc( attrs[ X.UI.Attr.Support.top.No ], allowedH );\r
555                                 } else {\r
556                                         this.boxY = allowedH - this.boxHeight - ( ( boxB || boxB === 0 ) ? boxB : calc( attrs[ X.UI.Attr.Support.bottom.No ], allowedH ) );\r
557                                 };\r
558                         } else {\r
559                                 delete this.boxY;\r
560                         };\r
561                 },\r
562                 \r
563                 /**\r
564                  * 描画・計測を行って、contentSize, scrollSize の決定\r
565                  */\r
566                 mesure : function(){\r
567                         var dirty = this.dirty,\r
568                                 w, h, xnode;\r
569                         switch( dirty ){\r
570                                 \r
571                                 case X.UI.Dirty.CONTENT : // コンテンツが変更された\r
572                                 case X.UI.Dirty.FONT   : // フォントサイズが変更された\r
573                                         delete this.lastContentWidth;\r
574                                 case X.UI.Dirty.LAYOUT : // レイアウトの再計算が必要\r
575                                 \r
576                                 default : // TODO レイアウト崩れに対処 パフォーマンス悪い!\r
577                                 \r
578                                         w     = this.contentWidth;\r
579                                         h     = this.contentHeight;\r
580                                         xnode = this.xnode;\r
581                                         \r
582                                         /* http://web-designs.seesaa.net/article/188400668.html\r
583                                          * min-width の値が max-width の値より大きい場合は、max-width の値は min-width の値に設定される。\r
584                                          * \r
585                                          * テキストノードがあり\r
586                                          * 1. contentWidth === AUTO\r
587                                          *     style を更新して contentWidth の決定\r
588                                          *     min or max に引っかかったら style 更新\r
589                                          *     contentHeight === AUTO の場合\r
590                                          *     textHeight の決定\r
591                                          *     contentHeight !== AUTO の場合 scrollHeight のみ更新\r
592                                          * 2. contentHeight === AUTO かつ \r
593                                          *     コンテンツの高さの再取得が必要( contentWidth が最終計測時の contentWidth と一致 かつ フォント・コンテンツに変更無し の場合再取得不要)\r
594                                          *      style を更新して contentHeight の決定\r
595                                          *     必要でない\r
596                                          * 3. content のサイズがすでに決定している\r
597                                          *     コンテンツの高さの再取得が必要\r
598                                          *     必要でない\r
599                                          */\r
600                                         if( xnode._xnodes && xnode._xnodes.length ){\r
601                                                 if( w === X.UI.Attr.AUTO ){\r
602                                                         w = this.contentWidth = xnode.width() / xnode._getCharSize();\r
603                                                         \r
604                                                         this.scrollWidth = w + this.contentL + this.contentR;\r
605                                                         if( this.maxContentWidth < w - this.boxSizingOffsetLR ) this.contentWidth = this.maxContentWidth + this.boxSizingOffsetLR;\r
606                                                         if( w - this.boxSizingOffsetLR < this.minContentWidth ) this.contentWidth = this.minContentWidth + this.boxSizingOffsetLR;\r
607                                                         this.lastContentWidth = this.contentWidth;\r
608                                                         \r
609                                                         w !== this.contentWidth && xnode.css( 'width', this.contentWidth + 'em' );\r
610                                                         \r
611                                                         if( h === X.UI.Attr.AUTO ){\r
612                                                                 this.contentHeight = h = xnode.height() / xnode._getCharSize();\r
613                                                                 this.scrollHeight  = h + this.contentT + this.contentB;\r
614                                                                 if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB;\r
615                                                                 if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB;\r
616                                                         } else {\r
617                                                                 this.scrollHeight = xnode.height() / xnode._getCharSize() + this.contentT + this.contentB;\r
618                                                         };\r
619                                                 } else\r
620                                                 if( h === X.UI.Attr.AUTO ){\r
621                                                         if( w !== this.lastContentWidth ){\r
622                                                                 xnode.css( 'width', w + 'em' );\r
623                                                                 \r
624                                                                 this.lastContentWidth  = w;\r
625                                                                 this.contentHeight = h = xnode.height() / xnode._getCharSize();\r
626                                                                 this.scrollWidth       = w + this.contentL + this.contentR;\r
627                                                                 this.scrollHeight      = h + this.contentT + this.contentB;\r
628                                                                 if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB;\r
629                                                                 if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB;                                                           \r
630                                                         } else {\r
631                                                                 this.scrollWidth  = w + this.contentL + this.contentR;\r
632                                                                 this.scrollHeight = h + this.contentT + this.contentB;\r
633                                                         };\r
634                                                 } else\r
635                                                 if( dirty !== X.UI.Dirty.LAYOUT ){\r
636                                                         this.contentWidth  = this.lastContentWidth = w; //xnode.width();\r
637                                                         this.contentHeight = xnode.height() / xnode._getCharSize();\r
638                                                         this.scrollWidth   = this.contentWidth  + this.contentL + this.contentR;\r
639                                                         this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
640                                                 } else {\r
641                                                         this.scrollWidth  = w + this.contentL + this.contentR;\r
642                                                         this.scrollHeight = h + this.contentT + this.contentB;\r
643                                                 };              \r
644                                         } else {\r
645                                                 // コンテンツを持たないため基本のサイズは0\r
646                                                 if( w === X.UI.Attr.AUTO ) this.contentWidth  = w = 0 < this.minContentWidth  ? this.minContentWidth  : 0;\r
647                                                 if( h === X.UI.Attr.AUTO ) this.contentHeight = h = 0 < this.minContentHeight ? this.minContentHeight : 0;\r
648                                                 this.scrollWidth  = w + this.contentL + this.contentR;\r
649                                                 this.scrollHeight = h + this.contentT + this.contentB;\r
650                                         };\r
651                                         \r
652                                         delete this.dirty;\r
653                                         break;                  \r
654                                 //case X.UI.Dirty.PAINT : // 再描画のみ必要\r
655                                 //      break;\r
656                         };\r
657                 },\r
658                 /**\r
659                  * 自身の contentWidth, contentHeight を元に AUTO な width, height を確定していく\r
660                  */\r
661                 postMesure : function(){\r
662                         var     attrs    = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
663                                 calc     = _AbstractUINode.calcValue,\r
664                                 box      = attrs[ X.UI.Attr.Support.sizing.No ],\r
665                                 contentW, contentH,\r
666                                 contentPlus,\r
667                                 paddingT, paddingR, paddingB, paddingL,\r
668                                 borderT, borderR, borderB, borderL,\r
669                                 min, max;\r
670                                 \r
671                         // Width\r
672                         if( this.boxWidth === X.UI.Attr.AUTO ){\r
673                                 contentW = this.contentWidth;\r
674                                 paddingR = calc( attrs[ X.UI.Attr.Support.padding.No + 1 ], contentW );                                 \r
675                                 paddingL = calc( attrs[ X.UI.Attr.Support.padding.No + 3 ], contentW );                                 \r
676                                 borderR  = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], contentW );\r
677                                 borderL  = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], contentW );\r
678                                 contentPlus = 0;\r
679                                 switch( box ){\r
680                                         case 3 : // border-box\r
681                                                  contentPlus  = borderR + borderL;\r
682                                         case 2 : // padding-box\r
683                                                  contentPlus += paddingR + paddingL;\r
684                                         // case 1 : // content-box\r
685                                 };\r
686                                 \r
687                                 if( !this.constraintW ){\r
688                                         contentW += contentPlus;\r
689                                         min = calc( attrs[ X.UI.Attr.Support.minWidth.No ], contentW );\r
690                                         max = calc( attrs[ X.UI.Attr.Support.maxWidth.No ], contentW );\r
691                                         if( contentW < min && contentPlus < min ){\r
692                                                 this.contentWidth = min - contentPlus;\r
693                                         } else\r
694                                         if( max < contentW && contentPlus < max ){\r
695                                                 this.contentWidth = max - contentPlus;\r
696                                         };\r
697                                 };\r
698                                 this.contentL = borderL + paddingL;\r
699                                 this.contentR = borderR + paddingR;\r
700                                 this.boxWidth = this.contentWidth + this.contentL + this.contentR;\r
701                         };\r
702                         // Height\r
703                         if( this.boxHeight === X.UI.Attr.AUTO ){\r
704                                 contentH    = this.contentHeight;\r
705                                 paddingT    = calc( attrs[ X.UI.Attr.Support.padding.No + 0 ], contentH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して\r
706                                 paddingB    = calc( attrs[ X.UI.Attr.Support.padding.No + 2 ], contentH );\r
707                                 borderT     = calc( attrs[ X.UI.Attr.Support.borderWidth.No  + 0 ], contentH );\r
708                                 borderB     = calc( attrs[ X.UI.Attr.Support.borderWidth.No  + 2 ], contentH );\r
709                                 contentPlus = 0;\r
710                                 switch( box ){\r
711                                         case 3 : // border-box\r
712                                                  contentPlus  = borderT + borderB;\r
713                                         case 2 : // padding-box\r
714                                                  contentPlus += paddingT + paddingB;\r
715                                         // case 1 : // content-box\r
716                                 };\r
717                                 if( !this.constraintH ){\r
718                                         contentH += contentPlus;\r
719                                         min = calc( attrs[ X.UI.Attr.Support.minHeight.No ], contentH );\r
720                                         max = calc( attrs[ X.UI.Attr.Support.maxHeight.No ], contentH );\r
721                                         if( contentH < min && contentPlus < min ){\r
722                                                 this.contentHeight = min - contentPlus;\r
723                                         } else\r
724                                         if( max < contentH && contentPlus < max ){\r
725                                                 this.contentHeight = max - contentPlus;\r
726                                         };\r
727                                 };\r
728                                 this.contentT  = borderT + paddingT;\r
729                                 this.contentB  = borderB + paddingB;\r
730                                 this.boxHeight = this.contentHeight + this.contentT + this.contentB;\r
731                         };\r
732                 },\r
733 \r
734                 capcher : function( x, y ){\r
735                         if( this.pointerDisabled ) return false;\r
736                         \r
737                         x -= this.x;\r
738                         y -= this.y;\r
739 \r
740                         if( 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight ){\r
741                                 !this.hovering && ( this.hoverList[ this.hoverList.length ] = this );\r
742                                 this.rootData.targetNodeData = this;\r
743                                 return true;\r
744                         };\r
745                 },\r
746                 \r
747                 \r
748                 listen : function( type, arg1, arg2, arg3 ){\r
749                         var root, events, counter;\r
750                         if( X.UI.Event._START_POINTER <= type && type <= X.UI.Event._END_POINTER ){\r
751                                 if( this.phase < 3 ){\r
752                                         if( !( events = this.reserveEvents ) ) this.reserveEvents = events = [];\r
753                                         events[ events.length ] = [ type, arg1, arg2, arg3 ];\r
754                                         return this;\r
755                                 };\r
756                                 if( X.UI.Event._START_XUI_EVENT < type && type < X.UI.Event._END_XUI_EVENT ){\r
757                                         if( !this.gesture ){\r
758                                                 this.gesture = new X.UI.Gesture( this.root, this, type );\r
759                                         } else {\r
760                                                 this.gesture.listen( type );\r
761                                         };\r
762                                 } else {\r
763                                         root    = this.rootData;\r
764                                         counter = root.eventCounter;\r
765                                         if( counter[ type ] ){\r
766                                                 ++counter[ type ];\r
767                                         } else {\r
768                                                 counter[ type ] = 1;                            \r
769                                                 root.elmMouseCatch.listen( X.UI.Event.IdToName[ type ], eventRellay );\r
770                                         };\r
771                                 };\r
772                         };\r
773                         if( typeof arg1 === 'function' ){\r
774                                 return X.EventDispatcher.prototype.listen.apply( this, [ type, this.User, arg1, arg2 ] );\r
775                         };\r
776                         return X.EventDispatcher.prototype.listen.apply( this, [ type, arg1 || this.User, arg2 || arg1, arg3 || arg2 ] );\r
777                 },\r
778                 unlisten : function( type, arg1, arg2, arg3 ){\r
779                         var root, events, i, ev, counter;\r
780                         if( X.UI.Event._START_POINTER <= type && type <= X.UI.Event._END_POINTER ){\r
781                                 if( this.phase < 3 ){\r
782                                         if( !( events = this.reserveEvents ) ) return this;\r
783                                         for( i = events.length; i; ){\r
784                                                 ev = events[ --i ];\r
785                                                 if( ev[ 0 ] === type && ev[ 1 ] === arg1 && ev[ 2 ] === arg2 ){\r
786                                                         events.split( i, 1 );\r
787                                                         return this;\r
788                                                 };\r
789                                         }; \r
790                                         return this;\r
791                                 };\r
792 \r
793                                 if( X.UI.Event._START_XUI_EVENT < type && type < X.UI.Event._END_XUI_EVENT ){\r
794                                         this.gesture && this.gesture.unlisten( type );\r
795                                 } else {\r
796                                         root    = this.rootData;\r
797                                         counter = root.eventCounter;\r
798                                         if( !counter[ type ] ) return this;\r
799                                         --counter[ type ];\r
800                                         if( counter[ type ] === 0 ){\r
801                                                 X.Dom.Event.remove( root.elmMouseCatch, X.UI.Event.IdToName[ type ], eventRellay );\r
802                                                 delete counter[ type ];\r
803                                         };\r
804                                 };\r
805                         };\r
806                         if( typeof arg1 === 'function' ){\r
807                                 return X.EventDispatcher.prototype.unlisten.apply( this, [ type, this.User, arg1, arg2 ] );\r
808                         };\r
809                         return X.EventDispatcher.prototype.unlisten.apply( this, [ type, arg1 || this.User, arg2 || arg1, arg3 || arg2 ] );\r
810                 },\r
811                 \r
812                 dispatch : function( e ){\r
813                         var xve  = X.UI.Event,\r
814                                 ret  = X.EventDispatcher.prototype.dispatch.call( this, e ),\r
815                                 type = e.type;\r
816                         if( ret & X.Callback.MONOPOLY && !this.hitChildData && ( xve._POINTER_MOVE === type || xve._MOUSE_MOVE === type || xve.FILE_DRAG === type ) ){\r
817                                 this.rootData.monopolyNodeData = this;\r
818                                 return ret;\r
819                         };\r
820                         this.rootData.monopolyNodeData = null;\r
821                         if( xve._START_BUBLEUP < type && this.parentData && ret & X.Callback.STOP_PROPAGATION === 0 && ret & X.Callback.STOP_NOW === 0 ) return this.parentData.dispatch( e );\r
822                         return ret;\r
823                 }\r
824                 \r
825         }\r
826 );\r
827 \r
828 _AbstractUINode.calcValue = function( styleValue, srcValue ){\r
829         /*\r
830          * String の場合は必ず %\r
831          */     \r
832         if( X.Type.isString( styleValue ) ){\r
833                 return srcValue * parseFloat( styleValue ) / 100;\r
834         };\r
835         if( !X.Type.isNumber( styleValue ) ) return 0;\r
836         return styleValue;\r
837 };\r
838 \r
839 _AbstractUINode.finalValue = function( styleValue, styleMin, styleMax, srcValue ){\r
840         var calc = _AbstractUINode.calcValue,\r
841                 v    = calc( styleValue, srcValue ),\r
842                 min  = calc( styleMin, srcValue ),\r
843                 max  = calc( styleMax, srcValue );\r
844         return v <= min ? min : max <= v ? max : v;\r
845 };\r
846 \r
847 var AbstractUINode = X.Class.create(\r
848         'AbstractUINode',\r
849         X.Class.ABSTRACT | X.Class.SUPER_ACCESS,\r
850         {\r
851                 parent : function(){\r
852                         return X.Class._getPrivate( this ).parent;\r
853                 },\r
854                 root : function(){\r
855                         return X.Class._getPrivate( this ).root;\r
856                 },\r
857                 \r
858                 /*\r
859                  * unverifiedAttrs に全ての指定を控える\r
860                  * サポートされていない場合は無視される.親のレイアウトによって変わる\r
861                  */\r
862                 attr : function( nameOrObject, valueOrUnit ){\r
863                         var p = X.Class._getPrivate( this ),\r
864                                 layout, k, def, attrs, v;\r
865                         if( nameOrObject && X.Type.isObject( nameOrObject ) ){\r
866                                 // setter\r
867                                 layout = p.parentData && p.parentData.layout.overrideAttrsForChild; // root には parent がない\r
868                                 for( k in nameOrObject ){\r
869                                         // 親のレイアウトマネージャの許可しない\r
870                                         if( layout && !layout[ k ] ){\r
871                                                 continue;\r
872                                         };\r
873                                         if( def = p.supportAttrs[ k ] ){\r
874                                                 p.setAttr( k, def, nameOrObject[ k ] );\r
875                                         };\r
876                                 };\r
877                         } else\r
878                         if( X.Type.isString( nameOrObject ) ){\r
879                                 if( valueOrUnit !== undefined ){\r
880                                         if( 'em,%'.indexOf( valueOrUnit ) === -1 ){\r
881                                                 // setter\r
882                                                 p.setAttr( nameOrObject, valueOrUnit );\r
883                                         } else {\r
884                                                 // getter with unit\r
885                                                 return p.getAttrWithUnit( nameOrObject, valueOrUnit );\r
886                                         };\r
887                                 };\r
888                                 // getter\r
889                                 if( attrs = ( p.attrObject || p.attrClass.prototype || X.UI.AttrClass ) ){\r
890                                         def = p.supportAttrs[ nameOrObject ];\r
891                                         return def && attrs[ def.No ];\r
892                                 };\r
893                                 return v;\r
894                         };\r
895                         return this;\r
896                 },\r
897                 \r
898                 listen : function( type, arg1, arg2, arg3 ){\r
899                         X.Class._getPrivate( this ).listen( type, arg1, arg2, arg3 );\r
900                         return this;\r
901                 },\r
902                 listenOnce : function( type, arg1, arg2, arg3 ){\r
903                         X.Class._getPrivate( this ).listenOnce( type, arg1, arg2, arg3 );\r
904                         return this;\r
905                 },\r
906                 unlisten : function( type, arg1, arg2, arg3 ){\r
907                         X.Class._getPrivate( this ).unlisten( type, arg1, arg2, arg3 );\r
908                         return this;\r
909                 },\r
910                 dispatch : function( e ){\r
911                         return X.Class._getPrivate( this ).dispatch( e );\r
912                 },\r
913                         \r
914                 getNextNode : function(){\r
915                         \r
916                 },\r
917                 getPrevNode : function(){\r
918                         \r
919                 },\r
920                 nodeIndex : function( v ){\r
921                         var data = X.Class._getPrivate( this );\r
922                         if( typeof v === 'number' ){\r
923                                 // data.nodeIndex( v );\r
924                                 return this;\r
925                         };\r
926                         return data.parentData ? data.parentData.nodes.indexOf( data ) : 0;\r
927                 },\r
928                 displayIndex : function(){\r
929                         \r
930                 },\r
931                 getX : function(){\r
932                         // dirty の場合、rootData.calculate\r
933                         return X.Class._getPrivate( this ).x;\r
934                 },\r
935                 getY : function(){\r
936                         // dirty の場合、rootData.calculate\r
937                         return X.Class._getPrivate( this ).y;\r
938                 },\r
939                 getAbsoluteX : function(){\r
940                         // dirty の場合、rootData.calculate\r
941                         return X.Class._getPrivate( this ).absoluteX;\r
942                 },\r
943                 getAbsoluteY: function(){\r
944                         // dirty の場合、rootData.calculate\r
945                         return X.Class._getPrivate( this ).absoluteY;\r
946                 },\r
947                 getWidth : function(){\r
948                         // dirty の場合、rootData.calculate\r
949                         return X.Class._getPrivate( this ).boxWidth;\r
950                 },\r
951                 getHeight : function(){\r
952                         // dirty の場合、rootData.calculate\r
953                         return X.Class._getPrivate( this ).boxHeight;\r
954                 },\r
955                 scrollTo : function( x, y ){\r
956                         X.Class._getPrivate( this ).scrollTo( x, y );\r
957                 },\r
958                 getScrollX : function( v ){\r
959                         // dirty の場合、rootData.calculate\r
960                         return X.Class._getPrivate( this ).scrollX( v );\r
961                 },\r
962                 getScrollY : function( v ){\r
963                         // dirty の場合、rootData.calculate\r
964                         return X.Class._getPrivate( this ).scrollY( v );\r
965                 },\r
966                 disabled : function( v ){\r
967                         return X.Class._getPrivate( this ).disabled( v );\r
968                 },\r
969                 cursor : function( v ){\r
970                         return X.Class._getPrivate( this ).cursor( v );\r
971                 }\r
972         }\r
973 );\r
974 \r