[Laszlo-checkins] r10943 - in openlaszlo/trunk/lps/components: base incubator/rich-text incubator/rich-text/test queens-charts/shared

bargull@openlaszlo.org bargull at openlaszlo.org
Wed Sep 10 02:24:58 PDT 2008


Author: bargull
Date: 2008-09-10 02:24:51 -0700 (Wed, 10 Sep 2008)
New Revision: 10943

Modified:
   openlaszlo/trunk/lps/components/base/resizeview.lzx
   openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx
   openlaszlo/trunk/lps/components/incubator/rich-text/test/baserichedittext-test.lzx
   openlaszlo/trunk/lps/components/incubator/rich-text/test/scrollrichedittext-test.lzx
   openlaszlo/trunk/lps/components/queens-charts/shared/databar.lzx
   openlaszlo/trunk/lps/components/queens-charts/shared/label.lzx
Log:
Change 20080909-bargull-WKJ by bargull at dell--p4--2-53 on 2008-09-09 23:59:47
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: update applyConstraint in components

New Features:

Bugs Fixed: LPP-6882

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

Documentation:

Release Notes:

Details:
"LzNode#applyConstraint" is deprecated, only a handful of components still used it. Updated all callers to use "LzNode#applyConstraintMethod". 
    

Tests:



Modified: openlaszlo/trunk/lps/components/base/resizeview.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/resizeview.lzx	2008-09-10 08:30:07 UTC (rev 10942)
+++ openlaszlo/trunk/lps/components/base/resizeview.lzx	2008-09-10 09:24:51 UTC (rev 10943)
@@ -1,94 +1,90 @@
 <library>
-    <include href="utils/layouts/stableborderlayout.lzx"/>
+    <include href="utils/layouts/stableborderlayout.lzx" />
 
-    <class name="resizeview_x">
-        <attribute name="left" type="string"/>
-        <attribute name="middle" type="string"/>
-        <attribute name="right" type="string"/>
-        <attribute name="frame"
-            setter="this.frame=frame;
-                    if (this['onframe']) this.onframe.sendEvent(frame)"/>
-        <handler name="oninit">
+    <class name="resizeview_x" >
+        <attribute name="left" type="string" />
+        <attribute name="middle" type="string" />
+        <attribute name="right" type="string" />
+        <attribute name="frame" />
+
+        <method name="init" >
+            this.leftview.setAttribute('resource', this.left);
+            this.middleview.setAttribute('resource', this.middle);
+            this.rightview.setAttribute('resource', this.right);
+
+            super.init();
+
             // if this view has a height, then the child views should
             // be constrained to that height, otherwise they will be sized
             // to the height of their resource
