[Laszlo-checkins] r338 - in openlaszlo/trunk: lps/components/lz test/components/lz
perforce@openlaszlo.org
perforce at openlaszlo.org
Thu Apr 27 13:54:19 EDT 2006
Author: perforce
Date: 2006-04-27 13:54:18 -0400 (Thu, 27 Apr 2006)
New Revision: 338
Modified:
openlaszlo/trunk/lps/components/lz/gridtext.lzx
openlaszlo/trunk/test/components/lz/test-grid.lzx
openlaszlo/trunk/test/components/lz/test-grid2.lzx
Log:
Change: 41873
User: jgrandy
Description:
Summary:Add textalign attribute to gridtext, update grid tests
New Features:grid class gridtext has a new attribute: textalign
Bugs Fixed:LPP-1999
Technical Reviewer: jgrandy
QA Reviewer: frisco
Doc Reviewer: jsundman
Details:Contributed by L. Ritossa
Tests:test/components/lz/test-grid.lzx and test-grid2.lzx
Modified: openlaszlo/trunk/lps/components/lz/gridtext.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/gridtext.lzx 2006-04-27 16:45:58 UTC (rev 337)
+++ openlaszlo/trunk/lps/components/lz/gridtext.lzx 2006-04-27 17:54:18 UTC (rev 338)
@@ -7,6 +7,10 @@
is displayed in the rows. -->
<attribute name="datapath"
setter="this.setAttribute( 'rowdp', datapath )"/>
+ <!--- type of content's alignment. Default: left
+ possible values are: left, center, right -->
+ <attribute name="textalign" type="string" value="left"/>
+
<!--- @keywords private -->
<attribute name="rowdp" value="" type="string"/>
<!--- If set to false, the field will not be editable. -->
@@ -17,7 +21,7 @@
<attribute name="_texthilitecolor" value="null"/>
<!--- @keywords private -->
<attribute name="_textselectedcolor" value="null"/>
-
+
<!--- @keywords private -->
<method name="_inferSortpath">
return this.rowdp;
@@ -34,7 +38,8 @@
<view height="24" clickable='${parent.editable}'
onmouseover="immediateparent.domouseover()"
onmouseout="immediateparent.domouseout()"
- y="${immediateparent.height/2 - height/2}">
+ y="${immediateparent.height/2 - height/2}"
+ clip="true" >
<attribute name="editing" value="false"/>
<attribute name="focusable" value="${!editing &&
parent.editable}"/>
@@ -61,8 +66,44 @@
(parent.immediateparent.highlighted ?
classroot._texthilitecolor:
classroot._textcolor)}"
- datapath="$once{parent.parent.rowdp}"/>
+ datapath="$once{parent.parent.rowdp}">
+ <method event="oninit">
+ <![CDATA[
+ var f = function() {
+ this.setAttribute("x", this._calcX());
+ }
+ var d = [this, "width"];
+ this.applyConstraint("x", f, d);
+ ]]>
+ </method>
+
+ <method event="ontext" args="val">
+ <![CDATA[
+ this.setAttribute("x", this._calcX());
+ ]]>
+
+ </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}"
onremove="parent.editbox.datapath.updateData()">
<edittext datapath="$once{parent.parent.rowdp}"
@@ -110,7 +151,7 @@
</class>
</library>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!-- @LZX_VERSION@ -->
Modified: openlaszlo/trunk/test/components/lz/test-grid.lzx
===================================================================
--- openlaszlo/trunk/test/components/lz/test-grid.lzx 2006-04-27 16:45:58 UTC (rev 337)
+++ openlaszlo/trunk/test/components/lz/test-grid.lzx 2006-04-27 17:54:18 UTC (rev 338)
@@ -3,7 +3,7 @@
<include href="lz/grid.lzx"/>
<dataset name="contactsLoad" queuerequests="true"
- src="http://localhost:8080/lps/sample-apps/contacts/contactsdata.xml"
+ src="../../../demos/contacts/contactsdata.xml"
ondata="contactsData.appendChild( this.getFirstChild() );"
type="http" request="true"/>
@@ -32,17 +32,17 @@
<valignedText datapath="@firstname"/>
</gridcolumn>
- <gridtext editable="false" datapath="@lastname">Last
+ <gridtext editable="false" textalign="center" datapath="@lastname">Last
</gridtext>
- <gridtext datapath="@displayname">
+ <gridtext textalign="right" datapath="@displayname">
Fullname
</gridtext>
<gridcolumn resizable="false" sortable="false" width="130">
Default contact
<radiogroup xoffset="-10" text="$path{ '@title'}"
- defaultSelection="0"
+ defaultselection="0"
layout="axis:'x'">
<attribute name="y"
value="$once{ immediateparent.height /2
@@ -156,6 +156,6 @@
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
Modified: openlaszlo/trunk/test/components/lz/test-grid2.lzx
===================================================================
--- openlaszlo/trunk/test/components/lz/test-grid2.lzx 2006-04-27 16:45:58 UTC (rev 337)
+++ openlaszlo/trunk/test/components/lz/test-grid2.lzx 2006-04-27 17:54:18 UTC (rev 338)
@@ -2,7 +2,7 @@
<debug y="300"/>
<dataset name="contactsData"
- src="http://localhost:8080/lps/sample-apps/contacts/contactsdata.xml"
+ src="../../../demos/contacts/contactsdata.xml"
type="http" request="true"/>
<grid id="tgrid" selectable="false" datapath="contactsData:/*[1]"/>
@@ -10,6 +10,6 @@
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
More information about the Laszlo-checkins
mailing list