[Laszlo-checkins] r16678 - in openlaszlo/trunk/WEB-INF/lps/lfc: core helpers views

ptw@openlaszlo.org ptw at openlaszlo.org
Wed Jun 9 09:00:39 PDT 2010


Author: ptw
Date: 2010-06-09 09:00:36 -0700 (Wed, 09 Jun 2010)
New Revision: 16678

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
Log:
Change 20100604-ptw-7 by ptw at padme.home on 2010-06-04 08:47:02 EDT
    in /Users/ptw/OpenLaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Remove earlySetters kludges

Bugs Fixed:  LPP-7354 Presentation Types (partial substrate cleanup)
Technical Reviewer: andre.bargull at udo.edu (Message-ID: <4C0F9C95.9010605 at udo.edu>)
QA Reviewer: max at openlaszlo.org (Message-ID: <4C0FAD55.8040602 at openlaszlo.org>)

Overview:

    `earlySetters` were an attempt by Adam to make a general mechanism,
    but each of the actual usages is a special case.  We don't support
    this generality outside of the kernel (it is handled instead by
    overriding the construct method), so I'm removing it.  It's just a
    lot of extra fragile mechanism that makes the init args more
    difficult to process and interferes with attribute annotation.

Details:

    LzNode, LaszloView, LaszloCanvas:  remove earlySetters lists.

    LzNode: Remove unused `doneClassRoot` flag, unused `defaultSet`
    method.  Handle the previous earlySetters explicitly in
    __LZapplyArgs.  For those that are only used to communicate
    between the compiler and the runtime ($delegates, $classrootdepth,
    $datapath), hoist the former setters inline (but keep the `-1`
    sentinel that indicates they are handled specially in
    __LZapplyArgs).

    LaszloView: Handle `clickregion`, formerly an earlySetter, in
    construct.

    LzState: Clean up class organization to match standard order.
    Remove unneeded initial value for __LZpool.  Make the constructor
    do something useful.  Hide unnecessary documentation of implicit
    event.  Remove 4.1-era deprecated API's.  Handle sorting
    `$delegates` between self and parent explicitly in __LZapplyArgs

Tests:
    smokecheck, selected demos



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs	2010-06-09 15:53:23 UTC (rev 16677)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs	2010-06-09 16:00:36 UTC (rev 16678)
@@ -529,8 +529,6 @@
   var initstage = null;
   /** @access private */
   var $isstate = false;