-            if (hassetheight) {
-                var d = [  this , 'height' ];
-                leftview.applyConstraintMethod('adjheight' , d );
-                middleview.applyConstraintMethod('adjheight' , d );
-                rightview.applyConstraintMethod( 'adjheight' , d );
+            if (this.hassetheight) {
+                var d = [ this, 'height' ];
+                this.applyConstraintMethod('adjheight', d );
             }
-        </handler>
-        <view name="leftview" stretches="height">
-            <method name="adjheight" args="ignore">
-                 this.setAttribute('height', this.immediateparent.height);
-            </method>
-            <attribute name="frame" value="${parent.frame}"/>
-            <handler name="onconstruct">
-                this.setAttribute('resource', parent.left);
-            </handler>
-        </view>
-        <view name="middleview" stretches="both">
-            <method name="adjheight" args="ignore">
-                 this.setAttribute('height', this.immediateparent.height);
-            </method>
-            <attribute name="frame" value="${parent.frame}"/>
-            <handler name="onconstruct">
-                this.setAttribute('resource', parent.middle);
-            </handler>
-        </view>
-        <view name="rightview" stretches="height">
-            <method name="adjheight" args="ignore">
-                 this.setAttribute('height', this.immediateparent.height);
-            </method>
-            <attribute name="frame" value="${parent.frame}"/>
-            <handler name="onconstruct">
-                this.setAttribute('resource', parent.right);
-            </handler>
-        </view>
-        <stableborderlayout name="sbl" axis="x"/>
+        </method>
+
+        <method name="adjheight" args="h" >
+            this.leftview.setAttribute('height', h);
+            this.middleview.setAttribute('height', h);
+            this.rightview.setAttribute('height', h);
+        </method>
+
+        <setter name="frame" args="fr" >
+            this.frame = fr;
+            this.onframe.sendEvent(fr);
+
+            this.leftview.setAttribute('frame', fr);
+            this.middleview.setAttribute('frame', fr);
+            this.rightview.setAttribute('frame', fr);
+        </setter>
+
+        <view name="leftview" stretches="height" />
+        <view name="middleview" stretches="both" />
+        <view name="rightview" stretches="height" />
+        <stableborderlayout name="sbl" axis="x" />
     </class>
 
-    <class name="resizeview_y">
-        <attribute name="top" type="string"/>
-        <attribute name="middle" type="string"/>
-        <attribute name="bottom" type="string"/>
-        <attribute name="frame"
-            setter="this.frame=frame;
-                    if (this['onframe']) this.onframe.sendEvent(frame)"/>
-        <handler name="oninit">
-            // if this view has a height, then the child views should
-            // be constrained to that height, otherwise they will be sized
-            // to the height of their resource
-            if (hassetwidth) {
-                var f = function (){
-                    this.setAttribute( "width" , this.immediateparent.width);
-                }
-                var d = [  this , 'width' ];
-                topview.applyConstraint( 'width' , f , d );
-                middleview.applyConstraint( 'width' , f , d );
-                bottomview.applyConstraint( 'width' , f , d );
+    <class name="resizeview_y" >
+        <attribute name="top" type="string" />
+        <attribute name="middle" type="string" />
+        <attribute name="bottom" type="string" />
+        <attribute name="frame" />
+
+        <method name="init" >
+            this.topview.setAttribute('resource', this.top);
+            this.middleview.setAttribute('resource', this.middle);
+            this.bottomview.setAttribute('resource', this.bottom);
+
+            super.init();
+
+            // if this view has a width, then the child views should
+            // be constrained to that width, otherwise they will be sized
+            // to the width of their resource
+            if (this.hassetwidth) {
+                var d = [ this, 'width' ];
+                this.applyConstraintMethod('adjwidth', d );
             }
-        </handler>
-        <view name="topview" stretches="width">
-            <attribute name="frame" value="${parent.frame}"/>
-            <handler name="onconstruct">
-                this.setAttribute('resource', parent.top);
-            </handler>
-        </view>
-        <view name="middleview" stretches="both">
-            <attribute name="frame" value="${parent.frame}"/>
-            <handler name="onconstruct">
-                this.setAttribute('resource', parent.middle);
-            </handler>
-        </view>
-        <view name="bottomview" stretches="width">
-            <attribute name="frame" value="${parent.frame}"/>
-            <handler name="onconstruct">
-                this.setAttribute('resource', parent.bottom);
-            </handler>
-        </view>
-        <stableborderlayout name="sbl" axis="y"/>
+        </method>
+
+        <setter name="frame" args="fr" >
+            this.frame = fr;
+            this.onframe.sendEvent(fr);
+
+            this.topview.setAttribute('frame', fr);
+            this.middleview.setAttribute('frame', fr);
+            this.bottomview.setAttribute('frame', fr);
+        </setter>
+
+        <method name="adjwidth" args="w" >
+            this.topview.setAttribute('width', w);
+            this.middleview.setAttribute('width', w);
+            this.bottomview.setAttribute('width', w);
+        </method>
+
+        <view name="topview" stretches="width" />
+        <view name="middleview" stretches="both" />
+        <view name="bottomview" stretches="width" />
+        <stableborderlayout name="sbl" axis="y" />
     </class>
 
 </library>

Modified: openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx	2008-09-10 08:30:07 UTC (rev 10942)
+++ openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx	2008-09-10 09:24:51 UTC (rev 10943)
@@ -40,33 +40,28 @@
                         Debug.error("%s.scrollbarclassname invalid: %s", this, classname);
                     }
                 }
