This is really cool, to see this finally implemented!
Comments:
. I already made a comment in Jira: I don't think we want this for
$style bindings, since CSS values are already typed (you don't need to
coerce them to/from strings). I can see it causing grief down the
road if we allow 'sloppy' CSS values (could prevent optimization of
CSS styling).
. makenew is unused in safeEval
. Do we really need to allow arbitrary expressions in bindings? I
think if you want an object whose value is a Date, say, you should
make the accept/present methods for the Date type parse dates from
strings, using say, ISO format or something, rather than just calling
new with some (unvalidated) argument. I can see this is expedient,
but it seems like a dangerous loophole to open.
. In LzDefs, this comment is wrong:
+ // value
+ this.type = type;
Othewise, approved!
On 2008-07-10, at 01:11 EDT, Max Carlson wrote:
Change 20080709-maxcarlson-p by [EMAIL PROTECTED] on 2008-07-09
21:04:11 PDT
in /Users/maxcarlson/openlaszlo/trunk-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Add automatic coercion of $path and $style constrained
attributes
Bugs Fixed: LPP-2610 - Implement Attribute Type Coercion
Technical Reviewer: ptw
QA Reviewer: promanik
Documentation: Before, $path attributes were always strings.
Details: */LzBrowserKernel.lzs - Delegate callMethod() to
lz.Utils.safeEval().
LzCSSStyle.lzs - Add missing property to prevent runtime warnings in
swf9
LzUtils.lzs - Move LzBrowserKernel.callMethod() implementation to
lz.Utils.safeEval(). Add safeNew() method to allow 'new' at runtime
in swf.
LzNode.lzs - __LZstyleBindAttribute() and dataBindAttribute() now
expect an attribute type from the compiler. Use acceptAttribute()
instead of setAttribute(). Add ignore arg to
__LZresolveReferences() for swf9. updateData() attempts to delegate
to a datapath.
PresentationTypes.lzs - Add presentation type implementations.
Library.lzs - Include PresentationTypes.lzs
LzDefs.lzs - LzStyleAttrBinder expects an attribute type and uses
acceptAttribute() instead of setAttribute().
LzDataAttrBind.lzs - Expects an attributes typei. Use
acceptAttribute() instead of setAttribute() and presentAttribute()
instead of reading properties directly.
NodeModel.java - Add $lzc$ignore arg in getBinderMethod() for all
types of binder methods. Include the method type in for $data and
$style binders.
Tests: Testcase from LPP-2610 runs consistently in swf8 and dhtml.
It runs in swf9, but clicking the button does nothing due
outstanding data binding bugs. http://localhost:8080/trunk-clean/test/lfc/legals/testjscomm/test8.jsp
runs as before. ant lztest, smokecheck.
Files:
M WEB-INF/lps/lfc/kernel/swf/LzBrowserKernel.lzs
M WEB-INF/lps/lfc/kernel/swf9/LzBrowserKernel.lzs
M WEB-INF/lps/lfc/services/LzCSSStyle.lzs
M WEB-INF/lps/lfc/services/LzUtils.lzs
M WEB-INF/lps/lfc/core/LzNode.lzs
A WEB-INF/lps/lfc/core/PresentationTypes.lzs
M WEB-INF/lps/lfc/core/Library.lzs
M WEB-INF/lps/lfc/core/LzDefs.lzs
M WEB-INF/lps/lfc/data/LzDataAttrBind.lzs
M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/20080709-maxcarlson-p.tar