[Laszlo-checkins] r10912 - in openlaszlo/trunk: WEB-INF/lps/server/bin lps/components/base lps/components/incubator lps/components/incubator/tooltip

pbr@openlaszlo.org pbr at openlaszlo.org
Sun Sep 7 21:09:45 PDT 2008


Author: pbr
Date: 2008-09-07 21:09:41 -0700 (Sun, 07 Sep 2008)
New Revision: 10912

Modified:
   openlaszlo/trunk/WEB-INF/lps/server/bin/convert_setters.pl
   openlaszlo/trunk/lps/components/base/basecombobox.lzx
   openlaszlo/trunk/lps/components/incubator/baseedittext.lzx
   openlaszlo/trunk/lps/components/incubator/baseslider.lzx
   openlaszlo/trunk/lps/components/incubator/borderinput.lzx
   openlaszlo/trunk/lps/components/incubator/tooltip/tooltipview.lzx
   openlaszlo/trunk/lps/components/incubator/vslider.lzx
Log:
Change 20080907-Philip-4 by Philip at Philip-DC on 2008-09-07 20:52:53 EDT
     in /cygdrive/f/laszlo/svn/src/svn/openlaszlo/trunk
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix setters in components

New Features:

Bugs Fixed: LPP-5644 (partial)

Technical Reviewer: ptw
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
I am checking this in so it makes it into the nightly build.

My last checkin had some mistakes, most of them found by Andre. I modified convert_setters.pl to warn the user to check a setter="" in an attribute tag. Recursion problems can result when the script gets confused. For example, a class that defines a <text> attribute and
setText() setter might get rewritten into an infinite loop.

Other changesets for demos and examples to follow.

Tests:


Files:
M      WEB-INF/lps/server/bin/convert_setters.pl
M      lps/components/incubator/tooltip/tooltipview.lzx
M      lps/components/incubator/baseslider.lzx
M      lps/components/incubator/baseedittext.lzx
M      lps/components/incubator/vslider.lzx
M      lps/components/incubator/borderinput.lzx
M      lps/components/base/basecombobox.lzx

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080907-Philip-4.tar


Modified: openlaszlo/trunk/WEB-INF/lps/server/bin/convert_setters.pl
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/bin/convert_setters.pl	2008-09-08 04:04:07 UTC (rev 10911)
+++ openlaszlo/trunk/WEB-INF/lps/server/bin/convert_setters.pl	2008-09-08 04:09:41 UTC (rev 10912)
@@ -269,6 +269,13 @@
     my @lines=<IN>;
     close(IN);
 