+                
+                this._vs = new (lz[classname])(this, 
+                                                 { axis: "y",
+                                                   scrollattr: "pos",
+                                                   scrolltarget: this.inp });
                 var vsinit = function () {
                     var p = this.parent;
                     
                     // _vs.x="${parent.width - this.width}" 
-                    this.applyConstraint("x", 
-                        function() { this.setAttribute("x", this.parent.width - this.width); },
-                        [p, "width", this, "width"]);
+                    this.addProperty("__constraintX", function(ignore) { this.setAttribute("x", this.parent.width - this.width); });
+                    this.applyConstraintMethod("__constraintX", [p, "width", this, "width"]);
                     
                     // _vs.stepsize="${parent.inp.lineheight}" 
-                    this.applyConstraint("stepsize", 
-                        function() { this.setAttribute("stepsize", this.parent.inp.lineheight); }, 
-                        [p.inp, "lineheight"]);
+                    this.addProperty("__constraintStepsize", function(ignore) { this.setAttribute("stepsize", this.parent.inp.lineheight); });
+                    this.applyConstraintMethod("__constraintStepsize", [p.inp, "lineheight"]);
                     
-                    // _vs.scrollmax="${parent.inp.maxheight}" />
-                    this.applyConstraint("scrollmax", 
-                        function() { this.setAttribute("scrollmax", this.parent.inp.maxheight); }, 
-                        [p.inp, "maxheight"]);
-
-                    #pragma "methodName=init"
-                    super.init();
+                    // _vs.scrollmax="${parent.inp.maxheight}" 
+                    this.addProperty("__constraintScrollmax", function(ignore) { this.setAttribute("scrollmax", this.parent.inp.maxheight); });
+                    this.applyConstraintMethod("__constraintScrollmax", [p.inp, "maxheight"]);
                 }
                 
-                this._vs =  new (lz[classname])(this, 
-                                                 { axis: "y",
-                                                   scrollattr: "pos",
-                                                   scrolltarget: this.inp,
-                                                   init: vsinit });
+                vsinit.call(this._vs);
             }
         </method>
         

Modified: openlaszlo/trunk/lps/components/incubator/rich-text/test/baserichedittext-test.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/rich-text/test/baserichedittext-test.lzx	2008-09-10 08:30:07 UTC (rev 10942)
+++ openlaszlo/trunk/lps/components/incubator/rich-text/test/baserichedittext-test.lzx	2008-09-10 09:24:51 UTC (rev 10943)
@@ -20,12 +20,16 @@
             assertEquals("", gbet.getValue()); 
             assertEquals(gbet.getValue(), gbet.getText()); 
         </method>
+        <method name="addTests" >
+            this.addTest("testSimple");
+            this.addTest("testInitialConditions");
+        </method>
     </TextTestCase>
 </TestSuite>
 
 </canvas>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2006 Laszlo Systems, Inc. All Rights Reserved.                    *
+* Copyright 2006, 2008 Laszlo Systems, Inc. All Rights Reserved.                    *
 * Use is subject to license terms.                                            *
 * X_LZ_COPYRIGHT_END ****************************************************** -->
 <!-- @LZX_VERSION@                                                         -->

Modified: openlaszlo/trunk/lps/components/incubator/rich-text/test/scrollrichedittext-test.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/rich-text/test/scrollrichedittext-test.lzx	2008-09-10 08:30:07 UTC (rev 10942)
+++ openlaszlo/trunk/lps/components/incubator/rich-text/test/scrollrichedittext-test.lzx	2008-09-10 09:24:51 UTC (rev 10943)
@@ -22,12 +22,16 @@
                 assertEquals("", gText.getValue()); 
                 assertEquals(gText.getValue(), gText.getText()); 
             </method>
+            <method name="addTests" >
+                this.addTest("testSimple");
+                this.addTest("testInitialConditions");
+            </method>
         </ScrollRichEditTextTestCase>
     </TestSuite>
 
 </canvas>
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007 Laszlo Systems, Inc. All Rights Reserved.                    *
+* Copyright 2007-2008 Laszlo Systems, Inc. All Rights Reserved.                    *
 * Use is subject to license terms.                                            *
 * X_LZ_COPYRIGHT_END ****************************************************** -->
 <!-- @LZX_VERSION@                                                         -->

Modified: openlaszlo/trunk/lps/components/queens-charts/shared/databar.lzx
===================================================================
--- openlaszlo/trunk/lps/components/queens-charts/shared/databar.lzx	2008-09-10 08:30:07 UTC (rev 10942)
+++ openlaszlo/trunk/lps/components/queens-charts/shared/databar.lzx	2008-09-10 09:24:51 UTC (rev 10943)
@@ -52,63 +52,29 @@
             // Constrains width and positioning to the size and scale of
             // the bar view.
             if(this.drawaxis == 'x'){
-                var f = function(){   
-                    this.setAttribute("width",
-                        (parent.width / this.siblingbars) - this.barspace);       
-                }
                 var d = [parent, "width"];
-                this.applyConstraint("width", f, d);
+                this.applyConstraintMethod("__constraintAxisX_width", d);
 
-                var ff = function(){
-                    this.setAttribute("x", ((this.barnumber * this.totalsets) *
-                        (this.width + this.barspace)) + ((this.width + this.barspace) *
-                        this.barset));
-                }
                 var dd = [this, "width"];
-                this.applyConstraint("x", ff, dd);
+                this.applyConstraintMethod("__constraintAxisX_x", dd);
 
-                var fff = function(){
-                    this.setAttribute("height", Math.abs(this.bvalue) * parent.classroot.scaler);
-                }
                 var ddd = [parent.classroot, "scaler"];
-                this.applyConstraint("height", fff, ddd);
+                this.applyConstraintMethod("__constraintAxisX_height",  ddd);
 
-                var g = function(){
-                    if(this.bvalue < 0){
-                        this.setAttribute("y", parent.height - (Math.abs(parent.classroot.minimum) * parent.classroot.scaler));
-                    } else {
-                        this.setAttribute("y", parent.height - (Math.abs(parent.classroot.minimum) * parent.classroot.scaler) -
-                            this.height - (parent.classroot.zerowidth / 2));
-                    }
-                }
                 var h = [parent, "height"];
-                this.applyConstraint("y", g, h);
+                this.applyConstraintMethod("__constraintAxisX_y", h);
             } else {
-                var f = function(){
-                    this.setAttribute("height",
-                        (parent.height / this.siblingbars) - this.barspace);
-                }
                 var d = [parent, "height"];
-                this.applyConstraint("height", f, d);
-                var ff = function(){
-                    this.setAttribute("y", ((this.barnumber * this.totalsets) *
-                        (this.height + this.barspace)) + ((this.height + this.barspace) *
-                        this.barset));
-                }
+                this.applyConstraintMethod("__constraintAxisY_height", d);
+
                 var dd = [this, "height"];
-                this.applyConstraint("y", ff, dd);
-                var fff = function(){
-                    this.setAttribute("width", Math.abs(this.bvalue) * parent.classroot.altscaler);
-                }
+                this.applyConstraintMethod("__constraintAxisY_y", dd);
+
                 var ddd = [parent.classroot, "altscaler"];
-                this.applyConstraint("width", fff, ddd);
+                this.applyConstraintMethod("__constraintAxisY_width", ddd);
 
-                var g = function(){
-                    this.setAttribute("x", (Math.abs(parent.classroot.minimum) * parent.classroot.altscaler) -
-                        (parent.classroot.zerowidth / 2) - (this.bvalue < 0 ? this.width : 0));
-                }
                 var h = [parent, "width"];
-                this.applyConstraint("x", g, h);
+                this.applyConstraintMethod("__constraintAxisY_x", h);
             }
             // Sends bars behind labels.
             this.sendBehind(parent.subnodes[2]);
@@ -137,6 +103,50 @@
             }
             ]]>
         </method>
+        
+        <method name="__constraintAxisX_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", ((this.barnumber * this.totalsets) *
+                (this.width + this.barspace)) + ((this.width + this.barspace) *
+                this.barset));
+        ]]></method>
+        
+        <method name="__constraintAxisX_y" args="ignore" ><![CDATA[
+            if(this.bvalue < 0){
+                this.setAttribute("y", parent.height - (Math.abs(parent.classroot.minimum) * parent.classroot.scaler));
+            } else {
+                this.setAttribute("y", parent.height - (Math.abs(parent.classroot.minimum) * parent.classroot.scaler) -
+                    this.height - (parent.classroot.zerowidth / 2));
+            }
+        ]]></method>
+        
+        <method name="__constraintAxisX_width" args="ignore" ><![CDATA[
+            this.setAttribute("width",
+                (parent.width / this.siblingbars) - this.barspace);
+        ]]></method>
+        
+        <method name="__constraintAxisX_height" args="ignore" ><![CDATA[
+            this.setAttribute("height", Math.abs(this.bvalue) * parent.classroot.scaler);
+        ]]></method>
+        
+        <method name="__constraintAxisY_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", (Math.abs(parent.classroot.minimum) * parent.classroot.altscaler) -
+                (parent.classroot.zerowidth / 2) - (this.bvalue < 0 ? this.width : 0));
+        ]]></method>
+        
+        <method name="__constraintAxisY_y" args="ignore" ><![CDATA[
+            this.setAttribute("y", ((this.barnumber * this.totalsets) *
+                (this.height + this.barspace)) + ((this.height + this.barspace) *
+                this.barset));
+        ]]></method>
+        
+        <method name="__constraintAxisY_width" args="ignore" ><![CDATA[
+            this.setAttribute("width", Math.abs(this.bvalue) * parent.classroot.altscaler);
+        ]]></method>
+        
+        <method name="__constraintAxisY_height" args="ignore" ><![CDATA[
+            this.setAttribute("height",
+                (parent.height / this.siblingbars) - this.barspace);
+        ]]></method>
 
         <!--- Animations for bars.  Can easily be extended in the future to include
             different animations for a greater range of visual awesomeness. -->

