OSDN Git Service

Version 0.6.48, fix X.UA for s60 Safari.
[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, type, list;\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                         \r
570                         if( dirty === X.UI.Dirty.CLEAN ){\r
571                                 if( this.percentWidth || this.percentHeight ){\r
572                                         \r
573                                 };\r
574                         };\r
575                         \r
576                         switch( dirty ){\r
577                                 \r
578                                 case X.UI.Dirty.CONTENT : // コンテンツが変更された\r
579                                 case X.UI.Dirty.FONT    : // フォントサイズが変更された\r
580                                         delete this.lastContentWidth;   \r
581                                         \r
582                                 case X.UI.Dirty.LAYOUT : // レイアウトの再計算が必要\r
583                                 \r
584                                 default : // TODO レイアウト崩れに対処 パフォーマンス悪い!\r
585                                 \r
586                                         w     = this.contentWidth;\r
587                                         h     = this.contentHeight;\r
588                                         xnode = this.xnode;\r
589                                         \r
590                                         /* http://web-designs.seesaa.net/article/188400668.html\r
591                                          * min-width の値が max-width の値より大きい場合は、max-width の値は min-width の値に設定される。\r
592                                          * \r
593                                          * テキストノードがあり\r
594                                          * 1. contentWidth === AUTO\r
595                                          *     style を更新して contentWidth の決定\r
596                                          *     min or max に引っかかったら style 更新\r
597                                          *     contentHeight === AUTO の場合\r
598                                          *     textHeight の決定\r
599                                          *     contentHeight !== AUTO の場合 scrollHeight のみ更新\r
600                                          * 2. contentHeight === AUTO かつ \r
601                                          *     コンテンツの高さの再取得が必要( contentWidth が最終計測時の contentWidth と一致 かつ フォント・コンテンツに変更無し の場合再取得不要)\r
602                                          *      style を更新して contentHeight の決定\r
603                                          *     必要でない\r
604                                          * 3. content のサイズがすでに決定している\r
605                                          *     コンテンツの高さの再取得が必要\r
606                                          *     必要でない\r
607                                          */\r
608                                         if( xnode._xnodes && xnode._xnodes.length ){\r
609                                                 if( w === X.UI.Attr.AUTO ){\r
610                                                         w = this.contentWidth = xnode.width() / xnode._getCharSize();\r
611                                                         \r
612                                                         this.scrollWidth = w + this.contentL + this.contentR;\r
613                                                         if( this.maxContentWidth < w - this.boxSizingOffsetLR ) this.contentWidth = this.maxContentWidth + this.boxSizingOffsetLR;\r
614                                                         if( w - this.boxSizingOffsetLR < this.minContentWidth ) this.contentWidth = this.minContentWidth + this.boxSizingOffsetLR;\r
615                                                         this.lastContentWidth = this.contentWidth;\r
616                                                         \r
617                                                         w !== this.contentWidth && xnode.css( 'width', this.contentWidth + 'em' );\r
618                                                         \r
619                                                         if( h === X.UI.Attr.AUTO ){\r
620                                                                 this.contentHeight = h = xnode.height() / xnode._getCharSize();\r
621                                                                 this.scrollHeight  = h + this.contentT + this.contentB;\r
622                                                                 if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB;\r
623                                                                 if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB;\r
624                                                         } else {\r
625                                                                 this.scrollHeight = xnode.height() / xnode._getCharSize() + this.contentT + this.contentB;\r
626                                                         };\r
627                                                 } else\r
628                                                 if( h === X.UI.Attr.AUTO ){\r
629                                                         if( w !== this.lastContentWidth ){\r
630                                                                 xnode.css( 'width', w + 'em' );\r
631                                                                 \r
632                                                                 this.lastContentWidth  = w;\r
633                                                                 this.contentHeight = h = xnode.height() / xnode._getCharSize();\r
634                                                                 this.scrollWidth       = w + this.contentL + this.contentR;\r
635                                                                 this.scrollHeight      = h + this.contentT + this.contentB;\r
636                                                                 if( this.maxContentHeight < h - this.boxSizingOffsetTB ) this.contentHeight = this.maxContentHeight + this.boxSizingOffsetTB;\r
637                                                                 if( h - this.boxSizingOffsetTB < this.minContentHeight ) this.contentHeight = this.minContentHeight + this.boxSizingOffsetTB;                                                           \r
638                                                         } else {\r
639                                                                 this.scrollWidth  = w + this.contentL + this.contentR;\r
640                                                                 this.scrollHeight = h + this.contentT + this.contentB;\r
641                                                         };\r
642                                                 } else\r
643                                                 if( dirty !== X.UI.Dirty.LAYOUT ){\r
644                                                         this.contentWidth  = this.lastContentWidth = w; //xnode.width();\r
645                                                         this.contentHeight = xnode.height() / xnode._getCharSize();\r
646                                                         this.scrollWidth   = this.contentWidth  + this.contentL + this.contentR;\r
647                                                         this.scrollHeight  = this.contentHeight + this.contentT + this.contentB;\r
648                                                 } else {\r
649                                                         this.scrollWidth  = w + this.contentL + this.contentR;\r
650                                                         this.scrollHeight = h + this.contentT + this.contentB;\r
651                                                 };              \r
652                                         } else {\r
653                                                 // コンテンツを持たないため基本のサイズは0\r
654                                                 if( w === X.UI.Attr.AUTO ) this.contentWidth  = w = 0 < this.minContentWidth  ? this.minContentWidth  : 0;\r
655                                                 if( h === X.UI.Attr.AUTO ) this.contentHeight = h = 0 < this.minContentHeight ? this.minContentHeight : 0;\r
656                                                 this.scrollWidth  = w + this.contentL + this.contentR;\r
657                                                 this.scrollHeight = h + this.contentT + this.contentB;\r
658                                         };\r
659                                         \r
660                                         delete this.dirty;\r
661                                         break;                  \r
662                                 //case X.UI.Dirty.PAINT : // 再描画のみ必要\r
663                                 //      break;\r
664                         };\r
665                 },\r
666                 /**\r
667                  * 自身の contentWidth, contentHeight を元に AUTO な width, height を確定していく\r
668                  */\r
669                 postMesure : function(){\r
670                         var     attrs    = this.attrObject || this.attrClass.prototype || X.UI.AttrClass,\r
671                                 calc     = _AbstractUINode.calcValue,\r
672                                 box      = attrs[ X.UI.Attr.Support.sizing.No ],\r
673                                 contentW, contentH,\r
674                                 contentPlus,\r
675                                 paddingT, paddingR, paddingB, paddingL,\r
676                                 borderT, borderR, borderB, borderL,\r
677                                 min, max;\r
678                                 \r
679                         // Width\r
680                         if( this.boxWidth === X.UI.Attr.AUTO ){\r
681                                 contentW = this.contentWidth;\r
682                                 paddingR = calc( attrs[ X.UI.Attr.Support.padding.No + 1 ], contentW );                                 \r
683                                 paddingL = calc( attrs[ X.UI.Attr.Support.padding.No + 3 ], contentW );                                 \r
684                                 borderR  = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 1 ], contentW );\r
685                                 borderL  = calc( attrs[ X.UI.Attr.Support.borderWidth.No + 3 ], contentW );\r
686                                 contentPlus = 0;\r
687                                 switch( box ){\r
688                                         case 3 : // border-box\r
689                                                  contentPlus  = borderR + borderL;\r
690                                         case 2 : // padding-box\r
691                                                  contentPlus += paddingR + paddingL;\r
692                                         // case 1 : // content-box\r
693                                 };\r
694                                 \r
695                                 if( !this.constraintW ){\r
696                                         contentW += contentPlus;\r
697                                         min = calc( attrs[ X.UI.Attr.Support.minWidth.No ], contentW );\r
698                                         max = calc( attrs[ X.UI.Attr.Support.maxWidth.No ], contentW );\r
699                                         if( contentW < min && contentPlus < min ){\r
700                                                 this.contentWidth = min - contentPlus;\r
701                                         } else\r
702                                         if( max < contentW && contentPlus < max ){\r
703                                                 this.contentWidth = max - contentPlus;\r
704                                         };\r
705                                 };\r
706                                 this.contentL = borderL + paddingL;\r
707                                 this.contentR = borderR + paddingR;\r
708                                 this.boxWidth = this.contentWidth + this.contentL + this.contentR;\r
709                         };\r
710                         // Height\r
711                         if( this.boxHeight === X.UI.Attr.AUTO ){\r
712                                 contentH    = this.contentHeight;\r
713                                 paddingT    = calc( attrs[ X.UI.Attr.Support.padding.No + 0 ], contentH );// paddingTRBL の % 指定は 最大幅に対して TB でも幅に対して\r
714                                 paddingB    = calc( attrs[ X.UI.Attr.Support.padding.No + 2 ], contentH );\r
715                                 borderT     = calc( attrs[ X.UI.Attr.Support.borderWidth.No  + 0 ], contentH );\r
716                                 borderB     = calc( attrs[ X.UI.Attr.Support.borderWidth.No  + 2 ], contentH );\r
717                                 contentPlus = 0;\r
718                                 switch( box ){\r
719                                         case 3 : // border-box\r
720                                                  contentPlus  = borderT + borderB;\r
721                                         case 2 : // padding-box\r
722                                                  contentPlus += paddingT + paddingB;\r
723                                         // case 1 : // content-box\r
724                                 };\r
725                                 if( !this.constraintH ){\r
726                                         contentH += contentPlus;\r
727                                         min = calc( attrs[ X.UI.Attr.Support.minHeight.No ], contentH );\r
728                                         max = calc( attrs[ X.UI.Attr.Support.maxHeight.No ], contentH );\r
729                                         if( contentH < min && contentPlus < min ){\r
730                                                 this.contentHeight = min - contentPlus;\r
731                                         } else\r
732                                         if( max < contentH && contentPlus < max ){\r
733                                                 this.contentHeight = max - contentPlus;\r
734                                         };\r
735                                 };\r
736                                 this.contentT  = borderT + paddingT;\r
737                                 this.contentB  = borderB + paddingB;\r
738                                 this.boxHeight = this.contentHeight + this.contentT + this.contentB;\r
739                         };\r
740                 },\r
741 \r
742                 capcher : function( x, y ){\r
743                         if( this.pointerDisabled ) return false;\r
744                         \r
745                         x -= this.x;\r
746                         y -= this.y;\r
747 \r
748                         if( 0 <= x && x < this.boxWidth && 0 <= y && y < this.boxHeight ){\r
749                                 !this.hovering && ( this.hoverList[ this.hoverList.length ] = this );\r
750                                 this.rootData.targetNodeData = this;\r
751                                 return true;\r
752                         };\r
753                 },\r
754                 \r
755                 \r
756                 listen : function( type, arg1, arg2, arg3 ){\r
757                         var root, events, counter;\r
758                         if( X.UI.Event._START_POINTER <= type && type <= X.UI.Event._END_POINTER ){\r
759                                 if( this.phase < 3 ){\r
760                                         if( !( events = this.reserveEvents ) ) this.reserveEvents = events = [];\r
761                                         events[ events.length ] = [ type, arg1, arg2, arg3 ];\r
762                                         return this;\r
763                                 };\r
764                                 if( X.UI.Event._START_XUI_EVENT < type && type < X.UI.Event._END_XUI_EVENT ){\r
765                                         if( !this.gesture ){\r
766                                                 this.gesture = new X.UI.Gesture( this.root, this, type );\r
767                                         } else {\r
768                                                 this.gesture.listen( type );\r
769                                         };\r
770                                 } else {\r
771                                         root    = this.rootData;\r
772                                         counter = root.eventCounter;\r
773                                         if( counter[ type ] ){\r
774                                                 ++counter[ type ];\r
775                                         } else {\r
776                                                 counter[ type ] = 1;                            \r
777                                                 root.elmMouseCatch.listen( X.UI.Event.IdToName[ type ], eventRellay );\r
778                                         };\r
779                                 };\r
780                         };\r
781                         if( typeof arg1 === 'function' ){\r
782                                 return X.EventDispatcher.prototype.listen.apply( this, [ type, this.User, arg1, arg2 ] );\r
783                         };\r
784                         return X.EventDispatcher.prototype.listen.apply( this, [ type, arg1 || this.User, arg2 || arg1, arg3 || arg2 ] );\r
785                 },\r
786                 unlisten : function( type, arg1, arg2, arg3 ){\r
787                         var root, events, i, ev, counter;\r
788                         if( X.UI.Event._START_POINTER <= type && type <= X.UI.Event._END_POINTER ){\r
789                                 if( this.phase < 3 ){\r
790                                         if( !( events = this.reserveEvents ) ) return this;\r
791                                         for( i = events.length; i; ){\r
792                                                 ev = events[ --i ];\r
793                                                 if( ev[ 0 ] === type && ev[ 1 ] === arg1 && ev[ 2 ] === arg2 ){\r
794                                                         events.split( i, 1 );\r
795                                                         return this;\r
796                                                 };\r
797                                         }; \r
798                                         return this;\r
799                                 };\r
800 \r
801                                 if( X.UI.Event._START_XUI_EVENT < type && type < X.UI.Event._END_XUI_EVENT ){\r
802                                         this.gesture && this.gesture.unlisten( type );\r
803                                 } else {\r
804                                         root    = this.rootData;\r
805                                         counter = root.eventCounter;\r
806                                         if( !counter[ type ] ) return this;\r
807                                         --counter[ type ];\r
808                                         if( counter[ type ] === 0 ){\r
809                                                 X.Dom.Event.remove( root.elmMouseCatch, X.UI.Event.IdToName[ type ], eventRellay );\r
810                                                 delete counter[ type ];\r
811                                         };\r
812                                 };\r
813                         };\r
814                         if( typeof arg1 === 'function' ){\r
815                                 return X.EventDispatcher.prototype.unlisten.apply( this, [ type, this.User, arg1, arg2 ] );\r
816                         };\r
817                         return X.EventDispatcher.prototype.unlisten.apply( this, [ type, arg1 || this.User, arg2 || arg1, arg3 || arg2 ] );\r
818                 },\r
819                 \r
820                 dispatch : function( e ){\r
821                         var xve  = X.UI.Event,\r
822                                 ret  = X.EventDispatcher.prototype.dispatch.call( this, e ),\r
823                                 type = e.type;\r
824                         if( ret & X.Callback.MONOPOLY && !this.hitChildData && ( xve._POINTER_MOVE === type || xve._MOUSE_MOVE === type || xve.FILE_DRAG === type ) ){\r
825                                 this.rootData.monopolyNodeData = this;\r
826                                 return ret;\r
827                         };\r
828                         this.rootData.monopolyNodeData = null;\r
829                         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
830                         return ret;\r
831                 }\r
832                 \r
833         }\r
834 );\r
835 \r
836 _AbstractUINode.calcValue = function( styleValue, srcValue ){\r
837         /*\r
838          * String の場合は必ず %\r
839          */     \r
840         if( X.Type.isString( styleValue ) ){\r
841                 return srcValue * parseFloat( styleValue ) / 100;\r
842         };\r
843         if( !X.Type.isNumber( styleValue ) ) return 0;\r
844         return styleValue;\r
845 };\r
846 \r
847 _AbstractUINode.finalValue = function( styleValue, styleMin, styleMax, srcValue ){\r
848         var calc = _AbstractUINode.calcValue,\r
849                 v    = calc( styleValue, srcValue ),\r
850                 min  = calc( styleMin, srcValue ),\r
851                 max  = calc( styleMax, srcValue );\r
852         return v <= min ? min : max <= v ? max : v;\r
853 };\r
854 \r
855 var AbstractUINode = X.Class.create(\r
856         'AbstractUINode',\r
857         X.Class.ABSTRACT | X.Class.SUPER_ACCESS,\r
858         {\r
859                 parent : function(){\r
860                         return X.Class._getPrivate( this ).parent;\r
861                 },\r
862                 root : function(){\r
863                         return X.Class._getPrivate( this ).root;\r
864                 },\r
865                 \r
866                 /*\r
867                  * unverifiedAttrs に全ての指定を控える\r
868                  * サポートされていない場合は無視される.親のレイアウトによって変わる\r
869                  */\r
870                 attr : function( nameOrObject, valueOrUnit ){\r
871                         var p = X.Class._getPrivate( this ),\r
872                                 layout, k, def, attrs, v;\r
873                         if( nameOrObject && X.Type.isObject( nameOrObject ) ){\r
874                                 // setter\r
875                                 layout = p.parentData && p.parentData.layout.overrideAttrsForChild; // root には parent がない\r
876                                 for( k in nameOrObject ){\r
877                                         // 親のレイアウトマネージャの許可しない\r
878                                         if( layout && !layout[ k ] ){\r
879                                                 continue;\r
880                                         };\r
881                                         if( def = p.supportAttrs[ k ] ){\r
882                                                 p.setAttr( k, def, nameOrObject[ k ] );\r
883                                         };\r
884                                 };\r
885                         } else\r
886                         if( X.Type.isString( nameOrObject ) ){\r
887                                 if( valueOrUnit !== undefined ){\r
888                                         if( 'em,%'.indexOf( valueOrUnit ) === -1 ){\r
889                                                 // setter\r
890                                                 p.setAttr( nameOrObject, valueOrUnit );\r
891                                         } else {\r
892                                                 // getter with unit\r
893                                                 return p.getAttrWithUnit( nameOrObject, valueOrUnit );\r
894                                         };\r
895                                 };\r
896                                 // getter\r
897                                 if( attrs = ( p.attrObject || p.attrClass.prototype || X.UI.AttrClass ) ){\r
898                                         def = p.supportAttrs[ nameOrObject ];\r
899                                         return def && attrs[ def.No ];\r
900                                 };\r
901                                 return v;\r
902                         };\r
903                         return this;\r
904                 },\r
905                 \r
906                 listen : function( type, arg1, arg2, arg3 ){\r
907                         X.Class._getPrivate( this ).listen( type, arg1, arg2, arg3 );\r
908                         return this;\r
909                 },\r
910                 listenOnce : function( type, arg1, arg2, arg3 ){\r
911                         X.Class._getPrivate( this ).listenOnce( type, arg1, arg2, arg3 );\r
912                         return this;\r
913                 },\r
914                 unlisten : function( type, arg1, arg2, arg3 ){\r
915                         X.Class._getPrivate( this ).unlisten( type, arg1, arg2, arg3 );\r
916                         return this;\r
917                 },\r
918                 dispatch : function( e ){\r
919                         return X.Class._getPrivate( this ).dispatch( e );\r
920                 },\r
921                         \r
922                 getNextNode : function(){\r
923                         \r
924                 },\r
925                 getPrevNode : function(){\r
926                         \r
927                 },\r
928                 nodeIndex : function( v ){\r
929                         var data = X.Class._getPrivate( this );\r
930                         if( typeof v === 'number' ){\r
931                                 // data.nodeIndex( v );\r
932                                 return this;\r
933                         };\r
934                         return data.parentData ? data.parentData.nodes.indexOf( data ) : 0;\r
935                 },\r
936                 displayIndex : function(){\r
937                         \r
938                 },\r
939                 getX : function(){\r
940                         // dirty の場合、rootData.calculate\r
941                         return X.Class._getPrivate( this ).x;\r
942                 },\r
943                 getY : function(){\r
944                         // dirty の場合、rootData.calculate\r
945                         return X.Class._getPrivate( this ).y;\r
946                 },\r
947                 getAbsoluteX : function(){\r
948                         // dirty の場合、rootData.calculate\r
949                         return X.Class._getPrivate( this ).absoluteX;\r
950                 },\r
951                 getAbsoluteY: function(){\r
952                         // dirty の場合、rootData.calculate\r
953                         return X.Class._getPrivate( this ).absoluteY;\r
954                 },\r
955                 getWidth : function(){\r
956                         // dirty の場合、rootData.calculate\r
957                         return X.Class._getPrivate( this ).boxWidth;\r
958                 },\r
959                 getHeight : function(){\r
960                         // dirty の場合、rootData.calculate\r
961                         return X.Class._getPrivate( this ).boxHeight;\r
962                 },\r
963                 scrollTo : function( x, y ){\r
964                         X.Class._getPrivate( this ).scrollTo( x, y );\r
965                 },\r
966                 getScrollX : function( v ){\r
967                         // dirty の場合、rootData.calculate\r
968                         return X.Class._getPrivate( this ).scrollX( v );\r
969                 },\r
970                 getScrollY : function( v ){\r
971                         // dirty の場合、rootData.calculate\r
972                         return X.Class._getPrivate( this ).scrollY( v );\r
973                 },\r
974                 disabled : function( v ){\r
975                         return X.Class._getPrivate( this ).disabled( v );\r
976                 },\r
977                 cursor : function( v ){\r
978                         return X.Class._getPrivate( this ).cursor( v );\r
979                 }\r
980         }\r
981 );\r
982 \r