+    # If the file contains any attribute setters, tell the user to manually
+    # check it
+    my $contents = join("\n", @lines);
+    if ($contents =~ /setter\s*=\s*['"]/) {
+      print "$file contains attribute setters. Please check these files manually\n";
+    }
+
     # Do each of the substitutions listed in %substitutions
     # map() does exactly what we want
     while (my ($orig, $replacement) = each(%substitutions)) {

Modified: openlaszlo/trunk/lps/components/base/basecombobox.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/basecombobox.lzx	2008-09-08 04:04:07 UTC (rev 10911)
+++ openlaszlo/trunk/lps/components/base/basecombobox.lzx	2008-09-08 04:09:41 UTC (rev 10912)
@@ -640,7 +640,6 @@
         <method name="_applystyle" args="s">
             if (this.style != null) {
                 if (editable) {
-Debug.warn("textfieldcolor", s.textfieldcolor, s);
                     interior.editbkgnd.setAttribute("bgcolor", s.textfieldcolor);
                     interior.cbtext.setAttribute('bgcolor',s.textfieldcolor);
                 } else {

Modified: openlaszlo/trunk/lps/components/incubator/baseedittext.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/baseedittext.lzx	2008-09-08 04:04:07 UTC (rev 10911)
+++ openlaszlo/trunk/lps/components/incubator/baseedittext.lzx	2008-09-08 04:09:41 UTC (rev 10912)
@@ -111,7 +111,7 @@
         <attribute name="pattern" value="$once{null}" type="string" />
 
         <!--- The height of the edit text box, default: 20. -->
-        <attribute name="height" value="20" setter="this.setAttribute('height', height)"/>
+        <attribute name="height" value="20"/>
 
         <!--- The width of the edit text box, default: 106. -->
         <attribute name="width" value="106"/>
@@ -149,11 +149,11 @@
         <!--- Set baseedittext height and correctly place text for
               internalinputfield using _placeTextY().
               @keywords private -->
-        <method name="setHeight" args="h">
+        <setter name="height" args="h">
             super.setAttribute('height', h);
             this._initialtexty = (!this._initcomplete);
             if (this._initcomplete) this._placeTextY()
-        </method>
+        </setter>
 
         <!--- Set edittext's and _field's multiline attributes. Will affect text
               placement if multiline attribute changes.

Modified: openlaszlo/trunk/lps/components/incubator/baseslider.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/baseslider.lzx	2008-09-08 04:04:07 UTC (rev 10911)
+++ openlaszlo/trunk/lps/components/incubator/baseslider.lzx	2008-09-08 04:09:41 UTC (rev 10912)
@@ -167,7 +167,7 @@
 
         <!--- constrain to parents bounds, and adjust slider value when dragged
               @keywords private -->
-        <method name="setX" args="x">
+        <setter name="x" args="x">
             var boundedx = x;
             if ( x > parent.width-width ) {
               var constrainX = parent.width-width;
@@ -187,7 +187,7 @@
             if (thedragstate.applied || lz.Keys.isKeyDown("leftarrow") || lz.Keys.isKeyDown("rightarrow") ) {
                 parent.parent.setValue(val);
             }
-        </method>
+        </setter>
     </class><!-- end basesliderthumb class -->
 </library>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************

Modified: openlaszlo/trunk/lps/components/incubator/borderinput.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/borderinput.lzx	2008-09-08 04:04:07 UTC (rev 10911)
+++ openlaszlo/trunk/lps/components/incubator/borderinput.lzx	2008-09-08 04:09:41 UTC (rev 10912)
@@ -5,7 +5,7 @@
 <library >
     <class name="borderinput">
         <attribute name="changed" value="${this.txt.changed}" />
-        <attribute name="text" setter="this.setAttribute('text', text)" />
+        <attribute name="text" setter="this.setText(text)" />
         <attribute name="labelwidth" type="number" value="80"/>
 
         <!-- label -->

Modified: openlaszlo/trunk/lps/components/incubator/tooltip/tooltipview.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/tooltip/tooltipview.lzx	2008-09-08 04:04:07 UTC (rev 10911)
+++ openlaszlo/trunk/lps/components/incubator/tooltip/tooltipview.lzx	2008-09-08 04:09:41 UTC (rev 10912)
@@ -15,7 +15,7 @@
       bgcolor="0x252525"
       width="${t.width + 6}" height="17" 
       visible="false">
-    <attribute name="text" value="" type="html" setter="this.setAttribute('text', text)" />
+    <attribute name="text" value="" type="html" setter="this.setText(text)" />
 
     <!-- shadow left -->
     <view bgcolor="black" opacity=".3" 

Modified: openlaszlo/trunk/lps/components/incubator/vslider.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/vslider.lzx	2008-09-08 04:04:07 UTC (rev 10911)
+++ openlaszlo/trunk/lps/components/incubator/vslider.lzx	2008-09-08 04:09:41 UTC (rev 10912)
@@ -46,13 +46,13 @@
                 return Math.round(valY);
         </method>
         
-        <method name="setY" args="v">
+        <setter name="y" args="v">
                 super.setAttribute('y', v);
-        var thumbVal = getValueFromPos();
-        if (thumbVal != parent.value) {
-            this.parent.setValue(thumbVal);
-        }               
-        </method>
+                var thumbVal = getValueFromPos();
+                if (thumbVal != parent.value) {
+                        this.parent.setValue(thumbVal);
+                }               
+        </setter>
     <dragstate name="dragger" drag_axis="y"
         drag_min_y="${ this.drag_min }"  
         drag_max_y="${ this.drag_max }">



More information about the Laszlo-checkins mailing list