-  /** @access private */
-  var doneClassRoot = false;
 
   /** Reference to the node that was passed as this
    * node's ancestor in the constructor.  If this node was created
@@ -826,9 +824,8 @@
    *
    * This is the method to override if you need to initialize instances
    * of an LZX class as they are constructed.  If you override this
-   * method, you <b>must</b> call the superclass method (the simplest
-   * way to do this is to say <code>super.construct.apply(this,
-   * arguments)</code>. Note that construct can only be overriden within
+   * method, you <b>must</b> call the superclass method (<code>super.construct(parent,
+   * args)</code>. Note that construct can only be overriden within
    * a subclass definition, not within a customized instance.
    *
    * The construct method is also responsible for placing the newly-built view
@@ -887,8 +884,6 @@
    * signals an error in debug mode).
    */
   function construct ( parent , args ){
-    this.earlySetters = LzNode.earlySetters;
-
     var lp = parent; // lp == lexical parent
     this.parent = lp;
 
@@ -1107,26 +1102,45 @@
    */
   var ignoreplacement = false;
 
+  /*
+   * Special flags to keep these pseudo-args from being processed by
+   * `__LZapplyArgs` default case: each requires special handling.
+   * NOTE: [2010-06-09 ptw] LzState also uses the existence of a
+   * "setter" to sort state from parent attributes in its override of
+   * `__LZapplyArgs`.
+   */
+  /** @access private */
+  var $lzc$set_$delegates = -1;
+  /** @access private */
+  var $lzc$set_$classrootdepth = -1;
+  /** @access private */
+  var $lzc$set_$datapath = -1;
 
   /**
    * Applies a dictionary of args
    * @access private
    */
   function __LZapplyArgs ( args , constcall = null ){
+    var ignore = LzNode._ignoreAttribute;
     var oset = {};
     var hasset = null;
-    var hasearly = null;
-
     var inits = null;
     var constraints = null;
 
-    for ( var key in args ){
+    // `name` needs to be set ASAP
+    if ('name' in args) {
+      this.$lzc$set_name(args.name);
+      // Don't let it be re-processed as a setter below
+      delete args.name;
+    }
+
+    for ( var key in args ) {
       var val = args[key];
-      /* To see if it has key setter.  Cf., setAttribute */
-      var setr = '$lzc$set_' + key;
+      if ( oset[key] || (val === ignore) ) continue;
       //handle flash bug where objects slots are enumerated multiple times
-      if ( oset[key] || args[key] === LzNode._ignoreAttribute ) continue;
       oset[ key ] = true;
+      /* To see if it has key setter.  Cf., setAttribute */
+      var setr = '$lzc$set_' + key;
 
       if (val is LzInitExpr) {
         // Ordering is important, constraint is a subclass of once
@@ -1189,28 +1203,72 @@
         // [20100107 max] Simplifying to test explicitly for -1 since 
         // 'fake setters' are indicated that way: -1 must be used instead of 
         // null to get to this point see $lzc$set_id().
-        if (key in this.earlySetters) {
-          if (hasearly == null) { hasearly = []; }
-          hasearly[this.earlySetters[key]] = key;
+        if (hasset == null) { hasset = []; }
+        hasset.push(key);
+      }
+    }
+
+    /**
+     * Some attributes have to be handled early, and in a particular
+     * order.  NOTE: [2010-06-03 ptw] This ordering is traditional:
+     * name, $delegates, $classrootdepth, $datapath; although I don't
+     * see how any of these could affect one another.
+     */
+    // This is a pseudo-attribute from the NodeModel.  It's the set of
+    // delegates connecting handlers in this node to their respective
+    // events
+    if ('$delegates' in args) {
+      var $delegates = args.$delegates;
+      // $delegates is a sequence of triplets of the form
+      // eventname, methodname, referencemethodname
+      var cdels:Array = this.__LZconstraintdelegates;
+      var resarray:Array;
+      for (var i = 0, l = $delegates.length; i < l; i +=3){
+        if ( $delegates[i + 2] ) {
+          // This is a delegate on a 'foreign' event.  We can't
+          // install it until our child nodes have been created, in
+          // case one of them is the foreigner.
+          if (resarray == null) { resarray = []; }
+          resarray.push ( $delegates[ i ] , $delegates[ i +1 ] , $delegates[ i + 2 ] );
         } else {
-          if (hasset == null) { hasset = []; }
-          hasset.push(key);
+          var m = $delegates[i + 1];
+          if (! cdels) { cdels = this.__LZconstraintdelegates = []; }
+          cdels.push( new LzDelegate( this , m , this , $delegates[i] ) );
         }
       }
+      if ( resarray != null ){
+        this.__LZstoreAttr( resarray , "$delegates" );
+      }
     }
-
-    if (hasearly) {
-      for (var i = 1, l = hasearly.length; i < l; i++) {
-        if (i in hasearly) {
-          // bail if deleted, e.g. by setDatapath causing replication
-          if (this.__LZdeleted) return;
-          var key = hasearly[i];
-          var setr = '$lzc$set_' + key;
-          this[setr]( args[key] );
+    // This is a pseudo-argument, from the class compiler, that tells
+    // us the depth of this node relative to the root of the class.
+    // We use it to set the public `classroot` attribute of the node.
+    // When the compiler writes custom constructors for classes, this
+    // could be done more efficiently by simply propagating the root
+    // node to the child instantiators.
+    if ('$classrootdepth' in args) {
+      var $classrootdepth = args.$classrootdepth;
+      // NOTE: (LPP-7559) 0 is _not_ allowed, so `classroot.classroot`
+      // takes you to the next outer class, rather than in a loop.
+      if ($classrootdepth) {
+        var p = this.parent;
+        while (--$classrootdepth > 0) { p = p.parent }
+        this.classroot = p;
+      }
+    }
+    // Another pseudo-attribute from NodeModel:  The black-magic
+    // $datapath that will cause replication and destruction
+    if (('$datapath' in args) && (args.$datapath !== ignore)) {
+      var $datapath = args.$datapath;
+      if ($debug) {
+        if (! ($datapath instanceof Object)) {
+          Debug.debug('`$datapath` is non-object %w?', $datapath);
         }
       }
+      this.makeChild( $datapath , true);
     }
 
+    // Now install the attrs that will trigger setters
     if (hasset) {
       for (var i = hasset.length - 1; i >= 0; i--) {
         // bail if deleted, e.g. by setDatapath causing replication
@@ -1353,19 +1411,6 @@
   var $lzc$set_$setters = -1;
 
   /**
-   * @access private
-   */
-  function $lzc$set_$classrootdepth ( d ) {
-
-    if (!d) return;
-
-    var p = this.parent;
-    while ( --d > 0){ p = p.parent }
-
-    this.classroot = p;
-  }
-
-  /**
    * Binds the named attribute to the given path, relative to this node's
    * datapath. This is the method that is called when the $path{} constraint
    * is used. Note that the binding is two-way -- changing the value of the
@@ -1392,50 +1437,9 @@
     this.__LZconstraintdelegates.push ( new LzDataAttrBind( this.datapath, attr, path, type ));
   }
 
-  /** @access private */
-  static var earlySetters = new LzInheritedHash({
-    name            : 1 ,
-    $events         : 2 ,
-    $delegates      : 3 ,
-    $classrootdepth : 4 ,
-    $datapath       : 5
-    });
-  /** @access private */
-  var earlySetters;
-
   /**
    * @access private
    */
-  function $lzc$set_$delegates ( delarr ){
-    //delarr is a sequence of triplets of the form
-    //... eventname, methodname, referencemethodname
-    var l = delarr.length;
-    if (l < 1) return;
-
-    var dels:Array = this.__LZconstraintdelegates;
-    var resarray:Array = [];
-    for ( var i = 0; i < l;i +=3 ){
-      if ( delarr[i + 2] ) {
-        //let's resolve this later
-        resarray.push ( delarr[ i ] , delarr[ i +1 ] , delarr[ i + 2 ] );
-      } else {
-        var m = delarr[i + 1];
-        if (! dels) {
-          dels = this.__LZconstraintdelegates = [];
-        }
-        dels.push( new LzDelegate( this , m , this , delarr[i] ) );
-      }
-    }
-
-    if ( resarray.length ){
-      this.__LZstoreAttr( resarray , "$delegates" );
-    }
-
-  }
-
-  /**
-   * @access private
-   */
   function __LZstoreAttr ( val , prop ){
     if ( this.__LZresolveDict == null ){
       this.__LZresolveDict = {};
@@ -1490,9 +1494,9 @@
     if ( delarr.length < 1) {
       return;
     }
-    var dels:Array = this.__LZconstraintdelegates;
-    if (! dels){
-      dels = this.__LZconstraintdelegates = [];
+    var cdels:Array = this.__LZconstraintdelegates;
+    if (! cdels){
+      cdels = this.__LZconstraintdelegates = [];
     }
 
     var l = delarr.length;
@@ -1501,7 +1505,7 @@
       var sender = (sendermethodname != null) ? this[sendermethodname]() : null;
       if ( sender == null ) sender = this;
       var meth = delarr[i + 1];
-      dels.push( new LzDelegate( this , meth ,sender , delarr[i] ) );
+      cdels.push( new LzDelegate( this , meth ,sender , delarr[i] ) );
     }
 
   }
@@ -1557,9 +1561,9 @@
       }
     }
     if (dependencies && dependencies.length > 0){
-      var dels:Array = this.__LZconstraintdelegates;
-      if ( ! dels ){
-        dels = this.__LZconstraintdelegates = [];
+      var cdels:Array = this.__LZconstraintdelegates;
+      if ( ! cdels ){
+        cdels = this.__LZconstraintdelegates = [];
       }
 
       // NOTE: [2006-05-30 ptw] You may think to yourself 'this is
@@ -1577,7 +1581,7 @@
       for (var i = 0, l = dependencies.length; i < l; i += 2) {
         dp = dependencies[i];
         if (dp) {
-          dels.push( new LzDelegate(this, constraintMethodName, dp, "on" + dependencies[i + 1]) );
+          cdels.push( new LzDelegate(this, constraintMethodName, dp, "on" + dependencies[i + 1]) );
         }
       }
     }
@@ -1682,16 +1686,16 @@
    */
   function releaseConstraintMethod (constraintMethodName) {
     var result:Boolean = false;
-    var dels:Array = this.__LZconstraintdelegates;
-    if (dels) {
-      for (var i:int = 0; i < dels.length; ) {
-        var del:* = dels[i];
+    var cdels:Array = this.__LZconstraintdelegates;
+    if (cdels) {
+      for (var i:int = 0; i < cdels.length; ) {
+        var del:* = cdels[i];
         if (del is LzDelegate && del.c === this &&
                 del.m === this[constraintMethodName]) {
           if (del.__LZdeleted != true) {
             del.destroy();
           }
-          dels.splice(i, 1);
+          cdels.splice(i, 1);
           result = true;
         } else {
           i++;
@@ -1786,16 +1790,6 @@
   }
 
   /**
-   * @access private
-   */
-  function defaultSet ( val ,prop ){
-    if ( val != null ){
-      this[ prop ] = val ;
-    }
-  }
-
-
-  /**
    * Sets the datacontext for the node to the xpath given as an argument
    * @access public
    * @param String dp: The string to use as the datapath.
@@ -2355,22 +2349,6 @@
     }
   }
 
-  /**
-   * @access private
-   * setter for $datapath
-   */
-  function $lzc$set_$datapath( dpobj ){
-    if (dpobj === LzNode._ignoreAttribute) {
-      // a 'datapath' attribute overrode our $datapath
-      return;
-    } else if (! (dpobj instanceof Object)) {
-      if ($debug) {
-        Debug.debug('%s on non-object %w?', arguments.callee, dpobj)
-      }
-    }
-    this.makeChild( dpobj , true);
-  }
-
   /** @access private */
   static var presentationtypes = {
     string: StringPresentationType,

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs	2010-06-09 15:53:23 UTC (rev 16677)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/helpers/LzState.lzs	2010-06-09 16:00:36 UTC (rev 16678)
@@ -90,17 +90,6 @@
  * @lzxname state
  */
 dynamic class LzState extends LzNode {
-
-  /** @access private */
-  public function LzState ( parent:* , attrs:* , children:* = null, instcall:*  = null) {
-    super(parent,attrs,children,instcall);
-  }
-
-  /** @access private */
-  var __LZpool = [];
-  /** @access private */
-  var __LZstateconstraintdelegates;
-
   /**
    * @access private
    * @modifiers override
@@ -109,6 +98,31 @@
   /** @access private */
   static var attributes = new LzInheritedHash(LzNode.attributes);
 
+  /** @access private */
+  var heldArgs;
+  /** @access private */
+  var releasedconstraints;
+  /** @access private */
+  var appliedChildren;
+  /** @access private */
+  var applyOnInit:Boolean = false;
+  /** @access private */
+  var __LZpool:Array = null;
+  /** @access private */
+  var __LZstateconstraintdelegates;
+
+
+  /** @access private */
+  public function LzState ( parent:* , attrs:* , children:* = null, instcall:*  = null) {
+    // TODO: [2010-06-09 ptw] (LPP-5232) Move these initializations to
+    // the declaration when LPP-5232 is fixed.  (Note that super calls
+    // our override of __LZapplyArgs, which uses these instance
+    // variables.)
+    this.heldArgs = {};
+    this.appliedChildren = [];
+    super(parent,attrs,children,instcall);
+  }
+
   /**
    * Sent before a state is applied. The event argument is the state
    * that is being applied.
@@ -124,20 +138,6 @@
   var onremove:LzDeclaredEventClass = LzDeclaredEvent;
 
   /**
-   * Sent when a state is applied or removed.  The event argument is
-   * the new value of <code>applied</code> (<code>true</code> if the
-   * state is being applied, <code>false</code> if the state is being
-   * removed).
-   *
-   * @devnote This is actually sent by apply and remove at the same
-   * time as onapply and onremove are sent, since they directly
-   * manipulate applied.
-   *
-   * @lzxtype event
-   */
-  var onapplied:LzDeclaredEventClass = LzDeclaredEvent;
-
-  /**
    * Whether or not the state is applied.
    * <code>setAttribute('applied', true)</code> will apply the state.
    * <code>setAttribute('applied', false)</code> will remove the
@@ -169,22 +169,23 @@
     }
   }
   /**
-   * Backward-compatible version of `applied`.
-   * @deprecated in 4.1
+   * Sent when a state is applied or removed.  The event argument is
+   * the new value of <code>applied</code> (<code>true</code> if the
+   * state is being applied, <code>false</code> if the state is being
+   * removed).
+   *
+   * @lzxtype event
+   *
+   * @devnote This is actually sent by apply and remove at the same
+   * time as onapply and onremove are sent, since they directly
+   * manipulate applied.  (Marked as private because we do not
+   * document implicit events associated with attributes.)
+   *
    * @access private
    */
-  var isapplied = false;
-  /**
-   * Backward-compatible version of `applied`
-   * @deprecated in 4.1
-   * @access private
-   */
-  function $lzc$set_apply(v) { this.setApply(v); }
+  var onapplied:LzDeclaredEventClass = LzDeclaredEvent;
 
   /** @access private */
-  static var props = { apply : true }; // unused?
-
-  /** @access private */
   static var events = { onremove : true , onapply : true, onapplied : true };
   prototype.$isstate = true; // Defined in LzNode
   /** @access private */
@@ -217,30 +218,10 @@
    * @access private
    */
   function $lzc$set___LZsourceLocation(v) { this.__LZsetProperty(v, '__LZsourceLocation'); }
-  /** @access private */
-  var heldArgs;
-  /** @access private */
-  var handlerMethodNames;
-  /** @access private */
-  var releasedconstraints;
-  /** @access private */
-  var appliedChildren;
-  /** @access private */
-  var applyOnInit :Boolean = false;
 
   /**
    * @access private
    */
-  override function construct ( parent , args ){
-    super.construct(parent, args);
-    this.heldArgs = {};
-    this.handlerMethodNames = {};
-    this.appliedChildren = [];
-  }
-  
-  /**
-   * @access private
-   */
   override function init () {
     super.init();
     if (this.applyOnInit) {
@@ -257,30 +238,6 @@
   }
 
   /**
-   * @access private
-   * @deprecated Use setAttribute('applied', ...) instead.
-   */
-  function setApply ( doapply ){
-    if ($debug) {
-      Debug.deprecated(this, arguments.callee, "setAttribute('applied', " + doapply + ")");
-    }
-    if ( typeof(doapply) == 'function' ){
-      // this happens because there is an attribute with the same name as
-      // a function and both attributes and functions are sent in
-      // the same "attrs" data structure
-      // NOTE: [2007-05-16 ptw]
-      // This would happen if an LZX subclass of state overrode the
-      // apply method.  `addProperty` is the way to dynamically add
-      // a method.  YOW!  It seems like a really bad idea to have an
-      // attribute and method have the same name and disambiguate by
-      // type.  What do we think we are, a LISP2?
-      this.addProperty('apply', doapply);
-      return;
-    }
-    this.$lzc$set_applied(doapply);
-  }
-
-  /**
    * Applies the state to the state's parent. If the state is already applied,
    * has no effect.  This is the programmatic equivalent of
    * <code>setAttribute('applied', true)</code>.
@@ -291,8 +248,7 @@
     }
 
     var parent = this.parent;
-    // TODO [2008-05-14 ptw] Removed isapplied after 4.1
-    this.applied = this.isapplied = true;
+    this.applied = true;
 
     // release any constraints you are about to override
     var pia = parent._instanceAttrs;
@@ -350,8 +306,7 @@
       return;
     }
 
-    // TODO [2008-05-14 ptw] Removed isapplied after 4.1
-    this.applied = this.isapplied = false;
+    this.applied = false;
 
     if (this.onremove.ready) this.onremove.sendEvent( this );
     if (this.onapplied.ready) this.onapplied.sendEvent( false );
@@ -374,7 +329,7 @@
     for ( var i = 0; i < this.appliedChildren.length; i++ ){
       var ac = this.appliedChildren[ i ];
       if ( this.pooling ){
-        //if it's a view, we pool it -- otherwise we'll just reconstruct it
+        // if it's a view, we pool it -- otherwise we'll just reconstruct it
         if (ac is LzView){
           this.__LZpool.push ( this.__LZdetach( ac ) );
         } else {
@@ -440,21 +395,65 @@
    * application to parent.
    *
    * @devnote NOTE: [2006-12-09 ptw] Currently the only args that apply to the
-   * state are args that have setters or handlers for state events
+   * state are args that have setters
    */
   override function __LZapplyArgs ( args , constcall = null){
     var stateArgs = {};
     var held = this.heldArgs;
-    var handlers = this.handlerMethodNames;
+    var $delegates:Array = null;
+
     for (var key in args) {
       var val = args[key];
       var setr = '$lzc$set_' + key;
-      if (this[setr] is Function || key in handlers) {
+      if (key == '$delegates') {
+        $delegates = val;
+      } else if (this[setr]) {
         stateArgs[key] = val;
       } else {
         held[key] = val;
       }
     }
+
+    // Capture handlers that don't belong to the state for later
+    // application to the parent (and pass the ones that do apply to the
+    // state on to your superclass).
+    if ($delegates != null) {
+      var pardels:Array = null;
+      var mydels:Array = null;
+      var ignore = LzNode._ignoreAttribute;
+      // $delegates is a sequence of triplets of the form
+      // eventname, methodname, referencemethodname
+      for (var i = 0, l = $delegates.length; i < $delegates.length; i +=3){
+        // does this go with the state or the state's owner?  goes
+        // with the state ONLY IF the event is an event that the state
+        // sends, and a reference isn't given.
+        if (LzState.events[$delegates[i]] && (! $delegates[ i + 2 ])){
+          if (mydels == null) { mydels = []; }
+          var arrtopush = mydels;
+          // now, capture the method that this calls
+          var mname = $delegates[i +1];
+          //check to see if we held the method (we shouldn't have,
+          //because it is used by this state handler)
+          if (mname in held){
+            stateArgs[mname] = held[mname];
+            delete held[ mname ];
+          }
+        } else {
+          if (pardels == null) { pardels = []; }
+          var arrtopush = pardels;
+        }
+        arrtopush.push($delegates[i], $delegates[i + 1], $delegates[i +2]);
+      }
+      if (mydels != null){
+        // pass state handlers
+        stateArgs.$delegates = mydels;
+      }
+      if (pardels != null){
+        // hold parent handlers
+        held.$delegates = pardels;
+      }
+    }
+
     // If any stateArgs are LzOnceExpr's, we need to move the
     // methods they call from held to stateArgs
     for (var key in stateArgs) {
@@ -530,7 +529,7 @@
             // attach it to the parent
             held[newDependenciesName] = this[dependenciesName];
           }
-          // Clone the init expr with the new nameS
+          // Clone the init expr with the new names
           held[key] = new (expr.constructor)(newMethodName, newDependenciesName, dbgName);
         } else {
           // Clone the init expr with the new name
@@ -544,55 +543,7 @@
 
   /**
    * @access private
-   * Capture handlers that don't belong to the state for later
-   * application to the parent (and pass the ones that do apply to the
-   * state on to your superclass).
    */
-  override function $lzc$set_$delegates ( delarr ){
-    var pardels = [];
-    var mydels = [];
-
-    for ( var i = 0; i < delarr.length;i +=3 ){
-      //does this go with the state or the state's owner?
-      //goes with the state ONLY IF the event is an event that the state
-      //sends, and a reference isn't given.
-      if ( LzState.events[ delarr[ i ] ] && ! delarr[ i + 2 ] ){
-        var arrtopush = mydels;
-
-        //now, capture the method that this calls
-        var mname = delarr[ i +1 ];
-
-        //check to see if we already processed this method
-        //in __LZapplyArgs
-        if ( this.heldArgs[ mname ] ){
-          this.addProperty(mname, this.heldArgs[ mname ]);
-          delete this.heldArgs[ mname ];
-        }
-
-        //create a setter for this method; by definition attributes that
-        //the state has a setter for are handled by the state
-        this.handlerMethodNames[mname] = true;
-      } else {
-        var arrtopush = pardels;
-      }
-
-      arrtopush.push( delarr[ i ], delarr[ i + 1], delarr[ i +2 ] );
-    }
-
-    if ( mydels.length ){
-      // Install state handlers
-      super.$lzc$set_$delegates( mydels );
-    }
-
-    if ( pardels.length ){
-      this.heldArgs.$delegates = pardels;
-    }
-  }
-
-
-  /**
-   * @access private
-   */
   function __LZsetProperty ( prop, propname ){
     this[propname] = prop;
   }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs	2010-06-09 15:53:23 UTC (rev 16677)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloCanvas.lzs	2010-06-09 16:00:36 UTC (rev 16678)
@@ -358,9 +358,6 @@
         this.lpsversion = args.lpsversion + "." + this.__LZlfcversion;
         delete args.lpsversion;
 
-        // Set applyArgs ordering kludges.
-        this.earlySetters = LzView.earlySetters;
-
         if (!this.version){
             this.version = this.lpsversion;
         }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs	2010-06-09 15:53:23 UTC (rev 16677)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs	2010-06-09 16:00:36 UTC (rev 16678)
@@ -57,12 +57,8 @@
   * @modifiers override 
   */
 static var tagname = 'view';
-  /** @access private */
-  static var attributes = new LzInheritedHash(LzNode.attributes);
-  // We add some more kludges to those in LzNode.  See #construct
-  // where we override the LzNode setting
-  /** @access private */
-  static var earlySetters = new LzInheritedHash(LzNode.earlySetters);
+    /** @access private */
+    static var attributes = new LzInheritedHash(LzNode.attributes);
 
     /** @access private */
     var __LZlayout;
@@ -431,9 +427,6 @@
 override function construct ( parent , args) {
     super.construct( (parent ? parent : canvas), args );
 
-    // Set applyArgs ordering kludges.  Overriding those of LzNode
-    this.earlySetters = LzView.earlySetters;
-
     this.mask = this.immediateparent.mask;
 
     this.__makeSprite(args);
@@ -446,6 +439,11 @@
         }
     }
 
+    /*
+     * Process arguments that need to be handled either early, or in a
+     * particular order
+     */
+    // See if we have a defined width/height
     if (args['width'] != null || this.__LZhasConstraint('width')) {
         this.hassetwidth = true;
         this.__LZcheckwidth = false;
@@ -454,19 +452,26 @@
         this.hassetheight = true;
         this.__LZcheckheight = false;
     }
-
     if (args['clip']){
         this.clip = args.clip;
         this.makeMasked();
     }
+    var ignore = LzNode._ignoreAttribute;
+    // NOTE: [2010-06-03 ptw] This ordering is traditional:
+    // clickregion, stretches; although I don't see how the ordering
+    // could be important, since we also purport to support setting
+    // these attributes dynamically
+    if (args['clickregion'] != null){
+        this.$lzc$set_clickregion(args.clickregion);
+        args.clickregion = ignore;
+    }
     if (args['stretches'] != null){
         this.$lzc$set_stretches(args.stretches);
-        args.stretches = LzNode._ignoreAttribute;
+        args.stretches = ignore;
     }
-
     if (args['resource'] != null){
         this.$lzc$set_resource( args.resource );
-        args.resource = LzNode._ignoreAttribute;
+        args.resource = ignore;
     }
 
     if($debug){
@@ -1042,11 +1047,6 @@
     }
 }
 
-
-LzView.earlySetters.clickregion = 7;
-LzView.earlySetters.stretches = 8;
-
-
 /** @access private */
 var sprite:LzSprite = null;
 



More information about the Laszlo-checkins mailing list