Modified: openlaszlo/trunk/lps/components/queens-charts/shared/label.lzx
===================================================================
--- openlaszlo/trunk/lps/components/queens-charts/shared/label.lzx	2008-09-10 08:30:07 UTC (rev 10942)
+++ openlaszlo/trunk/lps/components/queens-charts/shared/label.lzx	2008-09-10 09:24:51 UTC (rev 10943)
@@ -54,56 +54,67 @@
             <![CDATA[
             if(this.charttype == "bar"){
                 if(this.drawaxis == 'x'){
-                    var f = function(){   
-                        this.setAttribute("x", this.barlink.x + (this.barlink.width / 2) -
-                            (this.width / 2));       
-                    }
                     var d = [this.barlink, "x"];
-                    this.applyConstraint("x", f, d);
-                    var ff = function(){
-                        this.setAttribute("y", this.barlink.y - this.height - 4);
-                    }
+                    this.applyConstraintMethod("__constraintBarX_x", d);
+                    
                     var dd = [this.barlink, "y"];
-                    this.applyConstraint("y", ff, dd);
+                    this.applyConstraintMethod("__constraintBarX_y", dd);
+                    
                     if(this.fadein == true){
                         this.fader.doStart();
                     }
                 } else {
-                    var f = function(){   
-                        this.setAttribute("x", (Math.abs(parent.classroot.minimum) * parent.classroot.altscaler) +
-                            this.barlink.width + 4);       
-                    }
                     var d = [this.barlink, "x"];
-                    this.applyConstraint("x", f, d);
-                    var ff = function(){   
-                        this.setAttribute("y", this.barlink.y + ((this.barlink.height - this.height) / 2));
-                    }
+                    this.applyConstraintMethod("__constraintBarY_x", d);
+                    
                     var dd = [this.barlink, "y"];
-                    this.applyConstraint("y", ff, dd);
+                    this.applyConstraintMethod("__constraintBarY_y", dd);
+                    
                     if(this.fadein == true && parent.anicomplete == false){
                         this.fader.doStart();
                     }
                 }
             } else if(this.charttype == "line"){
-                var f = function(){
-                    this.setAttribute("x", parent.classroot.altscaler * this.rvalx +
-                        parent.classroot.altzero);
-                }
                 var d = [parent.classroot, "altscaler"];
-                this.applyConstraint("x", f, d);
-                var ff = function(){
-                    this.setAttribute("y", parent.classroot.dataclip.datapane.height -
-                        (parent.classroot.scaler * this.rvaly) -
-                        (parent.classroot.minimum * parent.classroot.scaler * -1) - this.height - 3);
-                }
+                this.applyConstraintMethod("__constraintLine_x", d);
+                
                 var dd = [parent.classroot, "scaler"];
-                this.applyConstraint("y", ff, dd);
+                this.applyConstraintMethod("__constraintLine_y", dd);
             } else if(this.charttype == "pie"){
                 this.setAttribute('x', this.x - this.width / 2);
                 this.setAttribute('y', this.y - this.height / 2);
             }
             ]]>
         </method>
+        
+        <method name="__constraintBarX_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", this.barlink.x + (this.barlink.width / 2) -
+                (this.width / 2));
+        ]]></method>
+        
+        <method name="__constraintBarX_y" args="ignore" ><![CDATA[
+            this.setAttribute("y", this.barlink.y - this.height - 4);
+        ]]></method>
+        
+        <method name="__constraintBarY_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", (Math.abs(parent.classroot.minimum) * parent.classroot.altscaler) +
+                this.barlink.width + 4);
+        ]]></method>
+        
+        <method name="__constraintBarY_y" args="ignore" ><![CDATA[
+            this.setAttribute("y", this.barlink.y + ((this.barlink.height - this.height) / 2));
+        ]]></method>
+        
+        <method name="__constraintLine_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", parent.classroot.altscaler * this.rvalx +
+                parent.classroot.altzero);
+        ]]></method>
+        
+        <method name="__constraintLine_y" args="ignore" ><![CDATA[
+            this.setAttribute("y", parent.classroot.dataclip.datapane.height -
+                (parent.classroot.scaler * this.rvaly) -
+                (parent.classroot.minimum * parent.classroot.scaler * -1) - this.height - 3);
+        ]]></method>
 
         <method name="renderBorder">
             <![CDATA[
@@ -193,54 +204,31 @@
                 var barlink = parent.classroot.parent.dataclip.datapane['bar'+this.labelset+
                     this.labelnumber];
                 if(this.labelset != null){
-                    var f = function(){   
-                        this.setAttribute("x", barlink.x + (barlink.width / 2) -
-                            (this.width / 2));       
-                    }
                     var d = [barlink, "x"];
-                    this.applyConstraint("x", f, d);
+                    this.applyConstraintMethod("__constraintTickXLabel_x", d);
                     this.setAttribute('y', this.y + this.ticklength + this.loffset);
                 } else {
                     // Really only needed to compensate for this little issue with the
                     // barchart directional switch.
                     if(this.charttype == 'bar'){
-                        var f = function(){   
-                            this.setAttribute("x", ((parent.width / this.numlabels) *
-                                (this.labelnumber)) - (this.width / 2) -
-                                ((parent.classroot.parent.minimum % parent.classroot.parent.hgridspacing) *
-                                parent.classroot.parent.altscaler));
-                        }
+                        var cm = "__constraintTickXNoLabelBar_x";
                     } else {
-                        var f = function(){   
-                            this.setAttribute("x", ((parent.width / this.numlabels) *
-                                (this.labelnumber)) - (this.width / 2) -
-                                ((parent.classroot.parent.altminimum % parent.classroot.parent.vgridspacing) *
-                                parent.classroot.parent.altscaler));
-                        }
+                        var cm = "__constraintTickXNoLabel_x";
                     }
                     var d = [parent, "width"];
-                    this.applyConstraint("x", f, d);
+                    this.applyConstraintMethod(cm, d);
                 }
             } else {
                 var barlink = parent.classroot.parent.dataclip.datapane['bar'+this.labelset+
                     this.labelnumber];
                 if(this.labelset != null){
-                    var f = function(){   
-                        this.setAttribute("y", barlink.y + ((barlink.height - this.height) / 2));       
-                    }
                     var d = [barlink, "y"];
-                    this.applyConstraint("y", f, d);
+                    this.applyConstraintMethod("__constraintTickYLabel_y", d);
                     this.setAttribute('x', this.x - this.width - this.ticklength - this.loffset);
                 } else {
                     this.setAttribute('x', parent.width - this.width - this.ticklength - 4);
-                    var f = function(){
-                        this.setAttribute("y", parent.height - ((parent.height / this.numlabels) *
-                            this.labelnumber) - ((parent.classroot.parent.minimum %
-                            parent.classroot.parent.hgridspacing) * parent.classroot.parent.scaler * -1) -
-                            (this.height / 2));
-                    }
                     var d = [parent, "height"];
-                    this.applyConstraint("y", f, d);
+                    this.applyConstraintMethod("__constraintTickYNoLabel_y", d);
                 }
             }
             if(this.labelangle != null){
@@ -248,6 +236,37 @@
             }
             ]]>
         </method>
+        
+        <method name="__constraintTickXLabel_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", barlink.x + (barlink.width / 2) -
+                (this.width / 2));
+        ]]></method>
+        
+        <method name="__constraintTickXNoLabelBar_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", ((parent.width / this.numlabels) *
+                (this.labelnumber)) - (this.width / 2) -
+                ((parent.classroot.parent.minimum % parent.classroot.parent.hgridspacing) *
+                parent.classroot.parent.altscaler));
+        ]]></method>
+        
+        <method name="__constraintTickXNoLabel_x" args="ignore" ><![CDATA[
+            this.setAttribute("x", ((parent.width / this.numlabels) *
+                (this.labelnumber)) - (this.width / 2) -
+                ((parent.classroot.parent.altminimum % parent.classroot.parent.vgridspacing) *
+                parent.classroot.parent.altscaler));
+        ]]></method>
+        
+        <method name="__constraintTickYLabel_y" args="ignore" ><![CDATA[
+            this.setAttribute("y", barlink.y + ((barlink.height - this.height) / 2));
+        ]]></method>
+        
+        <method name="__constraintTickYNoLabel_y" args="ignore" ><![CDATA[
+            this.setAttribute("y", parent.height - ((parent.height / this.numlabels) *
+                this.labelnumber) - ((parent.classroot.parent.minimum %
+                parent.classroot.parent.hgridspacing) * parent.classroot.parent.scaler * -1) -
+                (this.height / 2));
+        ]]></method>
+        
         <text name="realtext" resize="true" text="${parent.ltext}"
             fontsize="${parent.ltextsize}" x="${(parent.width - this.width) / 2}"
             fgcolor="${parent.ltcolor}" y="${(parent.height - this.height) / 2}">



More information about the Laszlo-checkins mailing list