Author: hqm
Date: 2008-03-20 12:38:43 -0700 (Thu, 20 Mar 2008)
New Revision: 8333
Modified:
openlaszlo/trunk/lps/components/lz/gridtext.lzx
Log:
Change 20080320-hqm-v by [EMAIL PROTECTED] on 2008-03-20 13:00:00 EDT
in /Users/hqm/openlaszlo/trunk4
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: replace applyConstraint in gridtext.lzx
New Features:
Bugs Fixed:
Technical Reviewer: andre,ptw
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
applyConstraint is deprecated, this replaces the usage with an equivalent
method in an event handler on 'onwidth'
Tests:
grid example (broken currently due to something else with states, this just
gets rid of warning
from applyConstraint)
Modified: openlaszlo/trunk/lps/components/lz/gridtext.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/gridtext.lzx 2008-03-20 17:30:58 UTC
(rev 8332)
+++ openlaszlo/trunk/lps/components/lz/gridtext.lzx 2008-03-20 19:38:43 UTC
(rev 8333)
@@ -7,7 +7,7 @@
is displayed in the rows. -->
<attribute name="datapath"
setter="this.setAttribute( 'rowdp', datapath )"/>
- <!--- type of content's alignment. Default: left
+ <!--- type of content''s alignment. Default: left
possible values are: left, center, right -->
<attribute name="textalign" type="string" value="left"/>
<!--- Whether one is able to select the text. (Only applies
@@ -76,38 +76,26 @@
<handler name="oninit">
<![CDATA[
this.setAttribute('selectable', classroot.selectable);
- var f = function() {
- this.setAttribute("x", this._calcX());
- }
- var d = [this, "width"];
- this.applyConstraint("x", f, d);
]]>
</handler>
- <handler name="ontext" args="val">
- <![CDATA[
- this.setAttribute("x", this._calcX());
- ]]>
+ <handler name="ontext" method="_setCalcX" />
+ <handler name="onwidth" method="_setCalcX" />
- </handler>
+ <method name="_setCalcX"><![CDATA[
+ if (classroot.textalign == "center") {
+ var x = ((this.width /2) - (this.getTextWidth()
/2));
+ if (x < 0) x = 0;
+ this.setAttribute("x", x);
+ } else if (classroot.textalign == "right") {
+ var x = ((this.width) - (this.getTextWidth() +
10));
+ if (x < 0) x = 0;
+ this.setAttribute("x", x);
+ } else {
+ this.setAttribute("x", 0);
+ }
+ ]]></method>
- <method name="_calcX">
- <![CDATA[
- if (classroot.textalign == "center"){
- var x = ((this.width /2) - (this.getTextWidth() /2));
- if (x < 0) x = 0;
- return x;
- }
- else if (classroot.textalign == "right"){
- var x = ((this.width) - (this.getTextWidth() + 10));
- if (x < 0) x = 0;
- return x;
- }
- else{
- return 0;
- }
- ]]>
- </method>
</text>
<state pooling="true" apply="${parent.editing}"
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins