Author: jcrowley
Date: 2007-07-05 00:03:52 -0700 (Thu, 05 Jul 2007)
New Revision: 5591

Modified:
   openlaszlo/branches/legals/WEB-INF/lps/lfc/core/LzNode.lzs
Log:
Change 20070629-jcrowley-W by [EMAIL PROTECTED] on 2007-06-29 02:20:21 EDT
    in /Users/jcrowley/src/svn/openlaszlo/legals-alpha
    for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: Put "searchParents" from LzView to LzNode

New Features:

Bugs Fixed: LPP-3377

Technical Reviewer: max
QA Reviewer: pbr
Doc Reviewer: 

Documentation:

Release Notes:

Details: Contributor fix from Andre Bargull.  Added searchParents to LzNode.lzs.
    

Tests: <canvas debug="true" >

  <dataset name="ds" >
    <root>
      <entry name="foo" />
    </root>
  </dataset>
  
  <view id="box" datapath="ds:/root" >
    
    <node name="mynode" datapath="entry" >
      <handler name="ondata" >
        Debug.write( "node:", this.data );
      </handler>
    </node>

    <view name="myview" datapath="entry" >
      <handler name="ondata" >
        Debug.write( "view:", this.data );
      </handler>
    </view>
    
  </view>

</canvas>

In unmodified branch, only "view:" will appear.  In modified branch, both will.



Modified: openlaszlo/branches/legals/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/core/LzNode.lzs  2007-07-05 
06:49:22 UTC (rev 5590)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/core/LzNode.lzs  2007-07-05 
07:03:52 UTC (rev 5591)
@@ -1664,7 +1664,25 @@
     return null;
 }
 
+/**
+  * Search up parent views for a named property. For now, returns when it finds
+  * the first one.
+  * 
+  * @param String prop: named property
+  * @return LzView: the first view which has a non-null value for 
<param>prop</param>
+  * or <i>null</i> if none is found
+  */
+function searchParents ( prop ){
+    var sview = this;
+    do{
+        sview = sview.immediateparent;
+        if (sview[ prop ] != null ){
+            return sview;
+        }
+    }while ( sview != canvas );
+}
 
+
 static var UIDs = 0;
 
 /**


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to