X.Class.PRIVATE_DATA,\r
{\r
layout : null,\r
- chromeNodes : null,\r
nodes : null,\r
forContainer : false,\r
tmpCss : null,\r
nodes[ --i ].initialize( root, rootData, this.User, this );\r
};\r
\r
+ this.styleData.initialize();\r
+ \r
this.phase = 1;\r
this.User.dispatch( { type : X.ViewEvent.INIT } );\r
},\r
\r
- addToParent : function( parentElement, skip ){\r
+ addToParent : function( parentElement ){\r
var nodes = this.nodes,\r
l = nodes.length,\r
- i = 0;\r
- skip !== true && parentElement.appendChild( this.rawElement );\r
+ i = 0;\r
+ parentElement && parentElement.appendChild( this.rawElement );\r
\r
- for( i = 0, l = nodes.length; i < l; ++i ){\r
+ for( ; i < l; ++i ){\r
nodes[ i ].addToParent( this.rawElement );\r
};\r
\r
- this.styleData.initialize();\r
- \r
this.phase = 2;\r
this.User.dispatch( { type : X.ViewEvent.ADDED } );\r
},\r
nodes[ --i ].afterAddition();\r
};\r
this.styleData.afterAddition();\r
+ \r
this.phase = 3;\r
this.User.dispatch( { type : X.ViewEvent.CREATION_COMPLETE } );\r
},\r
\r
calculate : function( x, y, w, h ){\r
- this.layout.calculate( this, x, y, w, h );\r
+ this.layout.calculate( this, x, y, w, h ); \r
this.phase = 4;\r
},\r
\r
data = X.Class._getPrivate( _nodes[ i ] );\r
_p1 = p1 && data.phase < 1;\r
_p2 = p2 && data.phase < 2;\r
- _p1 && data.initialize( this.root, this.rootData, this.User, this, this.rawElement );\r
+ _p1 && data.initialize( this.root, this.rootData, this.User, this );\r
if( index <= num ){\r
_p2 && this.rawElement.insertBefore( data.rawElement, nodes[ index + i ].rawElement );\r
- _p2 && data.addToParent( null, true );\r
+ _p2 && data.addToParent( null );\r
nodes.splice( index + i, 0, data );\r
} else {\r
_p2 && data.addToParent( this.rawElement );\r
nodes[ nodes.length ] = data; \r
};\r
p3 && data.phase < 3 && data.afterAddition();\r
+ p3 && data.phase < 4 && data.creationComplete();\r
};\r
4 <= this.phase && this.rootData.reserveCalc();\r
},\r
i, l, node;\r
if( !nodes || nodes.length === 0 ) return ret;\r
for( i = 0, l = nodes.length; i < l; ++i ){\r
- node = nodes[ i ];\r
- if( node instanceof klass ) ret[ ret.length ] = node.User;\r
+ node = nodes[ i ].User;\r
+ if( node instanceof klass ) ret[ ret.length ] = node;\r
};\r
return ret;\r
},\r
'_AbstractDisplayNode',\r
X.Class.ABSTRACT | X.Class.PRIVATE_DATA,\r
{\r
- phase : 0,\r
- root : null,\r
- rootData : null,\r
- parent : null,\r
- parentData : null,\r
- rawElement : null,\r
- rawStyle : null,\r
- style : null,\r
- styleData : null,\r
- forChrome : false, // メッキ\r
- //initialize : function( root, rootData, parent, parentData, parentElement ){},\r
- //afterAddition : function(){}\r
- //commitUpdate\r
- _remove : function(){ \r
+ phase : 0,\r
+ root : null,\r
+ rootData : null,\r
+ parent : null,\r
+ parentData : null,\r
+ rawElement : null,\r
+ rawStyle : null,\r
+ \r
+ events : null, // X.EventDispatcher で設定される\r
+ reserveEvents : null,\r
+ //elmScroll : null,\r
+ //elmScroller : null,\r
+ //elmScrollbar : null,\r
+ \r
+ style : null,\r
+ styleData : null,\r
+ forChrome : false, // メッキ\r
+\r
+ x : 0,\r
+ y : 0,\r
+ w : 0,\r
+ h : 0,\r
+ t : 0, // top\r
+ l : 0, // left\r
+ b : 0, // bottom\r
+ r : 0, // right\r
+ absoluteX : 0,\r
+ absoluteY : 0,\r
+ _scrollX : 0,\r
+ _scrollY : 0,\r
+ scrollingX : 0,\r
+ scrollingY : 0,\r
+ _cursor : '',\r
+ hitChildData : null,\r
+ hitSelf : false,\r
+ _disabled : false,\r
+ _childDisabled : false,\r
+ through : false,\r
+ clip : false,\r
+ hover : false,\r
+ hoverStyleName : null,\r
+ isHover : false,\r
+ scroll : false,\r
+ dragdrop : false,\r
+ tooltip : null,\r
+ \r
+ // :hover, :focus, :disabled\r
+ \r
+ initialize : function( root, rootData, parent, parentData, parentElement ){\r
+ this.root = root;\r
+ this.rootData = rootData;\r
+ this.parent = parent;\r
+ this.parentData = parentData;\r
+ this.rawElement = document.createElement( 'div' );\r
+ this.rawStyle = this.rawElement.style;\r
+ \r
+ this.styleData.initialize();\r
+ \r
+ this.phase = 1;\r
+ this.User.dispatch( { type : X.ViewEvent.INIT } );\r
+ },\r
+ \r
+ addToParent : function( parentElement ){\r
+ parentElement && parentElement.appendChild( this.rawElement );\r
+ \r
+ this.phase = 2;\r
+ this.User.dispatch( { type : X.ViewEvent.ADDED } );\r
+ },\r
+\r
+ /* Rellay\r
+ afterAddition : function(){\r
+ this.styleData.afterAddition();\r
+ \r
+ this.phase = 3;\r
+ this.User.dispatch( { type : X.ViewEvent.CREATION_COMPLETE } );\r
+ }, */\r
+ \r
+ creationComplete : function(){\r
+ if( this.phase < 3 ) return;\r
+ \r
+ var nodes = this.nodes,\r
+ l, i;\r
+ if( nodes ){\r
+ for( i = 0, l = nodes.length; i < l; ++i ){\r
+ nodes[ i ].creationComplete();\r
+ };\r
+ };\r
+ this.mesure();\r
+ \r
+ // this.scroll === true && ScrollBarManager.register( this );\r
+ \r
+ // html 要素が親に追加されるまで控えていたイベントの登録\r
+ var events = this.reserveEvents,\r
+ i;\r
+ if( !events ) return;\r
+ for( ; events.length; ){\r
+ this.User.listen.apply( this.User, events.shift() );\r
+ };\r
+ delete this.reserveEvents;\r
+ },\r
+ \r
+ mesure : function(){\r
+ var elm = this.rawElement,\r
+ x, y, w, h, parent;\r
+ if( elm ){\r
+ w = elm.offsetWidth;\r
+ h = elm.offsetHeight;\r
+ x = elm.offsetLeft;\r
+ y = elm.offsetTop; \r
+ if( this.x !== x || this.y !== y || this.w !== w || this.h !== h ){\r
+ this.x = x;\r
+ this.y = y;\r
+ this.w = w;\r
+ this.h = h;\r
+ ( parent = this.parentData ) && this.updateAbsoluteXY( parent.absoluteX, parent.absoluteY );\r
+ }; \r
+ };\r
+ this.updateRectangle();\r
+ },\r
+ \r
+ updateAbsoluteXY : function( x, y /* , scrollX, scrollY */ ){\r
+ var nodes = this.nodes, i;\r
+ this.absoluteX = x = this.x + x;\r
+ this.absoluteY = y = this.y + y;\r
+ if( !nodes ) return;\r
+ for( i = nodes.length; i; ){\r
+ nodes[ --i ].updateAbsoluteXY( x, y );\r
+ };\r
+ },\r
+ \r
+ updateRectangle : function(){\r
+ var w = this.w, h = this.h, x = this.x, y = this.y,\r
+ l = x, t = y, r = x + w, b = y + h,\r
+ nodes = this.nodes, i, node;\r
+ \r
+ if( nodes && this.clip === false ){\r
+ for( i = nodes.length; i; ){\r
+ node = nodes[ --i ];\r
+ if( node.l + x < l ) l = x + node.l;\r
+ if( node.t + y < t ) t = y + node.t;\r
+ if( r < node.r + x ) r = x + node.r;\r
+ if( b < node.b + y ) b = y + node.b;\r
+ };\r
+ };\r
+ // update\r
+ if( b !== this.b || r !== this.r || t !== this.t || l !== this.l ){\r
+ this.l = l;\r
+ this.t = t;\r
+ this.r = r;\r
+ this.b = b;\r
+ this.parentData && this.parentData.clip === false && this.parentData.updateRectangle();\r
+ };\r
+ },\r
+ \r
+ capcher : function( x, y ){\r
+ var nodes, child, _x, _y, hit, i;\r
+ if( this._disabled === true ) return false;\r
+ delete this.hitChildData;\r
+ x -= this.x;\r
+ y -= this.y;\r
+ if( nodes = this.nodes ){\r
+ _x = x - this.scrollingX;\r
+ _y = y - this.scrollingY;\r
+ for( i = nodes.length; i; ){\r
+ child = nodes[ --i ];\r
+ if( child._disabled === false && child.l <= _x && _x < child.r && child.t <= _y && _y < child.b && child.capcher( _x, _y ) === true ){\r
+ this.hitChildData = child;\r
+ break;\r
+ };\r
+ };\r
+ };\r
+ if( this.through === true ){\r
+ this.hitChildData && this.hitSelf === false && this.rootData.hoverList.push( this );\r
+ return !!this.hitChildData;\r
+ };\r
+ hit = 0 <= x && x < this.w && 0 <= y && y < this.h;\r
+ ( this.hitChildData || hit ) && this.hitSelf === false && this.rootData.hoverList.push( this );\r
+ if( hit === true && this.hitChildData === null ) this.rootData.targetNodeData = this;\r
+ return hit || !!this.hitChildData;\r
+ },\r
+ \r
+ dispatch : function( e ){\r
+ var xve = X.ViewEvent,\r
+ ret = X.EventDispatcher.prototype.dispatch.call( this.User, e ),\r
+ type = e.type;\r
+ if( ret & X.Cancel.MONOPOLY && !this.hitChildData && ( xve.POINTER_MOVE === type || type === xve.FILE_DRAG ) ){\r
+ this.rootData.monopolyNodeData = this;\r
+ return ret;\r
+ };\r
+ this.rootData.monopolyNodeData = null;\r
+ if( xve._NO_BUBLEUP < type && this.parentData && ret & X.Cancel.STOP_PROPAGATION === 0 && ret & X.Cancel.STOP_NOW === 0 ) return this.parentData.dispatch( e );\r
+ return ret;\r
+ },\r
+ \r
+ _remove : function(){\r
switch( this.phase ){\r
case 4:\r
case 3:\r
//this.styleData.afterAddition();\r
case 2:\r
- //this.styleData.initialize();\r
this.rawElement.parentNode.removeChild( this.rawElement );\r
case 1:\r
+ //this.styleData.initialize();\r
delete this.root;\r
delete this.rootData;\r
delete this.parent;\r
root : function(){\r
return X.Class._getPrivate( this ).root;\r
},\r
+ listen : function( type, arg1, arg2 ){\r
+ var root, data, events, counter;\r
+ if( X.ViewEvent._START_POINTER <= type && type <= X.ViewEvent._END_POINTER ){\r
+ data = X.Class._getPrivate( this );\r
+ if( data.phase < 3 ){\r
+ if( !( events = data.reserveEvents ) ) data.reserveEvents = events = [];\r
+ events[ events.length ] = [ type, arg1, arg2 ];\r
+ return this;\r
+ };\r
+ root = data.rootData;\r
+ counter = root.eventCounter;\r
+ if( counter[ type ] ){\r
+ ++counter[ type ];\r
+ } else {\r
+ counter[ type ] = 1;\r
+ X.DomEvent.add( root.elmMouseCatch, X.ViewEvent.IdToName[ type ], eventRellay ); \r
+ };\r
+ };\r
+ return X.EventDispatcher.prototype.listen.apply( this, arguments );\r
+ },\r
+ unlisten : function( type, arg1, arg2 ){\r
+ var root, data, events, i, ev, counter;\r
+ if( X.ViewEvent._START_POINTER <= type && type <= X.ViewEvent._END_POINTER ){\r
+ data = X.Class._getPrivate( this );\r
+ if( data.phase < 3 ){\r
+ if( !( events = data.reserveEvents ) ) return this;\r
+ for( i = events.length; i; ){\r
+ ev = events[ --i ];\r
+ if( ev[ 0 ] === type && ev[ 1 ] === arg1 && ev[ 2 ] === arg2 ){\r
+ events.split( i, 1 );\r
+ return this;\r
+ };\r
+ }; \r
+ return this;\r
+ };\r
+ root = data.rootData;\r
+ counter = root.eventCounter;\r
+ if( !counter[ type ] ) return this;\r
+ --counter[ type ];\r
+ if( counter[ type ] === 0 ){\r
+ X.DomEvent.remove( root.elmMouseCatch, X.ViewEvent.IdToName[ type ], eventRellay );\r
+ delete counter[ type ];\r
+ };\r
+ };\r
+ return X.EventDispatcher.prototype.unlisten.apply( this, arguments );\r
+ },\r
getNextNode : function(){\r
\r
},\r
\r
},\r
dispatch : function( e ){\r
- var ret = X.EventDispatcher.prototype.dispatch.call( this, e ),\r
- bubleup = X.ViewEvent._NO_BUBLEUP < e.type,\r
- parent; // root の場合 parent が存在しない\r
- if( bubleup === true && ret !== false && ( parent = X.Class._getPrivate( this ).parent ) ) return parent.dispatch( e );\r
- return ret;\r
+ return X.Class._getPrivate( this ).dispatch( e );\r
},\r
nodeIndex : function( v ){\r
var data = X.Class._getPrivate( this );\r
if( typeof v === 'number' ){\r
- return;\r
+ // data.nodeIndex( v );\r
+ return this;\r
};\r
return data.parentData ? data.parentData.nodes.indexOf( data ) : 0;\r
},\r
displayIndex : function(){\r
\r
},\r
+ // ちゃんとやれば不要!\r
+ mesure : function(){\r
+ var data = X.Class._getPrivate( this );\r
+ data.mesure();\r
+ 4 <= data.phase && data.rootData.reserveCalc();\r
+ return this;\r
+ },\r
getX : function(){\r
- \r
+ return X.Class._getPrivate( this ).x;\r
},\r
getY : function(){\r
- \r
+ return X.Class._getPrivate( this ).y;\r
},\r
getAbsoluteX : function(){\r
- \r
+ return X.Class._getPrivate( this ).absoluteX;\r
},\r
getAbsoluteY: function(){\r
- \r
+ return X.Class._getPrivate( this ).absoluteY;\r
},\r
getWidth : function(){\r
- \r
+ return X.Class._getPrivate( this ).w;\r
},\r
getHeight : function(){\r
- \r
+ return X.Class._getPrivate( this ).h;\r
}\r
}\r
);
\ No newline at end of file
return this;\r
},\r
getNodesByClass : function( klass ){\r
- X.Class._getPrivate( this ).containerNode.User.getNodesByClass( klass );\r
- return ret;\r
+ return X.Class._getPrivate( this ).containerNode.User.getNodesByClass( klass );\r
},\r
getFirstChild : function(){\r
return X.Class._getPrivate( this ).containerNode.User.getFirstChild();\r
numNodes : function(){\r
return X.Class._getPrivate( this ).containerNode.User.numNodes();\r
},\r
- getChromeAt : function( index ){\r
+ getContainerNode : function(){\r
+ return X.Class._getPrivate( this ).containerNode.User;\r
+ },\r
+ getChromeNodeAt : function( index ){\r
if( index < 0 ) return null;\r
var nodes = X.Class._getPrivate( this ).chromeNodes;\r
- return nodes ? nodes[ index ] || null : null;\r
+ return nodes ? nodes[ index ].User || null : null;\r
},\r
numChromeNodes : function(){\r
var nodes = X.Class._getPrivate( this ).chromeNodes;\r
nodeData : null,
_name : '',
allow : null,
- _css : null,
+ _cssText : null,
+ _cssObj : null,
Constructor : function( node, nodeData ){
this.node = node;
this.nodeData = nodeData;
nodeData.style = this.User;
nodeData.styleData = this;
- this._css = {};
+ this._cssObj = {};
if( nodeData.tmpCss ){
- if( nodeData.tmpCss.role === 'container' ) this.nodeData.forContainer = true;
- if( nodeData.tmpCss.role === 'chrome' ) this.nodeData.forChrome = true;
+ if( nodeData.tmpCss.role === 'container' ) nodeData.forContainer = true;
+ if( nodeData.tmpCss.role === 'chrome' ) nodeData.forChrome = true;
};
},
/* Rellay */
removeName : function( _names ){
var sp = ' ',
names = this._name,
- name, i;
+ name, i, index;
if( !names.length ) return this.User;
names = names.split( sp );
_names = _names.split( sp );
for( i = _names.length; i; ){
name = _names[ --i ];
- name !== '' && names.indexOf( name ) === -1 && names.splice( i, 1 );
+ name !== '' && ( index = names.indexOf( name ) ) !== -1 && names.splice( index, 1 );
};
return this.name( names.join( sp ) );
},
};
},
css : function( v ){
- var css = this._css,
+ var css = this._cssObj,
allow = this.allow,
TRANS = {
x : 'left',
case 'name' :
this.addName( v[ p ] );
continue;
+ case 'hoverStyleName' :
+ this.nodeData.hoverStyleName = v[ p ];
+ this.nodeData.hover = !!( v[ p ] && v[ p ].length );
+ continue;
case 'left' :
if( allow.x === false ) continue;
break;
this.cssText( X.Style.objToCssText( css ) );
},
layout : function( x, y, w, h ){
- var style = this.nodeData.rawStyle,
- obj = this._css,
- f = X.Type.isFinite;
-
- if( f( x ) ) x += 'px';
- if( f( y ) ) y += 'px';
- if( f( w ) ) w += 'px';
- if( f( h ) ) h += 'px';
+ var isFinite = X.Type.isFinite,
+ isString = X.Type.isString,
+ obj = this._cssObj,
+ data = this.nodeData,
+ elm = data.rawElement,
+ style = data.rawStyle,
+ parent;
- if( x ){
- obj.left = x;
- if( style ) style.left = x;
- };
- if( y ){
- obj.top = y;
- if( style ) style.top = y;
+ if( elm ){
+ // width
+ if( isFinite( w ) === true ){
+ style.width = w + 'px';
+ obj.width = w;
+ } else
+ if( isString( w ) === true ){
+ style.width = obj.width = w;
+ w = elm.offsetWidth;
+ };
+ // height
+ if( isFinite( h ) === true ){
+ style.height = h + 'px';
+ obj.height = h;
+ } else
+ if( isString( h ) === true ){
+ style.height = obj.height = w;
+ h = elm.offsetHeight;
+ };
+
+ // x
+ if( isFinite( x ) === true ){
+ style.left = x + 'px';
+ obj.left = x
+ } else
+ if( isString( x ) === true ){
+ style.left = obj.left = x;
+ x = elm.offsetLeft;
+ };
+
+ // y
+ if( isFinite( y ) === true ){
+ style.top = y + 'px';
+ obj.top = y;
+ } else
+ if( isString( y ) === true ){
+ style.top = obj.top = y;
+ y = elm.offsetTop;
+ };
};
- if( w ){
- obj.width = w;
- if( style ) style.width = w;
+ x = isFinite( x ) === true ? x : data.x;
+ y = isFinite( y ) === true ? y : data.y;
+ w = isFinite( w ) === true ? w : data.w;
+ h = isFinite( h ) === true ? h : data.h;
+ if( data.x !== x || data.y !== y ){
+ data.x = x;
+ data.y = y;
+ ( parent = data.parentData ) && data.updateAbsoluteXY( parent.absoluteX, parent.absoluteY );
+ if( data.w === w && data.h === h ){
+ data.updateRectangle();
+ 4 <= data.phase && data.rootData.reserveCalc();
+ return;
+ };
};
- if( h ){
- obj.height = h;
- if( style ) style.height = h;
+ if( data.w !== w || data.h !== h ){
+ data.w = w;
+ data.h = h;
+ data.updateRectangle();
+ 4 <= data.phase && data.rootData.reserveCalc();
};
+
+ // ScrollBarManager.update( this );
}
}
);
calculate : function( data, x, y, w, h ){\r
var nodes = data.nodes,\r
styleData = data.styleData,\r
- cssObj = styleData._css,\r
- //childW = cssObj.childW,\r
+ cssObj = styleData._cssObj,\r
+ childW = cssObj.childW,\r
childH = cssObj.childH,\r
- gapX = cssObj.gapX,\r
- //gapY = cssObj.gapY,\r
- padding = cssObj.padding,\r
+ gapX = cssObj.gapX || 0,\r
+ gapY = cssObj.gapY || 0,\r
+ padding = cssObj.padding || 0,\r
_x = padding,\r
_y = padding,\r
i = 0, l = nodes.length, node;\r
\r
- if( childH || childH === 0 ){\r
+ if( childW || childW === 0 ){\r
for( ; i < l; ++i ){\r
node = nodes[ i ];\r
if( node instanceof _AbstractDisplayContainer ){\r
- node.calculate( 0, y, w - x, childH );\r
+ node.calculate( _x, NaN, childW, childH );\r
} else {\r
- node.styleData.layout( 0, y, w - x, childH );\r
+ node.styleData.layout( _x, NaN, childW, childH );\r
};\r
- y += childH + gapY;\r
+ _x += childW + gapX;\r
};\r
} else {\r
for( ; i < l; ++i ){\r
node = nodes[ i ];\r
if( node instanceof _AbstractDisplayContainer ){\r
- node.calculate( 0, y, w - x );\r
+ node.calculate( _x, NaN, NaN, childH );\r
} else {\r
- node.styleData.layout( 0, y, w - x );\r
+ node.styleData.layout( _x, NaN, NaN, childH );\r
};\r
- y += node.rawElement.offsetHeight + gapY;\r
+ _x += node.rawElement.offsetWidth + gapX;\r
};\r
};\r
- data.styleData.layout( x, y, w, _y + childH + padding );\r
+ data.styleData.layout( x, y, w, h );\r
}\r
});\r
\r
+
+var currentRootData = null;
+
+function eventRellay( e ){
+ var x = e.clientX,
+ y = e.clientY,
+ type = X.ViewEvent.NameToID[ e.type ],
+ i = 0,
+ data = currentRootData,
+ sysOnly = false,
+ list, ret, parent;
+ if( type !== X.ViewEvent.POINTER_MOVE ){
+ // console.log( e.type + ' x:' + x + ', y:' + y )
+ };
+
+ e.type = type;
+
+ if( data && ( data = data.monopolyNodeData ) && ( ret = data.dispatch( e ) ) & X.Cancel.MONOPOLY ) return ret;
+ if( currentRootData === null ) return;
+ list = currentRootData.hoverList;
+ data = currentRootData.targetNodeData = currentRootData;
+ data.capcher( x, y );
+ data = currentRootData.targetNodeData;
+ //console.log( 'absX: ' + data.absoluteX + ', absY:' + data.absoluteY )
+ // data.apiuser.updateCoursor( data.targetNodeData._cursor );
+ while( data ){
+ ret = data.dispatch( e, sysOnly );
+ if( ret & X.Cancel.MONOPOLY || ret & X.Cancel.STOP_PROPAGATION || ret & X.Cancel.STOP_NOW ) break; // sysOnly = true;
+ data = data.parentData;
+ };
+
+ for( i = list.length; i; ){
+ parent = data = list[ --i ];
+ while( parent.parentData && parent === parent.parentData.hitChildData ){
+ parent = parent.parentData;
+ };
+ if( parent !== currentRootData ){
+ data.isHover === true && data.styleData.removeName( data.hoverStyleName );
+ delete data.isHover;
+ data.events && data.events[ X.ViewEvent.POINTER_OUT ] && data.dispatch( e, X.ViewEvent.POINTER_OUT, false ); // new Event
+ delete data.hitSelf;
+ list.splice( i, 1 );
+ continue;
+ };
+ if( data.hover === true && data.isHover === false ){
+ data.styleData.addName( data.hoverStyleName );
+ data.isHover = true;
+ };
+ if( data.hitSelf === false ){
+ data.events && data.events[ X.ViewEvent.POINTER_IN ] && data.dispatch( e, X.ViewEvent.POINTER_IN, true ); // new Event
+ data.hitSelf = true;
+ };
+ };
+ return false;
+};
+
var _PageRoot = _AbstractDisplayContainer.inherits(
'_PageRoot',
X.Class.FINAL | X.Class.PRIVATE_DATA | X.Class.SUPER_ACCESS,
{
- calcReserved : false,
+ calcReserved : false,
+ hoverList : null,
+ targetNodeData : null,
+ monopolyNodeData : null,
+
+ elmMouseCatch : null, // rootData only
+ eventCounter : null, // rootData only
+ cursorStyle : null, // rootData only
+
Constructor : function( layout, args ){
this.SuperConstructor( layout, args );
} else {
X.View.listenOnce( X.ViewEvent.SYS_READY, this, this.start );
};
+
+ this.hoverList = [];
+ this.eventCounter = {};
+
+ currentRootData = this;
},
+
start : function(){
- this.initialize( this.User, this, this.User, this );
+ this.initialize( this.User, this, null, null );
X.Timer.once( 0, this, this.addToView );
},
addToView : function(){
+ var counter = this.eventCounter, elm;
+
+ // document.body.insertBefore( this.rawElement, elmInteractive );
+ // this.elmMouseCatch の前に追加する!
this.addToParent( document.body );
+
+ elm = document.createElement( 'div' );
+ document.body.appendChild( elm );
+
+ // elm.style.cssText = 'position:absolute;top:0;left:0;height:100%;';
+ elm.className = 'mouse-operation-catcher';
+ elm.unselectable = 'on';
+ this.elmMouseCatch = elm;
+
+ // hover や rollover rollout のための move イベントの追加
+ // X.View.activate, X.View.deactivate ?
+ // mouseout, mouseover
+ X.DomEvent.add( elm, X.ViewEvent.IdToName[ X.ViewEvent.POINTER_MOVE ], eventRellay );
+ if( counter[ X.ViewEvent.POINTER_MOVE ] ){
+ ++counter[ X.ViewEvent.POINTER_MOVE ];
+ } else {
+ counter[ X.ViewEvent.POINTER_MOVE ] = 1;
+ };
+
X.Timer.once( 0, this, this.afterAddToView );
},
afterAddToView : function(){
this.afterAddition();
+ this.creationComplete();
X.Timer.once( 0, this, this.doFirstCalc );
},
+
doFirstCalc : function(){
this.doCalculate();
X.View.listen( X.ViewEvent.VIEW_RESIZED, this, this.doCalculate );
};
this.layout.calculate( this, 0, 0, w, h );
this.calcReserved = false;
+ },
+
+ updateCoursor : function( cursor ){
+
+ },
+
+ beforeRemove : function(){
+ X.DomEvent.remove( this.elmMouseCatch, X.ViewEvent.IdToName[ X.ViewEvent.POINTER_MOVE ], eventRellay );
}
}
);
this.style.addName( 'PageRoot' );
}
}
-);
\ No newline at end of file
+);
};\r
this.content = content;\r
},\r
- initialize : function( root, rootData, parent, parentData, parentElement ){\r
- this.root = root;\r
- this.rootData = rootData;\r
- this.parent = parent;\r
- this.parentData = parentData;\r
- this.rawElement = document.createElement( 'div' );\r
- this.rawStyle = this.rawElement.style;\r
-\r
- this.phase = 1;\r
- this.User.dispatch( { type : X.ViewEvent.INIT } );\r
- },\r
- addToParent : function( parentElement, skip ){\r
- skip !== true && parentElement.appendChild( this.rawElement );\r
- \r
- this.styleData.initialize();\r
- \r
- this.phase = 2;\r
- this.User.dispatch( { type : X.ViewEvent.ADDED } );\r
- },\r
afterAddition : function(){\r
- // if( this.phase === 0 ) return;\r
-\r
this.rawElement.innerHTML = this.content;\r
this.styleData.afterAddition();\r
+ \r
this.phase = 3;\r
this.User.dispatch( { type : X.ViewEvent.CREATION_COMPLETE } );\r
}\r
calculate : function( data, x, y, w, h ){\r
var nodes = data.nodes,\r
styleData = data.styleData,\r
- cssObj = styleData._css,\r
+ cssObj = styleData._cssObj,\r
childW = cssObj.childW,\r
childH = cssObj.childH,\r
gapX = cssObj.gapX,\r
calculate : function( data, x, y, w, h ){\r
var nodes = data.nodes,\r
styleData = data.styleData,\r
- cssObj = styleData._css,\r
+ cssObj = styleData._cssObj,\r
//childW = cssObj.childW,\r
childH = cssObj.childH,\r
gapX = cssObj.gapX || 0,\r
\r
if( childH || childH === 0 ){\r
for( ; i < l; ++i ){\r
- console.log( _y )\r
node = nodes[ i ];\r
if( node instanceof _AbstractDisplayContainer ){\r
node.calculate( 0, _y, w - x, childH );\r
};\r
} else {\r
for( ; i < l; ++i ){\r
- console.log( _y )\r
node = nodes[ i ];\r
if( node instanceof _AbstractDisplayContainer ){\r
node.calculate( 0, _y, w - x );\r