[Laszlo-checkins] r7769 - in openlaszlo/branches/devildog: . WEB-INF/lps/lfc/compiler WEB-INF/lps/lfc/debugger WEB-INF/lps/lfc/kernel/dhtml WEB-INF/lps/server/sc/src/org/openlaszlo/sc WEB-INF/lps/server/src/org/openlaszlo/sc docs/includes docs/src/developers laszlo-explorer/coverpages test/lztest
dda@openlaszlo.org
dda at openlaszlo.org
Tue Jan 8 12:09:13 PST 2008
Author: dda
Date: 2008-01-08 12:09:01 -0800 (Tue, 08 Jan 2008)
New Revision: 7769
Added:
openlaszlo/branches/devildog/docs/src/developers/dataprovider.dbk
openlaszlo/branches/devildog/docs/src/developers/datareplication.dbk
Modified:
openlaszlo/branches/devildog/
openlaszlo/branches/devildog/WEB-INF/lps/lfc/compiler/Class.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/debugger/LzMemory.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
openlaszlo/branches/devildog/WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ASTVisitor.java
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
openlaszlo/branches/devildog/docs/includes/docbook.css
openlaszlo/branches/devildog/docs/src/developers/databinding.dbk
openlaszlo/branches/devildog/docs/src/developers/doc-toolchain.dbk
openlaszlo/branches/devildog/docs/src/developers/index.dbk
openlaszlo/branches/devildog/laszlo-explorer/coverpages/components_cover.html
openlaszlo/branches/devildog/laszlo-explorer/coverpages/getting_started.html
openlaszlo/branches/devildog/laszlo-explorer/coverpages/small_applications_cover.html
openlaszlo/branches/devildog/test/lztest/lztest-class-impl.lzx
Log:
Merged revisions 7719-7768 via svnmerge from
http://svn.openlaszlo.org/openlaszlo/trunk
.......
r7721 | max | 2008-01-03 21:32:28 -0500 (Thu, 03 Jan 2008) | 24 lines
Change 20080103-maxcarlson-c by maxcarlson at Roboto.lan on 2008-01-03 00:14:38 PST
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix issue with 'div' and 'span' clobbering text size caches
New Features:
Bugs Fixed: LPP-5220 - "span" and "div" (as text) break text-size cache
Technical Reviewer: a.bargull at intensis.de
QA Reviewer: promanik
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: Clear contents of lzTextSizeCache div when cache size overflows. Store measuring div/span as 'lzdiv~~~' + span/div instead of 'span/div'
Tests: See LPP-5220.
.......
r7722 | max | 2008-01-03 21:35:13 -0500 (Thu, 03 Jan 2008) | 27 lines
Change 20080101-maxcarlson-f by maxcarlson at Roboto.lan on 2008-01-01 23:31:02 PST
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: UPDATED: Fix resizing in Safari
New Features:
Bugs Fixed: LPP-5309 - Window Resize with Safari
Technical Reviewer: ptw
QA Reviewer: promanik
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: LzSprite.js - Add document_size_use_offsetheight and set to true in
Safari and Opera.
LzScreenKernel.js - Use offsetWidth/Height if document_size_use_offsetheight is
true. Clean up tests to use sc.
Tests: See LPP-5309. Tested in Firefox, Opera and Safari 3 on OS X and Safari, IE 6 and 7 in windoze.
.......
r7725 | lou | 2008-01-04 06:14:08 -0500 (Fri, 04 Jan 2008) | 15 lines
Change 20080104-lou-M by lou at loumac.local on 2008-01-04 07:03:39 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: fix text errors in Laszlo Explorer
Bugs Fixed: LPP-5081, LPP-5071, LPP-5082, LPP-5075
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Tests: verify visually
.......
r7731 | ptw | 2008-01-04 16:20:18 -0500 (Fri, 04 Jan 2008) | 23 lines
Change 20080104-ptw-o by ptw at dueling-banjos.local on 2008-01-04 15:21:02 EST
in /Users/ptw/OpenLaszlo/ringding-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Make lztest work again
Bugs Fixed:
LPP-5317 'DHTML error w/ safari_avoid_clip_position_input_text when running in Rhino'
Technical Reviewer: max (pending)
QA Reviewer: rcyeager at bellsouth.net (pending)
Details:
LzSprite: Jumbled indentation appears to have caused Max to include his code
in the wrong scope which caused the 'undefined' error.
lztest-class-impl: This was failing in the face of the recent
change to use JS2 class syntax, so I brought it up to date.
Tests:
ant runlztest
.......
r7732 | lou | 2008-01-04 16:37:28 -0500 (Fri, 04 Jan 2008) | 27 lines
Change 20080104-lou-E by lou at loumac.local on 2008-01-04 14:36:06 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: add explicit data replication to the dguide
New Features:
Technical Reviewer: tucker
QA Reviewer: (pending)
Doc Reviewer: (pending)
Details:
Create a new Data Replication chapter.
http://localhost:8080/trunk/docs/developers/datareplication.html
Split out existing data replication doc from Data Access and Binding
chapter, and add it to new chapter.
Add explicit replication to the new chapter.
Documentation for explicit replication comes from the wiki: http://wiki.openlaszlo.org/Explicit_Replication
This documentation was basically cut and pasted, with some reorganization,
and added intro material, from the wiki.
.......
r7733 | ptw | 2008-01-04 18:53:13 -0500 (Fri, 04 Jan 2008) | 18 lines
Change 20080104-ptw-0 by ptw at dueling-banjos.local on 2008-01-04 18:50:26 EST
in /Users/ptw/OpenLaszlo/ringding-2
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Remove stray debug code left in LzMemory
Bugs Fixed:
LPP-5325 'MemoryTracer: changeset 7573 contains some of Tucker's Debug-code'
Technical Reviewer: a.bargull at intensis.de (pending)
Details:
Corrected as suggested by Andre
Tests:
Inspection
.......
r7745 | lou | 2008-01-06 11:56:22 -0500 (Sun, 06 Jan 2008) | 23 lines
Change 20080106-lou-G by lou at loumac.local on 2008-01-06 12:50:41 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: document how the copyright notice gets included in the dguide and reference
Bugs Fixed: LPP-5329
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Details: added description to the doc toolchain chapter of the dguide.
5.1. How the copyright gets generated
There is a copyright notice at the bottom of every dguide and reference page. This notice is generated during the docbook transform by the template user.footer.content in the file common-html.xsl. To change to copyright date for all generated documents, change the date in this template.
The copyright notice for files that are not generated is entered manually.
Tests:
.......
r7755 | lou | 2008-01-07 09:36:21 -0500 (Mon, 07 Jan 2008) | 24 lines
Change 20080107-lou-2 by lou at loumac.local on 2008-01-07 10:25:26 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: glyphs for some warnings were not rendered properly
Bugs Fixed: LPP-5289
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Details: added new selector for sidebars
div.condition-sidebar{
padding-left : 90px;
padding-top : 20px;
padding-right : 10px;
}
Tests: verify visually
.......
r7763 | ptw | 2008-01-08 09:07:37 -0500 (Tue, 08 Jan 2008) | 34 lines
Change 20080107-ptw-n by ptw at dueling-banjos.local on 2008-01-07 15:41:52 EST
in /Users/ptw/OpenLaszlo/ringding-2
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Implement `is` operator
Bugs Fixed:
LPP-3632 'Implement `is` operator'
Technical Reviewer: dda at ddanderson.com (pending)
QA Reviewer: henry.minsky at gmail.com (pending)
Doc Reviewer: lou at louiorio.com (pending)
Documentation:
We now implement the ECMAScript 4 `is` operator
Details:
lztest-class-impl: Use modern syntax, verify that `is` is
equivalent to `instanceof` and works properly for mixins.
Class: add runtime support for `is` operator on mixins
JavascriptGenerator, CodeGenerator, ParseTreePrinter, Parser: Add
support for `is` operator, which in JS1 runtimes is approximated
as: a is b => b['$lzsc$isa'] ? b.$lzsc$isa(a) : (a instanceof b),
relying on the runtime support in Class for $lzsc$isa.
ASTVisitor: remove the unused visitBinaryExpression
Tests:
Amended class-impl test to test that `is` is equivalent to
`instanceof` for classes and works properly for mixins.
.......
r7765 | lou | 2008-01-08 10:01:33 -0500 (Tue, 08 Jan 2008) | 18 lines
Change 20080108-lou-6 by lou at loumac.local on 2008-01-08 10:53:22 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: add data provider chapter to the dguide
Bugs Fixed: LPP-5339
Technical Reviewer: Henry Minsky
QA Reviewer: (pending)
Doc Reviewer: (pending)
Details: This is a simple cut and paste from the wiki at http://wiki.openlaszlo.org/Dataprovider
Tests:
.......
r7768 | ptw | 2008-01-08 14:41:34 -0500 (Tue, 08 Jan 2008) | 31 lines
Change 20080108-ptw-a by ptw at dueling-banjos.local on 2008-01-08 11:56:44 EST
in /Users/ptw/OpenLaszlo/ringding-2
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: add support for `cast` keyword in javascript
Bugs Fixed:
LPP-5336 'add support for `cast` keyword in javascript'
Technical Reviewer: dda at ddanderson.com (Message-Id: <AC18608E-42E5-4600-A8F0-89FDE03FCA17 at ddanderson.com>)
QA Reviewer: henry.minsky at gmail.com (pending)
Doc Reviewer: lou at louiorio.com (pending)
Documentation:
We now support the JS2 `cast` operator: <value> cast <type
expression>. In JS1 runtimes this is a no-op. In JS2 runtimes it
will be passed through and ensures that the value is of the correct
static type.
Details:
lztest-class-impl: Add tests suggested by Don for more complex
`is` expressions. Add tests for `cast` expressions
JavascriptGenerator, CodeGenerator, Parser, ParseTreePrinter: add
support for `cast` as a no-op (just returns the value or lhs).
Put back code that deals with null source files for now.
Tests:
lztest-class-impl
.......
Property changes on: openlaszlo/branches/devildog
___________________________________________________________________
Name: svnmerge-integrated
- /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497 /openlaszlo/trunk:1-7718
+ /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497 /openlaszlo/trunk:1-7768
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/compiler/Class.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/compiler/Class.lzs 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/compiler/Class.lzs 2008-01-08 20:09:01 UTC (rev 7769)
@@ -472,6 +472,16 @@
impls[mash] = t;
return t;
},
+ // Implements `is` operator for traits
+ $lzsc$isa: function $lzsc$isa (obj) {
+ var impls = this.implementations;
+ for (var mash in impls) {
+ if (obj instanceof impls[mash].constructor) {
+ return true;
+ }
+ return false;
+ }
+ },
// How to make a Trait
make: function make (classname, superTrait, instanceProperties, staticProperties) {
var nt = {
@@ -487,6 +497,7 @@
this.addStaticProperty.call(nt, 'addStaticProperty', this.addStaticProperty);
nt.addStaticProperty('addProperty', this.addProperty);
nt.addStaticProperty('makeInterstitial', this.makeInterstitial);
+ nt.addStaticProperty('$lzsc$isa', this.$lzsc$isa);
// Install the staticProperties
if (staticProperties) {
for (var i = staticProperties.length - 1; i >= 1; i -= 2) {
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/debugger/LzMemory.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/debugger/LzMemory.lzs 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/debugger/LzMemory.lzs 2008-01-08 20:09:01 UTC (rev 7769)
@@ -208,11 +208,6 @@
var wasMarked = this.isMarked(o);
var wasLeaked = (wasMarked === null);
- if (o == global.NamedNodeMap.prototype) {
- Debug.debug("wasMarked: %s, wasLeaked: %s", wasMarked, wasLeaked);
- Debug.inspect(o);
- }
-
// Make sure we didn't already get here via another path
if (wasMarked) {
continue;
@@ -255,7 +250,6 @@
this.leaks.push(o);
}
- // Annotate why this object is alive
// Mark the object
if (! this.mark(o)) {
// Don't trace into objects we can't mark
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzScreenKernel.js 2008-01-08 20:09:01 UTC (rev 7769)
@@ -1,7 +1,7 @@
/**
* LzScreenKernel.js
*
- * @copyright Copyright 2007 Laszlo Systems, Inc. All Rights Reserved.
+ * @copyright Copyright 2007-2008 Laszlo Systems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
* @topic Kernel
@@ -16,21 +16,25 @@
,__resizeEvent: function() {
// thanks quirksmode! http://www.quirksmode.org/viewport/compatibility.html
- if (window.top.innerHeight) {
+ var sc = window.top.document.body;
+ if (LzSprite.prototype.quirks.document_size_use_offsetheight) {
+ sc = window.document.body;
+ LzScreenKernel.width = sc.offsetWidth;
+ LzScreenKernel.height = sc.offsetHeight;
+ } else if (window.top.innerHeight) {
// all except Explorer
- var sc = window.top.document.body;
- LzScreenKernel.width = sc.scrollWidth;
- LzScreenKernel.height = sc.scrollHeight;
+ sc = window;
+ LzScreenKernel.width = sc.innerWidth;
+ LzScreenKernel.height = sc.innerHeight;
} else if (window.top.document.documentElement && window.top.document.documentElement.clientHeight) {
// Explorer 6 Strict Mode
- var sc = window.top.document.documentElement;
+ sc = window.top.document.documentElement;
LzScreenKernel.width = sc.clientWidth;
LzScreenKernel.height = sc.clientHeight;
- } else if (window.top.document.body) {
+ } else if (sc) {
// other Explorers
- var sc = window.top.document.body;
- LzScreenKernel.width = window.top.document.body.clientWidth;
- LzScreenKernel.height = window.top.document.body.clientHeight;
+ LzScreenKernel.width = sc.clientWidth;
+ LzScreenKernel.height = sc.clientHeight;
}
/*
@@ -51,7 +55,7 @@
//Debug.write('LzScreenKernel event', {width: LzScreenKernel.width, height: LzScreenKernel.height});
}
,__init: function() {
- Lz.attachEventHandler(window, 'resize', LzScreenKernel, '__resizeEvent');
+ Lz.attachEventHandler(window.top, 'resize', LzScreenKernel, '__resizeEvent');
}
,__callback: null
,__scope: null
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2008-01-08 20:09:01 UTC (rev 7769)
@@ -1,3 +1,5 @@
+/* -*- mode: JavaScript; c-basic-offset: 4; -*- */
+
/**
* LzSprite.js
*
@@ -226,6 +228,7 @@
,ie_opacity: false
,text_measurement_use_insertadjacenthtml: false
,text_selection_use_range: false
+ ,document_size_use_offsetheight: false
}
LzSprite.prototype.capabilities = {
@@ -241,7 +244,7 @@
,advancedfonts: false
}
-LzSprite.prototype.__updateQuirks = function(){
+LzSprite.prototype.__updateQuirks = function () {
if (window['Lz'] && Lz.__BrowserDetect) {
Lz.__BrowserDetect.init();
var quirks = this.quirks;
@@ -306,6 +309,7 @@
quirks['safari_visibility_instead_of_display'] = true;
quirks['absolute_position_accounts_for_offset'] = true;
quirks['canvas_div_cannot_be_clipped'] = true;
+ quirks['document_size_use_offsetheight'] = true;
if (Lz.__BrowserDetect.version > 523.10) {
this.capabilities['rotation'] = true;
}
@@ -315,32 +319,34 @@
quirks['no_cursor_colresize'] = true;
quirks['absolute_position_accounts_for_offset'] = true;
quirks['canvas_div_cannot_be_clipped'] = true;
+ quirks['document_size_use_offsetheight'] = true;
} else if (Lz.__BrowserDetect.isFirefox && Lz.__BrowserDetect.version < 2) {
- // see http://groups.google.ca/group/netscape.public.mozilla.dom/browse_thread/thread/821271ca11a1bdbf/46c87b49c026246f?lnk=st&q=+focus+nsIAutoCompletePopup+selectedIndex&rnum=1
- quirks['firefox_autocomplete_bug'] = true;
- }
+ // see http://groups.google.ca/group/netscape.public.mozilla.dom/browse_thread/thread/821271ca11a1bdbf/46c87b49c026246f?lnk=st&q=+focus+nsIAutoCompletePopup+selectedIndex&rnum=1
+ quirks['firefox_autocomplete_bug'] = true;
}
- if (quirks['safari_avoid_clip_position_input_text']) {
- LzSprite.prototype.__defaultStyles.lzswfinputtext.marginTop = '-2px';
- LzSprite.prototype.__defaultStyles.lzswfinputtext.marginLeft = '-2px';
- LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginTop = '-2px';
- LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginLeft = '-2px';
- }
+ if (quirks['safari_avoid_clip_position_input_text']) {
+ LzSprite.prototype.__defaultStyles.lzswfinputtext.marginTop = '-2px';
+ LzSprite.prototype.__defaultStyles.lzswfinputtext.marginLeft = '-2px';
+ LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginTop = '-2px';
+ LzSprite.prototype.__defaultStyles.lzswfinputtextmultiline.marginLeft = '-2px';
+ }
- if (quirks['css_hide_canvas_during_init']) {
- if (quirks['safari_visibility_instead_of_display']) {
- LzSprite.prototype.__defaultStyles.lzcanvasdiv.visibility = 'hidden';
- } else {
- LzSprite.prototype.__defaultStyles.lzcanvasdiv.display = 'none';
+ if (quirks['css_hide_canvas_during_init']) {
+ if (quirks['safari_visibility_instead_of_display']) {
+ LzSprite.prototype.__defaultStyles.lzcanvasdiv.visibility = 'hidden';
+ } else {
+ LzSprite.prototype.__defaultStyles.lzcanvasdiv.display = 'none';
+ }
+ LzSprite.prototype.__defaultStyles.lzcanvasclickdiv.display = 'none';
}
- LzSprite.prototype.__defaultStyles.lzcanvasclickdiv.display = 'none';
+
+ if (quirks['hand_pointer_for_clickable']) {
+ LzSprite.prototype.__defaultStyles.lzclickdiv.cursor = 'pointer';
+ }
}
+};
- if (quirks['hand_pointer_for_clickable']) {
- LzSprite.prototype.__defaultStyles.lzclickdiv.cursor = 'pointer';
- }
-}
LzSprite.prototype.__updateQuirks();
LzSprite.prototype.__defaultStyles.writeCSS();
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js 2008-01-08 20:09:01 UTC (rev 7769)
@@ -267,15 +267,18 @@
this._styledirty = false;
}
+ var root = document.getElementById('lzTextSizeCache');
+
// Empty the cache when full, but do not reset the counter because
// IE holds onto the object.
if (this._sizecache.counter > 0 && this._sizecache.counter % this.__sizecacheupperbound == 0) {
this._sizecache = {counter: this._sizecache.counter};
+ if (root) {
+ root.innerHTML = '';
+ }
}
if (this._sizecache[style] == null) this._sizecache[style] = {};
- var root = document.getElementById('lzTextSizeCache');
-
if (! root) {
root = document.createElement('div');
Lz.__setAttr(root, 'id', 'lzTextSizeCache');
@@ -292,7 +295,7 @@
string = string.replace(this.inner_html_strips_newlines_re, '<br />');
}
var tagname = 'span';
- var mdiv = _textsizecache[tagname];
+ var mdiv = _textsizecache['lzdiv~~~' + tagname];
if (mdiv == null) {
var html = '<' + tagname + ' id="testSpan' + this._sizecache.counter + '"';
html += ' style="' + style + '">';
@@ -301,7 +304,7 @@
root.insertAdjacentHTML('beforeEnd', html);
mdiv = document.all['testSpan' + this._sizecache.counter];
- _textsizecache[tagname] = mdiv;
+ _textsizecache['lzdiv~~~' + tagname] = mdiv;
}
} else {
if (this.__LzInputDiv == null) {
@@ -310,16 +313,16 @@
}
}
var tagname = this.multiline ? 'div' : 'span';
- var mdiv = _textsizecache[tagname];
+ var mdiv = _textsizecache['lzdiv~~~' + tagname];
if (mdiv == null) {
mdiv = document.createElement(tagname);
Lz.__setAttr(mdiv, 'style', style);
root.appendChild(mdiv);
- _textsizecache[tagname] = mdiv;
+ _textsizecache['lzdiv~~~' + tagname] = mdiv;
}
}
if (this.quirks.ie_leak_prevention) {
- LzTextSprite.prototype._sizedomcache[tagname + style] = mdiv;
+ LzTextSprite.prototype._sizedomcache['lzdiv~~~' + tagname + style] = mdiv;
}
mdiv.innerHTML = string;
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt 2008-01-08 20:09:01 UTC (rev 7769)
@@ -205,7 +205,6 @@
| < FINAL: "final" >
| < IMPLEMENTS: "implements" >
| < IMPORT: "import" >
-| < INHERITS: "inherits" >
| < INTERFACE: "interface" >
| < INTERNAL: "internal" >
| < OVERRIDE: "override" >
@@ -214,9 +213,17 @@
| < PUBLIC: "public" >
| < STATIC: "static" >
| < SUPER: "super" >
+
+// JS2
+| < IS: "is" >
+| < CAST: "cast" >
+
+// Our extensions
+| < INHERITS: "inherits" > // obsolete
+| < MIXIN: "mixin" > // obsolete
| < TRAIT: "trait" >
-| < MIXIN: "mixin" >
+
// These are not supposed to be keywords
| < TRUE: "true" >
| < FALSE: "false" >
@@ -405,6 +412,8 @@
| t=<STATIC>
| t=<OVERRIDE>
| t=<DYNAMIC>
+ | t=<IS>
+ | t=<CAST>
)
{return t;}
}
@@ -579,7 +588,7 @@
void RelOp() #Operator : {Token t;}
{
- ("<" | ">" | "<=" | ">=" | "instanceof" | LOOKAHEAD({getAllowIn()}) "in")
+ ("<" | ">" | "<=" | ">=" | "instanceof" | "is" | "cast" | LOOKAHEAD({getAllowIn()}) "in")
{jjtThis.setOperator(getToken(0).kind);}
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ASTVisitor.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ASTVisitor.java 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ASTVisitor.java 2008-01-08 20:09:01 UTC (rev 7769)
@@ -33,7 +33,6 @@
SimpleNode visitArrayLiteral(SimpleNode node, boolean isReferenced, SimpleNode[] children);
SimpleNode visitAssignmentExpression(SimpleNode node, boolean isReferenced, SimpleNode[] children);
- SimpleNode visitBinaryExpression(SimpleNode node, boolean isReferenced, SimpleNode[] children);
SimpleNode visitBinaryExpressionSequence(SimpleNode node, boolean isReferenced, SimpleNode[] children);
SimpleNode visitCallExpression(SimpleNode node, boolean isReferenced, SimpleNode[] children);
SimpleNode visitConditionalExpression(SimpleNode node, boolean isReferenced, SimpleNode[] children);
@@ -75,7 +74,7 @@
}
/**
- * @copyright Copyright 2006-2007 Laszlo Systems, Inc. All Rights
+ * @copyright Copyright 2006-2008 Laszlo Systems, Inc. All Rights
* Reserved. Use is subject to license terms.
*/
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java 2008-01-08 20:09:01 UTC (rev 7769)
@@ -1611,19 +1611,38 @@
return translateBinaryExpression(node, isReferenced, (ASTOperator)op, a, b);
}
- public SimpleNode visitBinaryExpression(SimpleNode node, boolean isReferenced, SimpleNode[] children) {
- SimpleNode op = children[0];
- SimpleNode a = children[1];
- SimpleNode b = children[2];
- return translateBinaryExpression(node, isReferenced, (ASTOperator)op, a, b);
- }
-
SimpleNode translateBinaryExpression(SimpleNode node, boolean isReferenced, ASTOperator op, SimpleNode a, SimpleNode b) {
+ if (ParserConstants.CAST == ((ASTOperator)op).getOperator()) {
+ // Approximate a cast b as a
+ // TODO: [2008-01-08 ptw] We could typecheck and throw an error
+ // in debug mode
+ visitExpression(a);
+ return node;
+ }
visitExpression(a);
visitExpression(b);
- Instruction[] instrs = (Instruction[])BinopInstrs.get(op.getOperator());
- for (int i = 0, len = instrs.length; i < len; i++) {
- collector.emit(instrs[i]);
+ if (ParserConstants.IS == ((ASTOperator)op).getOperator()) {
+ // Approximate a is b as b['$lzsc$isa'] ? b.$lzsc$isa(a) : (a
+ // instanceof b)
+ ArrayList code = new ArrayList();
+ code.add(Instructions.DUP); // a b b
+ code.add(Instructions.PUSH.make("$lzsc$isa"));
+ code.add(Instructions.GetMember); // a b b.$lzsc$isa
+ code.add(Instructions.BranchIfTrue.make(1)); // a b
+ code.add(Instructions.InstanceOf); // (a instanceof b)
+ code.add(Instructions.BRANCH.make(2));
+ code.add(new Integer(1)); // a b
+ code.add(Instructions.PUSH.make(1)); // a b 1
+ code.add(Instructions.SWAP); // a 1 b
+ code.add(Instructions.PUSH.make("$lzsc$isa")); // a 1 b '$lzsc$isa'
+ code.add(Instructions.CallMethod); // b.$lzsc$isa(a)
+ code.add(new Integer(2));
+ translateControlStructure(node, code.toArray());
+ } else {
+ Instruction[] instrs = (Instruction[])BinopInstrs.get(op.getOperator());
+ for (int i = 0, len = instrs.length; i < len; i++) {
+ collector.emit(instrs[i]);
+ }
}
return node;
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java 2008-01-08 20:09:01 UTC (rev 7769)
@@ -999,20 +999,37 @@
SimpleNode a = children[0];
SimpleNode op = children[1];
SimpleNode b = children[2];
+ if (ParserConstants.CAST == ((ASTOperator)op).getOperator()) {
+ // Approximate a cast b as a
+ // TODO: [2008-01-08 ptw] We could typecheck and throw an error
+ // in debug mode
+ return visitExpression(a);
+ }
+ if (ParserConstants.IS == ((ASTOperator)op).getOperator()) {
+ // Approximate a is b as b['$lzsc$isa'] ? b.$lzsc$isa(a) : (a
+ // instanceof b)
+ Map map = new HashMap();
+ map.put("_1", a);
+ map.put("_2", b);
+ String pattern;
+ if ((a instanceof ASTIdentifier ||
+ a instanceof ASTPropertyValueReference ||
+ a instanceof ASTPropertyIdentifierReference) &&
+ (b instanceof ASTIdentifier ||
+ b instanceof ASTPropertyValueReference ||
+ b instanceof ASTPropertyIdentifierReference)) {
+ pattern = "(_2['$lzsc$isa'] ? _2.$lzsc$isa(_1) : (_1 instanceof _2))";
+ } else {
+ pattern = "((function (a, b) {return b['$lzsc$isa'] ? b.$lzsc$isa(a) : (a instanceof b)})(_1, _2))";
+ }
+ SimpleNode n = (new Compiler.Parser()).substitute(pattern, map);
+ return visitExpression(n);
+ }
children[0] = visitExpression(a);
children[2] = visitExpression(b);
return node;
}
- public SimpleNode visitBinaryExpression(SimpleNode node, boolean isReferenced, SimpleNode[] children) {
- SimpleNode op = children[0];
- SimpleNode a = children[1];
- SimpleNode b = children[2];
- children[1] = visitExpression(a);
- children[2] = visitExpression(b);
- return node;
- }
-
SimpleNode translateAndOrExpression(SimpleNode node, boolean isand, SimpleNode a, SimpleNode b) {
SimpleNode[] children = node.getChildren();
children[0] = visitExpression(a);
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java 2008-01-08 20:09:01 UTC (rev 7769)
@@ -546,8 +546,8 @@
{"+", "-"},
{"<<", ">>", ">>>"},
// TODO: [2007-12-13 dda] "in" moved below to compensate for SWF9 3rd party compiler precedence bug.
- //{"<", "<=", ">", ">=", "instanceof", "in"},
- {"<", "<=", ">", ">=", "instanceof"},
+ //{"<", "<=", ">", ">=", "instanceof", "in", "is", "cast"},
+ {"<", "<=", ">", ">=", "instanceof", "is", "cast"},
{"==", "!=", "===", "!=="},
{"&"}, {"^"}, {"|"}, {"&&"}, {"||"}, {"?", ":"},
{"in", "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|="},
Modified: openlaszlo/branches/devildog/docs/includes/docbook.css
===================================================================
--- openlaszlo/branches/devildog/docs/includes/docbook.css 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/docs/includes/docbook.css 2008-01-08 20:09:01 UTC (rev 7769)
@@ -16,7 +16,11 @@
padding-left : 10px;
padding-right : 10px;
}
-
+div.condition-sidebar{
+ padding-left : 90px;
+ padding-top : 20px;
+ padding-right : 10px;
+}
.toc .section {
font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size : 12px;
Modified: openlaszlo/branches/devildog/docs/src/developers/databinding.dbk
===================================================================
--- openlaszlo/branches/devildog/docs/src/developers/databinding.dbk 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/docs/src/developers/databinding.dbk 2008-01-08 20:09:01 UTC (rev 7769)
@@ -1,6 +1,7 @@
<chapter id="databinding">
<title>Data Access and Binding</title>
+<!-- the section on data replication has been moved to its own chapter. IORIO 20 jan 2008 -->
<!-- remove commented out sample code that was ignored by the build. IORIO 20 nov 2007 -->
<!-- change link for data-tutorial per LPP-4923, IORIO 17 oct 2007 -->
<para>This chapter describes various methods of tying XML data structures into your LZX application. See
@@ -719,243 +720,4 @@
</example>
-<para/></section></section><section id="databinding.replication"><title>Data replication</title>
-
-<para>As shown in some of the examples above, datapaths that match
-multiple nodes cause their nodes to be <indexterm significance="preferred"><primary>replicated</primary></indexterm><glossterm>replicated</glossterm>. By
-"replicated", we mean that for each match of the XPath expression one
-instance of the mapped view is created. This is one of the most
-important features of the databinding facilities in LZX.</para>
-
-<para/><section><title>Replication Manager</title>
-
-<para>A <indexterm significance="preferred"><primary>replication manager</primary></indexterm><glossterm>replication manager</glossterm> is a runtime object that is
-created automatically whenever data replication occurs as a result of
-a datapath matching more than once. When that happens, the
-<indexterm><primary>name</primary></indexterm><sgmltag class="attribute">name</sgmltag> or <indexterm><primary>id</primary></indexterm><sgmltag class="attribute">id</sgmltag> attribute of
-the replicated view (if the view is named) is taken over by the
-replication manager, and from then on referring to that name will
-access the replication manager object, and not the view. In order to
-reference the replicated views, known as <indexterm significance="preferred"><primary>clones</primary></indexterm><glossterm>clones</glossterm>, you should
-use the <indexterm><primary>LzReplicationManager</primary></indexterm><classname>LzReplicationManager</classname> API.</para>
-
-<para/><section><title>The <indexterm><primary>replication</primary></indexterm><sgmltag class="attribute">replication</sgmltag> attribute</title>
-
-<para>If a datapath matches multiple nodes, it will create a replication
-manager. If <indexterm><primary>replication</primary></indexterm><sgmltag class="attribute">replication</sgmltag> is <literal>normal</literal>
-(the default), then the replication manager will be a direct instance
-of <indexterm><primary>LzReplicationManager</primary></indexterm><classname>LzReplicationManager</classname>. If it is
-<literal>lazy</literal>, it will instead create a
-<indexterm><primary>LzLazyReplicationManager</primary></indexterm><classname>LzLazyReplicationManager</classname>.</para>
-
-<para/></section><section><title>Clones and the <indexterm><primary>onclones event</primary></indexterm><literal>onclones</literal> event</title>
-
-<para>As mentioned above, when a view is replicated, its copies are
-managed by the replication manager object. Once clones are created,
-the instance of the replication manager contains references to them in
-the <indexterm><primary>clones</primary></indexterm><sgmltag class="attribute">clones</sgmltag> property, which is an array of
-views. Note that <indexterm><primary>LzReplicationManager</primary></indexterm><classname>LzReplicationManager</classname> extends
-<indexterm><primary>LzDatapath</primary></indexterm><classname>LzDatapath</classname>, and a cloned view along with its
-datapath is replaced with the replication manager object. Armed with
-this knowledge, we have a technique for determining when a view is
-cloned. The example below demonstrates the use of the clones property
-by declaring a handler for the <indexterm><primary>onclones event</primary></indexterm><literal>onclones</literal> event on the
-view's datapath.</para>
-<example role="live-example">
- <title>Using clones and the onclones event</title>
- <programlisting language="lzx">
- <textobject><textdata fileref="programs/databinding-$25.lzx"/></textobject>
- </programlisting>
-</example>
-
-<para>Because the <indexterm><primary>onclones event</primary></indexterm><literal>onclones</literal> event is sent when the
-<indexterm><primary>clones</primary></indexterm><sgmltag class="attribute">clones</sgmltag> attribute is set, it only signals the
-start of view replication, but in this example it is used to determine
-the exact moment when replication is finished. Since replicated views
-are initialized in the same order they are in inserted in the clones
-array, we only need to wait for the oninit event for the last clone in
-the list. This is necessary because initialization of the
-<indexterm><primary>tab</primary></indexterm><classname>tab</classname> elements takes a non-zero amount of time,
-and an attempt to perform an operation on their container — tab
-slider — before it is completed will leave the component in an
-inconsistent state. For illustration purposes, the second
-<indexterm><primary>tabslider</primary></indexterm><classname>tabslider</classname> has this problem, whereby
-selecting the first <indexterm><primary>tab</primary></indexterm><classname>tab</classname> element too soon
-renders its parent unusable (the other
-<indexterm><primary>tabelement</primary></indexterm><classname>tabelement</classname>s are gone).</para>
-
-<para>This example also takes advantage of the fact that, by default, views
-become visible when they consume data (see section on visibility of
-datamapped views above). Before the button is clicked, there is a
-single <indexterm><primary>tabelement</primary></indexterm><classname>tabelement</classname> object within the
-tabslider. However, it is kept invisible until it receives data, at
-which point its replication occurs, and its clones are displayed.</para>
-
-<para/></section><section><title>Nodes and the <indexterm><primary>onnodes event</primary></indexterm><literal>onnodes</literal> event</title>
-
-<para>Similarly to the <indexterm><primary>clones</primary></indexterm><sgmltag class="attribute">clones</sgmltag> property,
-<indexterm><primary>LzReplicationManager</primary></indexterm><classname>LzReplicationManager</classname> maintains a list of
-matched data nodes in the <indexterm><primary>nodes</primary></indexterm><sgmltag class="attribute">nodes</sgmltag> property. It is
-an array of <indexterm><primary>LzDataElement</primary></indexterm><classname>LzDataElement</classname> objects that are
-mapped to the replicated views, and is available before any clones are
-created. And as with the <indexterm><primary>onclones event</primary></indexterm><literal>onclones</literal> event, a handler
-for <indexterm><primary>onnodes event</primary></indexterm><literal>onnodes</literal> may be declared to respond to data
-replication in a custom way. The code below qualifies the value of
-<indexterm><primary>name</primary></indexterm><sgmltag class="attribute">name</sgmltag> attribute of each replicated data node
-with the value of the text field, if any.</para>
-<example role="live-example">
- <title>Using the nodes property</title>
- <programlisting language="lzx">
- <textobject><textdata fileref="programs/databinding-$26.lzx"/></textobject>
- </programlisting>
-</example>
-
-
-
-<para/></section></section><section id="databinding.pooling"><title>Pooling</title>
-
-<para>If your application uses data replication and the data backing
-replicated views changes at runtime, by default the replication
-manager destroys and re-creates the replicated views whose data has
-changed. The typical scenarios when this will occur are a change in
-the datapath of the replicated view, or deletion/addition of rows to
-the dataset. Because the dataset may contain many data elements, this
-adjustment is often an expensive operation that results in a
-noticeable flicker of the user interface while view removal/creation
-takes place.</para>
-
-<para>In order to make updates to datamapped elements more efficient, you can declare the datapath that will match multiple
-nodes with the <indexterm><primary>pooling</primary></indexterm><sgmltag class="attribute">pooling</sgmltag> attribute set to
-<literal>true</literal>. The effect of this is that the views that have already been
-created as a result of replication will be reused internally, instead
-of re-created. Since the replication manager only needs to remap the
-changed data to the existing clones, data updates are reflected in UI
-much faster than they would be if the runtime had to create new views.
-Consider the following example.</para>
-<example role="live-example">
- <title>Using pooling to optimize data updates</title>
- <programlisting language="lzx">
- <textobject><textdata fileref="programs/databinding-$27.lzx"/></textobject>
- </programlisting>
-</example>
-
-
-<para>In the code above, we handle data removal by going through the list of data nodes, and deleting the nodes whose
-<indexterm><primary>checked</primary></indexterm><sgmltag class="attribute">checked</sgmltag> attribute is set to "true". Note how this attribute is controlled by and mapped to the value of
-the corresponding checkbox. Any change in the state of the checkbox results in an update to the data node attribute,
-and vice versa — when views are created or reused (due to deletion), the appearance of their checkboxes is unchecked
-because initially the attribute is not set.</para><para>This kind of syncing to the underlying data is generally required
-when pooling is in effect and the state of the visual elements can be changed as a result of a user interaction.
-In a simpler case, the UI would not be modifiable by the user, so the data flow is one way only and the views are
-completely data-driven, and therefore consistency of data with its presentation would be maintained automatically.</para>
-
-<para/><section><title>When not to use pooling</title>
-
-<para>Pooling is generally a good optimization in cases where
-the data completely informs the state of a replicated view. If the
-view has additional state which can change through user interaction or
-depends on setting attributes at init time, then this option cannot
-usually be used. The default value for the <indexterm><primary>pooling</primary></indexterm><sgmltag class="attribute">pooling</sgmltag> on <indexterm><primary>dataset</primary></indexterm><sgmltag class="element"><dataset></sgmltag> is "false", except when
-replication is set to <literal>lazy</literal>, in which case it must be
-true, as described below.
-</para>
-
-<para/></section></section><section id="databinding.lazy-replication"><title>Lazy replication</title>
-<?ignore Needs work
-?>
-<para>If a datapath's <indexterm><primary>replication</primary></indexterm><sgmltag class="attribute">replication</sgmltag> attribute is set
-to <literal>lazy</literal>, then a match to multiple nodes will create an
-<indexterm><primary>LzLazyReplicationManager</primary></indexterm><classname>LzLazyReplicationManager</classname> instead of an
-<indexterm><primary>LzReplicationManager</primary></indexterm><classname>LzReplicationManager</classname>. This kind of replication manager is called "lazy" because it doesn't do the work of creating a view until it has to, and it does the bare minimum of work. The lazy replication
-manager creates only enough replicated views necessary to display the
-data, so there is not a view for each data node. This enables the
-display of very large datasets.</para>
-
-<para>Because the <indexterm><primary>LzLazyReplicationManager</primary></indexterm><classname>LzLazyReplicationManager</classname> is relatively specialized, there are several restrictions on its use:</para>
-
-<itemizedlist spacing="compact"><listitem><para>The replicated views should be contained in a view which is not the view that clips. The replicated views can be positioned by moving this container. This container will be sized to the size of the replicated list.</para></listitem><listitem><para>The parent of the container must be a view that clips (that is, its <indexterm><primary>clip</primary></indexterm><sgmltag class="attribute">clip</sgmltag> attribute is set to "true".</para></listitem><listitem><para>The replicated view cannot change its size in the replication axis, and the size cannot be a constraint. If the replicated view is sized by its contents, then lazy replication may not work in all cases.</para></listitem><listitem><para>The data should completely inform the display of the view. Any attributes that are changed through interaction with a replicated view should be stored in the dataset.</para></listitem><listitem><para>Selection within the replicated views should be controlled by a <indexterm><primary>LzDataSelectionManager</primary></indexterm><classname>LzDataSelectionManager</classname>.</para></listitem></itemizedlist>
-<para>This example shows use of the lazy replication manager to display a large dataset. The replication does not create a view for each node in the dataset; rather it only creates enough views to fill the clipping view that contains it.
-As you click the "Make it bigger" button, you will see that more items from the list are shown. Notice also that these views are actually being created when you press the button, as you can see by then "number of subviews" value at the top of the canvas.
-</para>
-<example role="live-example">
- <title>Using a lazyreplicationmanager to display a large dataset</title>
- <programlisting language="lzx">
- <textobject><textdata fileref="programs/databinding-$28.lzx"/></textobject>
- </programlisting>
-</example>
-
-
-
-<para>See the <ulink url="../../examples/paging.lzx" type="">paging.lzx example</ulink> for
-another example of lazy replication.</para>
-<para/></section><section><title>$path bindings and replication</title>
-<para>
-Only a datapath can cause replication. Although it might seem that $path might be used to implicitly force replication, it will not. A $path expression will only yield a single value. If it matches multiple values, it is an error and it will act as if it matched none. In the example below, note that The $path constraint does not update when the enclosing datapath is set.
-</para>
-<example role="live-example">
- <title>$path does not replicate</title>
- <programlisting language="lzx">
- <textobject><textdata fileref="programs/databinding-$29.lzx"/></textobject>
- </programlisting>
-</example>
-
-
-<para/></section><section><title>$path syntax to determine order of replicated views</title>
-<para>
-Sometimes you want to know the position of a view; for example, say you wanted to alternate background colors. You might think of checking for the position of the view in its <indexterm><primary><literal>oninit()</literal></primary></indexterm><methodname>oninit()</methodname> method.
-</para>
-<para>
-However, if you're using datapath pooling (you'll probably want to for long lists), the <literal>oninit</literal> events for views created by data replication don't necessarily fire because the views may be reused. In that case, the <literal>ondata</literal> event will fire, so you might consider using the <indexterm><primary><literal>ondata()</literal></primary></indexterm><methodname>ondata()</methodname> handler. However, incrementing a counter isn't the most reliable way to determine order because views may not instantiate in linear order. </para>
-<para>
-That's why it's better to use a datapath expression. Add attribute like this inside your replicated node:
-</para>
-<programlisting>
-<attribute name="pos" value="$path{'position()'}"/>
-</programlisting>
-<para>
-This will tie the pos attribute to the physical position in the data. You can then then tie the background color like so:
-</para>
-<programlisting>
-<attribute name="bgcolor" value="${this.pos % 2 == 0 ? 0x00EEEE : 0x00DDDD}"/>
-</programlisting>
-
-<para/></section><section id="databinding.procedural_and_replicated"><title>Be careful of mixing replication and classes declared procedurally</title>
-<para>
-Views that you create procedurally are not the same as "clones" created by data replication. In fact, data replication overrides procedurally created views. For example:
-</para>
-<orderedlist spacing="compact"><listitem><para>Declare a view.</para></listitem><listitem><para>Add subviews to it (procedurally), and alter its properties.</para></listitem><listitem><para>Set a datapath on the view (from step 1) that would make it replicate.</para></listitem></orderedlist>
-<para>
-Changes made in step 2 will be ignored after replication.
-</para>
-
-<?ignore <h4>Lazy replication gotchas</h4>
-<todo>Sizing, required structure, attribute resetting</todo>
-
-<h4>Using a dataselectionmanager</h4>
-
-
-<h2>Tags/APIs discussed in this chapter</h2>
-<ul>
- <li><classname link="true">LzDataElement</classname></li>
- <li><classname link="true">LzDataNode</classname></li>
- <li><classname link="true">LzDataText</classname></li>
- <li><classname link="true">LzDatapointer</classname></li>
- <li><classname link="true">LzDatapath</classname></li>
- <li><classname link="true">LzReplicationManager</classname></li>
- <li><classname link="true">LzLazyReplicationManager</classname></li>
- <li><classname link="true">LzDataSelectionManager</classname></li>
-</ul>
-
-<fixme>
-.. Cleanup structure a bit and add nicer intro
-
-.. There should be a discussion early of LzNodes and LzDatanodes as well as the special 'datapath' attribute of LzNodes that takes an XPath expression and binds the LzDatanodes to LzNodes (and replicates the LzNodes if the XPath matches multiple LzDatanodes). (edb: this is my defn of what Laszlo databinding *is*.)
-
-.. move/splice descrition of datasource/dataset with data transport chapter
-
-.. Add description of '/', '.', and '..' in XPath
-
-.. Possibly simplify examples where possible (avoid use of ?lzt=xml).
-</fixme>
-?>
<para/></section></section></chapter>
Copied: openlaszlo/branches/devildog/docs/src/developers/dataprovider.dbk (from rev 7768, openlaszlo/trunk/docs/src/developers/dataprovider.dbk)
Copied: openlaszlo/branches/devildog/docs/src/developers/datareplication.dbk (from rev 7768, openlaszlo/trunk/docs/src/developers/datareplication.dbk)
Modified: openlaszlo/branches/devildog/docs/src/developers/doc-toolchain.dbk
===================================================================
--- openlaszlo/branches/devildog/docs/src/developers/doc-toolchain.dbk 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/docs/src/developers/doc-toolchain.dbk 2008-01-08 20:09:01 UTC (rev 7769)
@@ -526,7 +526,13 @@
<listitem>dbkpreprocessexamples.xsl</listitem>
<listitem>lzx-pretty-print.xsl</listitem>
</itemizedlist>
-
+ <section>
+ <title>How the copyright gets generated</title>
+ <para>There is a copyright notice at the bottom of every dguide and reference page. This notice is generated
+ during the docbook transform by the template user.footer.content in the file common-html.xsl. To change
+ to copyright date for all generated documents, change the date in this template.</para>
+ <para>The copyright notice for files that are <emphasis>not generated</emphasis> is entered manually.</para>
+ </section>
</section>
Modified: openlaszlo/branches/devildog/docs/src/developers/index.dbk
===================================================================
--- openlaszlo/branches/devildog/docs/src/developers/index.dbk 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/docs/src/developers/index.dbk 2008-01-08 20:09:01 UTC (rev 7769)
@@ -24,7 +24,7 @@
<!-- change title per LPP-4804, IORIO 14 oct 2007 -->
<title>OpenLaszlo Application Developer's Guide</title>
<titleabbrev>Developer Guide</titleabbrev>
-
+
<preface id="developers.preface">
<title>Preface</title>
<xi:include href="developers_guide_preface.dbk"/>
@@ -89,6 +89,8 @@
<xi:include href="data-structures.dbk"/>
<!-- xi:include href="data-overview.dbk"/-->
<xi:include href="databinding.dbk"/>
+ <xi:include href="datareplication.dbk"/>
+ <xi:include href="dataprovider.dbk"/>
<xi:include href="data_app.dbk"/>
<!-- xi:include href="static-databinding.dbk"/ -->
<!-- xi:include href="dynamic-databinding.dbk"/ -->
Modified: openlaszlo/branches/devildog/laszlo-explorer/coverpages/components_cover.html
===================================================================
--- openlaszlo/branches/devildog/laszlo-explorer/coverpages/components_cover.html 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/laszlo-explorer/coverpages/components_cover.html 2008-01-08 20:09:01 UTC (rev 7769)
@@ -2,7 +2,7 @@
<!-- components sample cover page for Laszlo Explorer -->
<!-- -->
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!--=======================================================================-->
@@ -20,13 +20,13 @@
</p>
<p>
These pages show how you use parameters to customize the appearance and
- behavior of Open components to meet your needs.
+ behavior of OpenLaszlo components to meet your needs.
</p>
<p>
All OpenLaszlo components can be specified declaratively;
they are data-driven and can be modified at runtime using JavaScript.
The look of a component may be changed using the <style> tag or by
- modifying component resource. For more details about changing the
+ modifying the component resource. For more details about changing the
look of the OpenLaszlo components, see:
</p>
<ul>
Modified: openlaszlo/branches/devildog/laszlo-explorer/coverpages/getting_started.html
===================================================================
--- openlaszlo/branches/devildog/laszlo-explorer/coverpages/getting_started.html 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/laszlo-explorer/coverpages/getting_started.html 2008-01-08 20:09:01 UTC (rev 7769)
@@ -2,7 +2,7 @@
<!-- Getting Started page for Laszlo Explorer -->
<!-- -->
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!--=======================================================================-->
@@ -34,7 +34,7 @@
<li>
<div class="desc-short">Code for
the demos is presented in a
-syntax-coded viewer that displays different types of tags in different colors.</div>
+syntax-colored viewer that displays different types of tags in different colors.</div>
</li>
<li>
<div class="desc-short">Code for the
Modified: openlaszlo/branches/devildog/laszlo-explorer/coverpages/small_applications_cover.html
===================================================================
--- openlaszlo/branches/devildog/laszlo-explorer/coverpages/small_applications_cover.html 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/laszlo-explorer/coverpages/small_applications_cover.html 2008-01-08 20:09:01 UTC (rev 7769)
@@ -2,7 +2,7 @@
<!-- small applications cover page for Laszlo Explorer -->
<!-- -->
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!--=======================================================================-->
@@ -19,7 +19,7 @@
reference,
these small applications integrate the use of multiple APIs; however,
they are small enough that even novice LZX developers can read though the
- code to get a feel for the how the application works.
+ code to get a feel for how the application works.
</p>
</center>
Modified: openlaszlo/branches/devildog/test/lztest/lztest-class-impl.lzx
===================================================================
--- openlaszlo/branches/devildog/test/lztest/lztest-class-impl.lzx 2008-01-08 19:41:34 UTC (rev 7768)
+++ openlaszlo/branches/devildog/test/lztest/lztest-class-impl.lzx 2008-01-08 20:09:01 UTC (rev 7769)
@@ -6,22 +6,50 @@
-->
<script when="immediate"><![CDATA[
+ // Test basic classes
+ class LzSub {
+ var testAttr;
+ var accum;
-// Test mixin overrides and super calls.
+ function LzSub () {
+ super();
+ this.testAttr = true;
+ this.accum = "";
+ };
+
+ function testMethod (a) {
+ this.accum += a;
+ }
+ }
+
+ class LzSubSub extends LzSub {
+ function LzSubSub () {
+ super();
+ };
+
+ function testMethod (a) {
+ super.testMethod(a);
+ }
+ }
+
+ // Test subclassing node
+ class LzNodeSub extends LzNode {};
+
+ // Test mixin overrides and super calls.
class Vanilla {
var initorder = "";
- function initialize() {
- super.initialize.apply(this, arguments);
+ function Vanilla () {
+ super();
this.initorder += "/vanilla";
}
- function test() {
+ function test () {
return 'vanilla';
}
}
- trait Banana {
- function initialize() {
- super.initialize.apply(this, arguments);
+ mixin Banana {
+ function Banana () {
+ super();
this.initorder += "/banana";
}
function test() {
@@ -29,9 +57,9 @@
}
}
- class Sundae extends Vanilla inherits Banana {
- function initialize() {
- super.initialize.apply(this, arguments);
+ class Sundae extends Vanilla with Banana {
+ function Sundae () {
+ super();
this.initorder += "/sundae"
}
function test() {
@@ -46,22 +74,19 @@
var suiteSubclasses = new LzTestSuite("Subclasses");
-
suiteSubclasses.testSub = function() {
- var LzSub = Class.make( "LzSub", null,
- ['initialize', function (){this.testAttr = true; this.accum = ""; }] );
+ // We can't easily support this in swf9, do we need to?
+ LzSub.addProperty('testAttr2', "foo");
- LzSub.addProperty('testAttr2', "foo");
- LzSub.addProperty('testMethod', function (a) { this.accum = this.accum + a; });
-
LzTestManager.assertEquals("LzSub", LzSub.classname);
-
-
var subInst = new LzSub();
LzTestManager.assertTrue( subInst instanceof LzSub );
+ LzTestManager.assertTrue( subInst is LzSub );
+ LzTestManager.assertFalse( subInst is Number );
+ LzTestManager.assertFalse( subInst is Banana );
LzTestManager.assertEquals( true, subInst.testAttr );
LzTestManager.assertEquals( "foo", subInst.testAttr2 );
@@ -71,21 +96,16 @@
subInst.testMethod("baz");
LzTestManager.assertEquals( "barbaz", subInst.accum );
-
- var LzSubSub = Class.make( "LzSubSub", LzSub,
- ['initialize', function () {
- super.initialize();
- }] );
- LzSubSub.addProperty('testMethod', function (a) {
- #pragma "methodName=testMethod"
- super.testMethod(a); });
+ LzTestManager.assertEquals("LzSubSub", LzSubSub.classname);
- LzTestManager.assertEquals("LzSubSub", LzSubSub.classname);
-
var sub2Inst = new LzSubSub();
LzTestManager.assertTrue( sub2Inst instanceof LzSub);
+ LzTestManager.assertTrue( sub2Inst is LzSub);
+ LzTestManager.assertFalse( sub2Inst is Number );
+ LzTestManager.assertFalse( sub2Inst is Banana );
LzTestManager.assertTrue( sub2Inst instanceof LzSubSub);
+ LzTestManager.assertTrue( sub2Inst is LzSubSub);
LzTestManager.assertEquals( true, sub2Inst.testAttr );
@@ -100,12 +120,13 @@
}
suiteSubclasses.testClassNodeSub = function () {
- var LzNodeSub = Class.make( "LzNodeSub", LzNode );
LzTestManager.assertEquals("LzNodeSub", LzNodeSub.classname);
var nodeSubInst = new LzNodeSub();
LzTestManager.assertTrue( nodeSubInst instanceof LzNodeSub );
-
+ LzTestManager.assertTrue( nodeSubInst is LzNodeSub );
+ LzTestManager.assertFalse( nodeSubInst is Number );
+ LzTestManager.assertFalse( nodeSubInst is Banana );
}
suiteSubclasses.testUserClass = function () {
@@ -124,6 +145,9 @@
var insta = new suba(canvas, { name: "insta" }, [], false);
LzTestManager.assertTrue( insta instanceof suba );
+ LzTestManager.assertTrue( insta is suba );
+ LzTestManager.assertFalse( insta is Number );
+ LzTestManager.assertFalse( insta is Banana );
LzTestManager.assertEquals(0, insta.foocalls);
insta.foo();
@@ -145,7 +169,11 @@
var instb = new subb(canvas, { name: "instb" }, [], false);
LzTestManager.assertTrue( instb instanceof subb );
+ LzTestManager.assertTrue( instb is subb );
+ LzTestManager.assertFalse( instb is Number );
+ LzTestManager.assertFalse( instb is Banana );
LzTestManager.assertTrue( instb instanceof suba );
+ LzTestManager.assertTrue( instb is suba );
LzTestManager.assertEquals(0, instb.foocalls);
LzTestManager.assertEquals(0, instb.foooverrides);
@@ -154,18 +182,36 @@
LzTestManager.assertEquals(1, instb.foooverrides);
}
-suiteSubclasses.testTraitSuper = function() {
+suiteSubclasses.testMixinSuper = function() {
var treat = new Sundae();
+ LzTestManager.assertTrue( treat is Sundae, "treat is Sundae" );
+ LzTestManager.assertTrue( treat is Vanilla, "treat is Vanilla" );
+ LzTestManager.assertFalse( treat is Number );
+ // Debug.debug(Testing is on mixins: "%w is %w", treat, Banana)
+ LzTestManager.assertTrue( treat is Banana, "treat is Banana" );
LzTestManager.assertEquals("/vanilla/banana/sundae", treat.initorder);
LzTestManager.assertEquals("sundae banana vanilla", treat.test());
+
+ // Additional tests to verify `is` optimizations
+ LzTestManager.assertFalse( (new Sundae()) instanceof Number );
+ LzTestManager.assertTrue( (new Number()) instanceof Number );
+ LzTestManager.assertFalse( (new Sundae()) is Number );
+ LzTestManager.assertTrue( (new Number()) is Number );
+
+ // Additional tests to verify `cast`
+ LzTestManager.assertFalse( (new Sundae()) cast Vanilla instanceof Number );
+ LzTestManager.assertTrue( (new Number()) cast Object instanceof Number );
+ LzTestManager.assertFalse( (new Sundae()) cast Vanilla is Number );
+ LzTestManager.assertTrue( (new Number()) cast Object is Number );
+
}
suiteSubclasses.addTest(suiteSubclasses.testSub);
//suiteSubclasses.addTest(suiteSubclasses.testClassNodeSub);
//suiteSubclasses.addTest(suiteSubclasses.testUserClass);
-suiteSubclasses.addTest(suiteSubclasses.testTraitSuper);
+suiteSubclasses.addTest(suiteSubclasses.testMixinSuper);
]]>
</script>
@@ -174,7 +220,7 @@
</canvas>
<!--
/* X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2006-2007 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 ******************************************************/
-->
More information about the Laszlo-checkins
mailing list