Author: hqm
Date: 2008-03-22 20:05:30 -0700 (Sat, 22 Mar 2008)
New Revision: 8351
Modified:
openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs
Log:
merge of LzNode and LzView as3/as2 versions, passes dhtml smoke
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs
2008-03-22 22:18:33 UTC (rev 8350)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs
2008-03-23 03:05:30 UTC (rev 8351)
@@ -55,6 +55,16 @@
var layouts:* = null; // Used by replication
+ if ($swf9) {
+ ///////////////////////////////////////////////////////////////////
+ // TODO [hqm 2008-01] This won't work for adding methods that
+ // call super(). Need to make those real compile time methods (and
setters).
+ function addProperty(key:*,val:*):void {
+ this[key] = val;
+ }
+ }
+
+
/**
* Helper function to merge an class or instance's attributes with
* those of its superclass. Broken out because it is called by
@@ -151,7 +161,10 @@
this.__LZUID = "__U" + ++LzNode.__UIDs;
this.__LZdeferDelegates = true;
var qpos = LzDelegate.__LZdelegatesQueue.length;
- super();
+ if ($swf9) {
+ } else {
+ super();
+ }
// Node node start
if ($profile) {
@@ -280,7 +293,7 @@
* @todo 2006-05-24 ptw Adam says this is a hack that we should get
* rid of.
*/
- if (this.constructWithArgs) this.constructWithArgs( maskedargs );
+ this.constructWithArgs( maskedargs );
this.__LZdeferDelegates = null;
if (qpos != LzDelegate.__LZdelegatesQueue.length) {
@@ -311,13 +324,23 @@
}
/**
+ * @access private
+ */
+function constructWithArgs(args:*) { }
+
+
+/**
* Link up the getter/setter/defaultattr inheritance
* @access private
* @param Object prototype: the class prototype
*/
+
// class initializer
-static function initialize (prototype) {
+if ($swf9) {
+} else {
+ static function initialize (prototype) {
+
// Install in constructor map
// this in a class initializer, is the class
if (this.hasOwnProperty('tagname')) {
@@ -346,6 +369,7 @@
// }
}
}
+}
/** This event is sent right before a node becomes active --
* e.g. before a view displays, or before a layout affects its subviews.
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs
2008-03-22 22:18:33 UTC (rev 8350)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs
2008-03-23 03:05:30 UTC (rev 8351)
@@ -56,6 +56,10 @@
*/
class LzView extends LzNode {
+ function LzView ( parent:* , attrs:* , children:* = null, instcall:* =
null) {
+ super(parent,attrs,children,instcall);
+ }
+
//static var tabindexcounter = 1000;
/** @access private
@@ -70,6 +74,19 @@
static var earlySetters = new LzInheritedHash(LzNode.earlySetters);
+/** @access private
+ * Just used to effect a type cast of immediateparent to LzView
+ */
+ var vip:LzView = null;
+
+ var animators:Array;
+ var _height:Number;
+ var _width:Number;
+ var _y:Number;
+ var _x:Number;
+ var _resource;
+ var __LZhaser;
+
/** Event called when this view adds a subview
* @access public
* @lzxtype event
@@ -313,6 +330,7 @@
var DOUBLE_CLICK_TIME = 500;
/** @access private */
+// TODO [hqm 2008-03] Will asking for LzSprite.prototype.xxx work in SWF9?
var capabilities = LzSprite.prototype.capabilities;
/**
@@ -321,8 +339,12 @@
*
* @access public
*/
-function construct ( parent , args) {
- //Debug.write('LzView.construct', parent, args);
+override function construct ( parent , args) {
+ // TODO [hqm 2008-03] Needed to move this up earlier for swf9, better
verify that is OK in swf8/dhtml,
+ // but args won't be munged by applyArgs properly yet?
+ if ($swf9) {
+ this.__makeSprite(args);
+ }
//this.callInherited( "construct" , arguments.callee , parent ,args );
super.construct( (parent ? parent : canvas), args );
@@ -331,15 +353,31 @@
this.__LZdelayedSetters = LzView.__LZdelayedSetters;
this.earlySetters = LzView.earlySetters;
+
var ip = this.immediateparent;
+
+ // TODO [hqm 2008-03] this is a hack to cast to type LzView for
+ // the SWF9 compiler, until the compiler is taught to understand
+ // type casting DHTML/SWF8
+ if ($swf9) {
+ this.vip = LzView(this.immediateparent);
+ } else {
+ this.vip = this.immediateparent;
+ }
+
+
this.mask = ip.mask;
+ if ($swf9) {
+ // can we make swf9 support __makeSprite call here?
+ } else {
+ this.__makeSprite(args);
+ }
+
//this.__LZdepth = ip.__LZsvdepth++;
//this.__LZsvdepth = 0;
- this.__makeSprite(args);
-
if ( 'width' in args ){
this.hassetwidth = true;
this.__LZcheckwidth = false;
@@ -356,15 +394,15 @@
this.$lzc$set_stretches(args.stretches);
args.stretches = LzNode._ignoreAttribute;
}
- if ('resource' in args && args['resource'] != null && (! (args.resource
instanceof LzInitExpr)) ){
+ if (args['resource'] != null && (! (args.resource instanceof LzInitExpr))
){
this.$lzc$set_resource( args.resource );
args.resource = LzNode._ignoreAttribute;
}
if($debug){
- if( 'valign' in args && args['valign'] && 'y' in args && args['y']){
+ if(args['valign'] && args['y']){
Debug.warn("y attribute ignored; superseded by valign
constraint.");
}
- if( 'align' in args && args['align'] && 'x' in args && args['x']){
+ if(args['align'] && args['x']){
Debug.warn("x attribute ignored; superseded by align constraint.");
}
}
@@ -391,12 +429,14 @@
*
* @access public
*/
-function init( ) {
- //this.__LZmovieClipRef._visible = this.visible;
- //this.__LZbgRef._visible = this.visible;
- this.sprite.init(this.visible);
-
- //this.reevaluateSize();
+override function init( ) {
+ if (this.sprite) {
+ this.sprite.init(this.visible);
+ } else {
+ // TODO [hqm 2008-03] I put this in for a bug I was seeing
+ // swf9, need to see if it is still happening
+ Debug.warn("LzView init method called and this.sprite is null", this);
+ }
}
@@ -406,7 +446,13 @@
* @param LzView s: The new subview
*/
function addSubview ( s ){
- this.sprite.addChildSprite(s.sprite);
+ if (this.sprite) {
+ this.sprite.addChildSprite(s.sprite);
+ } else {
+ // TODO [hqm 2008-03] I put this in for a bug I was seeing
+ // swf9, need to see if it is still happening
+ Debug.warn("LzView.addSubview called when this.sprite is null",
this);
+ }
if ( s.addedToParent ) return;
@@ -434,8 +480,14 @@
* instantiating.
* @access private
*/
-function __LZinstantiationDone (){
- this.immediateparent.addSubview( this );
+override function __LZinstantiationDone (){
+ if (this.vip) {
+ (this.vip).addSubview( this );
+ } else {
+ // TODO [hqm 2008-03] This is to trace a bug of null immediateparent
seen in swf9 initialize
+ Debug.warn("LaszloView.__LZinstantiationDone immediateparent = null",
this);
+ }
+
//this.callInherited( '__LZinstantiationDone' , arguments.callee );
super.__LZinstantiationDone.apply(this, arguments);
}
@@ -1196,13 +1248,13 @@
* @access private
*
*/
-function destroy( recursiveCall ){
+override function destroy( recursiveCall = null){
if ( this.__LZdeleted ) return;
if (this.sprite) this.sprite.predestroy();
if ( this.addedToParent ){
- var svs = this.immediateparent.subviews;
+ var svs = this.vip.subviews;
if (svs != null) {
for( var i = svs.length - 1; i >= 0; i-- ){
if ( svs[ i ] == this ){
@@ -1223,17 +1275,20 @@
this.$lzc$set_visible ( false );
- if ( this.addedToParent ){
- if ( ('__LZoutliewidth' in this.immediateparent) &&
(this.immediateparent.__LZoutliewidth == this) ) {
- this.immediateparent.__LZoutliewidth=null;
+ if ( this.addedToParent ) {
+ if ( this.vip['__LZoutliewidth'] == this) {
+ this.vip.__LZoutliewidth = null;
}
- if ( ('__LZoutlieheight' in this.immediateparent) &&
(this.immediateparent.__LZoutlieheight == this) ) {
- this.immediateparent.__LZoutlieheight=null;
+ if ( this.vip['__LZoutlieheight'] == this) {
+ this.vip.__LZoutlieheight=null;
}
- if ('onremovesubview' in this.immediateparent)
- if (this.immediateparent.onremovesubview.ready)
this.immediateparent.onremovesubview.sendEvent( this );
+ if ('onremovesubview' in this.vip) {
+ if (this.vip.onremovesubview.ready) {
+ this.vip.onremovesubview.sendEvent( this );
+ }
+ }
}
}
@@ -1343,7 +1398,7 @@
this.sprite.setVisible(shown);
}
- var ip = this.immediateparent;
+ var ip:LzView = this.vip;
if (ip && ip.__LZcheckwidth)
ip.__LZcheckwidthFunction( this );
if (ip && ip.__LZcheckheight)
@@ -1394,8 +1449,8 @@
//this.__LZbgRef._xscale = v;
- if (this.immediateparent.__LZcheckwidth)
- this.immediateparent.__LZcheckwidthFunction( this );
+ if (this.vip && this.vip.__LZcheckwidth)
+ this.vip.__LZcheckwidthFunction( this );
if (this.onwidth.ready) this.onwidth.sendEvent( v );
@@ -1440,8 +1495,8 @@
}
this.hassetheight = true;
- if (this.immediateparent.__LZcheckheight)
- this.immediateparent.__LZcheckheightFunction( this );
+ if (this.vip && this.vip.__LZcheckheight)
+ this.vip.__LZcheckheightFunction( this );
if (this.onheight.ready) this.onheight.sendEvent( v );
@@ -1492,8 +1547,8 @@
if ( this.pixellock ) v = Math.floor( v );
this.sprite.setX(v)
- if (this.immediateparent.__LZcheckwidth)
- this.immediateparent.__LZcheckwidthFunction( this );
+ if (this.vip.__LZcheckwidth)
+ this.vip.__LZcheckwidthFunction( this );
if (this.onx.ready) this.onx.sendEvent( this.x );
}
}
@@ -1518,8 +1573,8 @@
if ( this.pixellock ) v = Math.floor( v );
this.sprite.setY(v)
- if (this.immediateparent.__LZcheckheight)
- this.immediateparent.__LZcheckheightFunction( this );
+ if (this.vip.__LZcheckheight)
+ this.vip.__LZcheckheightFunction( this );
if (this.ony.ready) this.ony.sendEvent( this.y );
}
}
@@ -1546,10 +1601,10 @@
this.setY( this.y, true );
}
- if (this.immediateparent.__LZcheckwidth)
- this.immediateparent.__LZcheckwidthFunction( this );
- if (this.immediateparent.__LZcheckheight)
- this.immediateparent.__LZcheckheightFunction( this );
+ if (this.vip.__LZcheckwidth)
+ this.vip.__LZcheckwidthFunction( this );
+ if (this.vip.__LZcheckheight)
+ this.vip.__LZcheckheightFunction( this );
}
/**
@@ -1592,13 +1647,13 @@
/** @access private */
function __LZalignCenter () {
- this.setAttribute( "x" , this.immediateparent.width /2
+ this.setAttribute( "x" , this.vip.width /2
- this.width /2);
}
/** @access private */
function __LZalignRight () {
- this.setAttribute( "x" , this.immediateparent.width
+ this.setAttribute( "x" , this.vip.width
- this.width);
}
@@ -1699,11 +1754,13 @@
}
/** @access private */
+if ($swf9) { } else {
+ // TODO [hqm 2008-03] update this when new dependencies scheme is put in
prototype.getBounds.dependencies = function ( who , self ){
return [ self, 'rotation' , self, 'x' , self , 'y' , self , 'width' ,
self , 'height' ];
}
-
+}
/**
* Sets the vertical alignment for the view to the given value. The
* alignment is based on the height of this view as compared to the
@@ -1744,13 +1801,13 @@
/** @access private */
function __LZvalignMiddle () {
- this.setAttribute( "y" , this.immediateparent.height /2
+ this.setAttribute( "y" , this.vip.height /2
- this.height /2);
}
/** @access private */
function __LZvalignBottom () {
- this.setAttribute( "y" , this.immediateparent.height
+ this.setAttribute( "y" , this.vip.height
- this.height);
}
@@ -1968,8 +2025,8 @@
this.sprite.setWidth(newsize);
if (this.onwidth.ready) this.onwidth.sendEvent( newsize );
- if (this.immediateparent.__LZcheckwidth)
- this.immediateparent.__LZcheckwidthFunction( this );
+ if (this.vip.__LZcheckwidth)
+ this.vip.__LZcheckwidthFunction( this );
}
}
@@ -1993,8 +2050,8 @@
this.sprite.setHeight(newsize);
if (this.onheight.ready) this.onheight.sendEvent( newsize );
- if (this.immediateparent.__LZcheckheight)
- this.immediateparent.__LZcheckheightFunction( this );
+ if (this.vip.__LZcheckheight)
+ this.vip.__LZcheckheightFunction( this );
}
}
@@ -2082,6 +2139,11 @@
}
+if ($swf9) {
+ // TODO [hqm 2008-03] update this when new dependencies scheme is put in
+
+} else {
+
/** @devnote This routine is unused.
* getAttributeRelative is the routine that is used in dependencies.
* "who" below should refer to "self"
@@ -2120,6 +2182,7 @@
}
return d;
}
+}
/**
@@ -2151,6 +2214,9 @@
}
}
+if ($swf9) { } else {
+ // TODO [hqm 2008-03] update this when new dependencies scheme is put in
+
prototype.getAttributeRelative.dependencies = function( who,self, prop ,
refView ){
var tLink = self.getLinkage( refView );
@@ -2186,6 +2252,7 @@
return d;
}
+}
/** @access private */
var __LZviewLinks = null;
@@ -2237,9 +2304,13 @@
return this.__mousecache[xory];
}
+if ($swf9) {
+ // TODO [hqm 2008-03] add this back in when new dependencies scheme is
working
+} else {
prototype.getMouse.dependencies = function( ) {
return [ LzIdle, "idle" ];
}
+}
/**
* returns true if the point is contained within the view.
@@ -2248,8 +2319,8 @@
* @return Boolean: boolean indicating whether or not the point lies within
the view
*/
function containsPt( x,y ) {
- return (((this.getAttribute("height")>= y) && (y >= 0)) &&
- ((this.getAttribute("width")>= x) && (x >= 0)));
+ return (((this.height >= y) && (y >= 0)) &&
+ ((this.width >= x) && (x >= 0)));
}
/**
@@ -2415,7 +2486,7 @@
* <code>none</code> , <code>clientonly</code> , <code>serveronly</code> ,
<code>both</code> (the default).
* @param String headers: Headers to send with the request, if any.
*/
-function setSource ( source , cache, headers){
+function setSource ( source , cache = null, headers = null){
this.sprite.setSource(source, cache, headers);
}
@@ -2615,9 +2686,11 @@
}
}
+if ($swf9) { } else {
prototype.getCurrentTime.dependencies = function ( who, self ){
return [ self , "frame" ];
}
+}
/**
* Returns the total amount of time the resource would take to play.
@@ -2645,10 +2718,16 @@
}
+if ($swf9) {
+ // TODO [hqm 2008-03] update this when new dependencies scheme is put in
+} else {
prototype.getTotalTime.dependencies = function ( who, self ){
return [ self , "load" ];
}
+}
+var __LZdidPPwarn = false;
+
/** @access private */
function getPlayPerc ( ){
if ( $debug ){
@@ -2661,10 +2740,11 @@
return this.frame/this.totalframes;
}
+if ($swf9) { } else {
prototype.getPlayPerc.dependencies = function ( who , self ){
return [ self, "frame" ];
}
-
+}
/**
* Shows or hides the hand cursor for this view.
* @param Boolean s: true shows the hand cursor for this view, false hides
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins