There are still two issues:
1) you've restricted LzDataAttrBind to LzViews
if (*node is LzView* && this.__LZpchanged || node[ attr ] != data ||
this.parsedPath.operator == "attributes") {
2) what should happen, if there are two (or more) $path-constraints, and
all but one have got data? With your current changeset, the
$path-constraint without data may hide the complete view, even though
the other $path-constraints are valid.
testcase:
<canvas debug="true" layout="axis:y">
<dataset name="testdata">
<bar num="123.5" t="hello" />
</dataset>
<dataset name="otherdata">
<foo />
</dataset>
<class name="mytext" extends="text" text="${'My data: ' +
this.datatext + '(' + this.datatext2 + ')'}" >
<attribute name="datatext" value="" type="string" />
<attribute name="datatext2" value="" type="string" />
</class>
<!-- write in the debugger: -->
<!-- testdata.getFirstChild().removeAttr("num") -->
<mytext datatext="$path{'testdata:/bar/@num'}" bgcolor="red" />
<mytext datatext="$path{'testdata:/bar/@bad'}" bgcolor="red" />
*<mytext datatext="$path{'testdata:/bar/@num'}"
datatext2="$path{'testdata:/bar/@t'}" bgcolor="gray" />
<mytext datatext="$path{'testdata:/bar/@bad'}"
datatext2="$path{'testdata:/bar/@t'}" bgcolor="gray" />*
<mytext datapath="otherdata:/foo"
datatext="$path{'testdata:/bar/@num'}" bgcolor="silver" />
<mytext datapath="otherdata:/foo"
datatext="$path{'testdata:/bar/@bad'}" bgcolor="silver" />
</canvas>
On 7/10/2008 4:37 AM, Max Carlson wrote:
Change 20080709-maxcarlson-b by [EMAIL PROTECTED] on 2008-07-09
19:32:50 PDT
in /Users/maxcarlson/openlaszlo/trunk-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: UPDATED: Fix visibility of views with $path constraints
Bugs Fixed: LPP-290 - $path attributes can hide the instance/view they
belong to
Technical Reviewer: [EMAIL PROTECTED]
QA Reviewer: promanik
Details: LaszloView.lzs - Add __LZvizDatAttr flag for $path
visibility. __LZupdateShown() sets data visibility if __LZvizDat or
__LZvizDatAttr are true to make sure datapath visibility takes
precedence.
LzDataAttrBind.lzs - Set LzView.__LZvizDatAttr and call
__LZupdateShown() for views with $path attributes.
Tests: Updated testcase from LPP-290 should show one red and two gray
text fields
Files:
M WEB-INF/lps/lfc/views/LaszloView.lzs
M WEB-INF/lps/lfc/data/LzDataAttrBind.lzs
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/20080709-maxcarlson-b.tar