[Laszlo-checkins] r8590 - in openlaszlo/trunk: WEB-INF/lps/lfc/core WEB-INF/lps/lfc/views WEB-INF/lps/server/src/org/openlaszlo/compiler lps/components/base lps/components/incubator/rich-text lps/components/lz
ptw@openlaszlo.org
ptw at openlaszlo.org
Tue Apr 8 10:10:35 PDT 2008
Author: ptw
Date: 2008-04-08 10:10:27 -0700 (Tue, 08 Apr 2008)
New Revision: 8590
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
openlaszlo/trunk/lps/components/base/basecombobox.lzx
openlaszlo/trunk/lps/components/base/baseformitem.lzx
openlaszlo/trunk/lps/components/base/baselist.lzx
openlaszlo/trunk/lps/components/base/baselistitem.lzx
openlaszlo/trunk/lps/components/base/baseslider.lzx
openlaszlo/trunk/lps/components/base/basetabs.lzx
openlaszlo/trunk/lps/components/base/basetabslider.lzx
openlaszlo/trunk/lps/components/base/submit.lzx
openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx
openlaszlo/trunk/lps/components/lz/list.lzx
Log:
Change 20080407-ptw-Z by ptw at dueling-banjos.local on 2008-04-07 13:57:27 EDT
in /Users/ptw/OpenLaszlo/ringding-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Improve backward compatibility
Bugs Fixed:
LPP-5691 'lzpix swf7/swf8: picture 'Tags' are not displayed correctly.'
Technical Reviewer: hminsky (pending)
QA Reviewer: promanik (Message-Id: <20080408142710.1ED499CA5B at barracuda.laszlosystems.com>)
Details:
LzNode: Delete init args that get installed as declarations so
they don't get re-applied by apply args.
LaszloView: Correct deprecation message
NodeModel: Hold all non-method properties out as instance args,
because the replication protocol relies on being able to
manipulate them as _instanceAttrs
lps/components/*: Replace Debug.write with Debug.warn or .error
as appropriate. Clean up detection of incorrect 'item' classes.
Correct defaulting of 'item' classes.
Tests:
Test case in bug, smokecheck, runlzunit (except for LPP-5645, LPP-5710)
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs 2008-04-08 17:10:27 UTC (rev 8590)
@@ -192,21 +192,19 @@
// Get our inherited class attributes
var iargs = new LzInheritedHash(this['constructor'].attributes);
- // And merge in our instantiation attrs (if any). Taking
- // care to merge Array and Object attrs (for
- // back-compatibility). No special magic is needed to
- // compute attributes overriding constraints, because they
- // all come as attrs now and overriding will be automatic
- // from the InheritedHash (except for the bizarre merging of
- // arrays and hashes!)
+ // Merge in our instantiation attrs (if any). Taking care to
+ // merge Array and Object attrs (for back-compatibility). No
+ // special magic is needed to compute attributes overriding
+ // constraints, because they all come as attrs now and
+ // overriding will be automatic from the InheritedHash (except
+ // for the bizarre merging of arrays and hashes!)
if (attrs) {
LzNode.mergeAttributes(attrs, iargs);
}
var todelete;
- // Now install any decls that the tag compiler could't
- // figure out (because it does not know the built-in class
- // setters (c.f., ClassCompiler.java) and any other constant
- // initial values
+ // Install any decls that the tag compiler could't figure out
+ // (because it does not know the built-in class setters (c.f.,
+ // ClassCompiler.java) and any other constant initial values
if (! (this is LzState)) {
for (var key in iargs) {
var val = iargs[key];
@@ -228,18 +226,7 @@
}
}
this.addProperty(key, val);
- // TODO: [2008-03-19 ptw] Leave these args in
- // iargs, so constructors can see them.
- // Eventually, you should be able to update
- // constructors to use the instance attribute
- // for attributes that do not have setters and
- // are not constrained...
-// delete iargs[key];
- // But we have to not leave them for applyArgs
- // to see, as that could clobber the work of a
- // constructor!
- if (! todelete) { todelete = []; }
- todelete.push(key);
+ delete iargs[key];
} else {
// NOTE: [2008-03-18 ptw] this is for
// back-compatibility: it appears that an
@@ -267,8 +254,6 @@
this.construct( parent , maskedargs );
- if (todelete) { while (todelete.length) { delete maskedargs[todelete.pop()]; }; };
-
// Construct may, through many tangled webs of replication and
// placement, actually end up deleting us! Bail out.
if (this.__LZdeleted) { return; }
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2008-04-08 17:10:27 UTC (rev 8590)
@@ -1897,7 +1897,7 @@
* @deprecated use the width attribute directly
*/
function getWidth (){
- if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
+ if ($debug) Debug.deprecated(this, arguments.callee, 'width');
return this.width;
}
@@ -1907,7 +1907,7 @@
* @deprecated use the height attribute directly
*/
function getHeight (){
- if ($debug) Debug.deprecated(this, arguments.callee, this.setAttribute);
+ if ($debug) Debug.deprecated(this, arguments.callee, 'height');
return this.height;
}
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java 2008-04-08 17:10:27 UTC (rev 8590)
@@ -71,6 +71,8 @@
int totalSubnodes = 1;
final CompilationEnvironment env;
protected boolean emitClassDecl = false;
+ // Used to freeze the definition for generation
+ protected boolean frozen = false;
public Object clone() {
NodeModel copy;
@@ -1790,6 +1792,7 @@
}
void updateAttrs() {
+ if (frozen) return;
// Only used for checking multiple definitions now
// if (!setters.isEmpty()) {
// attrs.put("$setters", setters);
@@ -1835,10 +1838,37 @@
Map asMap() {
updateAttrs();
+ // Ok, freeze them now, so our manipulations below are not
+ // thwarted
+ frozen = true;
assert classAttrs.isEmpty();
Map map = new LinkedHashMap();
String tagName = className;
- if (hasMethods()) {
+ Map inits = new LinkedHashMap();
+ boolean hasMethods = false;
+ // Whether we make a class to hold the methods or not,
+ // implicit replication relies on non-method properties coming
+ // in as instance attributes, so we have to pluck them out
+ // here (and turn the attributes into just declarations, by
+ // setting their value to null).
+ //
+ // Node as map just wants to see all the attrs, so clean out
+ // the binding markers
+ for (Iterator i = attrs.entrySet().iterator(); i.hasNext(); ) {
+ Map.Entry entry = (Map.Entry) i.next();
+ String key = (String) entry.getKey();
+ Object value = entry.getValue();
+ if (value instanceof Function) {
+ hasMethods = true;
+ } else if (! (value instanceof NodeModel.BindingExpr)) {
+ inits.put(key, value);
+ attrs.put(key, null);
+ } else {
+ inits.put(key, ((NodeModel.BindingExpr)value).getExpr());
+ attrs.put(key, null);
+ }
+ }
+ if (hasMethods) {
// If there are methods, make a class
String name = id;
if (name == null) {
@@ -1850,27 +1880,16 @@
classModel.setNodeModel(this);
classModel.emitClassDeclaration(env);
} else {
- // Node as map just wants to see all the attrs, so clean out
- // the binding markers
- Map inits = new LinkedHashMap();
- for (Iterator i = attrs.entrySet().iterator(); i.hasNext(); ) {
- Map.Entry entry = (Map.Entry) i.next();
- String key = (String) entry.getKey();
- Object value = entry.getValue();
- if (! (value instanceof NodeModel.BindingExpr)) {
- inits.put(key, value);
- } else {
- inits.put(key, ((NodeModel.BindingExpr)value).getExpr());
- }
- }
- if (!inits.isEmpty()) {
- map.put("attrs", inits);
- }
+ // If no class needed, Put children into map
if (!children.isEmpty()) {
map.put("children", childrenMaps());
}
}
+ // Non-method attributes
+ if (!inits.isEmpty()) {
+ map.put("attrs", inits);
+ }
// The tag to instantiate
// TODO: [2008-04-01 ptw] we could have a flag day and put the
// class here, eliminating having to go through the
Modified: openlaszlo/trunk/lps/components/base/basecombobox.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/basecombobox.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/basecombobox.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -306,8 +306,11 @@
this.defaultselection = ds;
if ( ds == null ) return;
if ( defaulttext != "" ) {
- this.defaulttext = "";
- Debug.write("defaultselection overrides defaulttext",this);
+ if ($debug){
+ Debug.warn("%s.defaultselection (%s) overrides defaulttext (%s)",
+ this, ds, defaulttext);
+ }
+ this.defaulttext = "";
}
if ( this.ondefaultselection ) this.ondefaultselection.sendEvent();
</method>
Modified: openlaszlo/trunk/lps/components/base/baseformitem.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/baseformitem.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/baseformitem.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -47,7 +47,7 @@
if (this.submitname == "") this.submitname = this.name;
if (this.submitname == "") {
if ($debug) {
- Debug.write('name required for form submit', this);
+ Debug.error('name required for form submit', this);
}
return;
}
Modified: openlaszlo/trunk/lps/components/base/baselist.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/baselist.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/baselist.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -290,18 +290,11 @@
@param String text: the text for the item.
@param Object value: the value for the item. -->
<method name="addItem" args="text, value" >
- if (this.itemclassname == "") {
- if ($debug) {
- Debug.write("itemclassname empty", this);
- }
- } else {
- if ($debug) {
- if (typeof(lz[this.itemclassname]) == "undefined") {
- Debug.write("itemclassname undefined", this);
- }
- }
+ if (this['itemclassname'] && lz[this.itemclassname]) {
new lz[this.itemclassname](this, {text:text, value:value});
- }
+ } else if ($debug) {
+ Debug.error("%s.itemclassname invalid: %s", this, this.itemclassname);
+ }
</method>
<!--- Find the first item with the specified value and remove it from
@@ -313,7 +306,7 @@
var item = getItem(value);
if ($debug) {
if (item == null) {
- Debug.write("item not found for value",value, this);
+ Debug.error("%s.item not found for %s", this, value);
}
}
_removeitem(item);
Modified: openlaszlo/trunk/lps/components/base/baselistitem.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/baselistitem.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/baselistitem.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -101,7 +101,7 @@
if (s) {
if ($debug) {
if (s == "false") {
- Debug.write("Warning: attempt to set baselistitem.selected to 'false', interpreted as true");
+ Debug.warn("attempt to set %s.selected to %#w, interpreted as true", this, s);
}
}
parent.select(this);
@@ -123,7 +123,7 @@
</library>
<!-- * 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 ****************************************************** -->
<!-- @LZX_VERSION@ -->
Modified: openlaszlo/trunk/lps/components/base/baseslider.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/baseslider.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/baseslider.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -172,7 +172,11 @@
<!--- Get the percentage of the range selected by the value.
@return Number: the percentage selected. -->
<method name="getPercentage">
- if (this.maxvalue-this.minvalue == 0) Debug.write("zero percentage");
+ if (this.maxvalue-this.minvalue == 0) {
+ if ($debug) {
+ Debug.error("%s.%s can not be computed, range is empty", this, arguments.callee);
+ }
+ }
return (this.value-this.minvalue) / (this.maxvalue-this.minvalue);
</method>
@@ -271,8 +275,8 @@
@keywords private -->
<method name="setX" args="x">
var boundedx = x;
- if ( x > parent.getWidth()-getWidth() ) {
- var constrainX = parent.getWidth()-getWidth();
+ if ( x > parent.width-width ) {
+ var constrainX = parent.width-width;
boundedx = constrainX;
} else
if (parent.x > x) {
Modified: openlaszlo/trunk/lps/components/base/basetabs.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/basetabs.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/basetabs.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -601,30 +601,29 @@
<!--- @keywords private -->
<handler name="onconstruct">
// Create tabsbar
- if (this.barclass != "") {
- if (typeof(lz[this.barclass]) != "undefined") {
- this.bar = new lz[this.barclass](this, {}, null, true);
- } else {
- Debug.write('barclass ' + this.barclass + ' is undefined');
- }
+ if (this['barclass'] && lz[this.barclass]) {
+ this.bar = new lz[this.barclass](this, {}, null, true);
+ } else if ($debug) {
+ Debug.error('%s.%s invalid: %s', this, 'barclass', this['barclass']);
}
if (this.bar == null) {
this.bar = new lz.basetabsbar(this, {}, null, true);
- Debug.write('Using basetabsbar for tab bar');
+ if ($debug) {
+ Debug.warn('%s.barclass defaulted to %s', this, this.bar.constructor.tagname);
+ }
}
// Create tabscontent, if it hasn't been already created
- if (this.contentclass != "") {
- if (typeof(lz[this.contentclass]) != "undefined") {
- this.content = new lz[this.contentclass](this, {}, null, true);
- } else {
- Debug.write('contentclass ' + this.contentclass +
- ' is undefined');
- }
+ if (this['contentclass'] && lz[this.contentclass]) {
+ this.content = new lz[this.contentclass](this, {}, null, true);
+ } else if ($debug) {
+ Debug.error('%s.%s invalid: %s', this, 'contentclass', this['contentclass']);
}
if (this.content == null) {
this.content = new lz.basetabscontent(this, {}, null, true);
- Debug.write('Using basetabscontent for tabs content area');
+ if ($debug) {
+ Debug.warn('%s.contentclass defaulted to %s', this, this.content.constructor.tagname);
+ }
}
</handler>
@@ -639,24 +638,11 @@
if (p == "_tabscontent") {
// only create new tabs if there's a place to put them
- var tc = args['tabclass'];
- if (typeof(tc) == "undefined") {
- tc = v['tabclass'];
- if (typeof(tc) == "undefined") {
- tc = this.tabclass;
- if ($debug) {
- if (typeof(tc) == "undefined") {
- Debug.write('no tabclass given');
- }
- }
- }
- }
- if (typeof(lz[tc]) != "undefined") {
+ var tc = args['tabclass'] || v['tabclass'] || this.tabclass;
+ if (tc && lz[tc]) {
v.tab = new lz[tc](this.bar, { tabpane: v }, null, true);
- } else {
- if ($debug) {
- Debug.write('tabclass \'' + tc + '\' is undefined');
- }
+ } else if ($debug) {
+ Debug.error("%s.tabclass invalid: %s", this, tc);
}
return this.content.determinePlacement(v, p);
Modified: openlaszlo/trunk/lps/components/base/basetabslider.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/basetabslider.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/basetabslider.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -148,7 +148,7 @@
<handler name="onaddsubview" method="doAddSubview"/>
<method name="doAddSubview" args="v" >
if ( this.itemclassname == "" ){
- this.itemclassname = v.constructor.classname;
+ this.itemclassname = v.constructor.tagname;
}
if ( typeof(v.minheight) == "undefined" ) {
// no minheight was defined so assign the parent
Modified: openlaszlo/trunk/lps/components/base/submit.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/submit.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/base/submit.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -46,14 +46,14 @@
<!--- @access private -->
<method name="_recverror" >
- Debug.write('form submission error', this.data);
+ Debug.error('form submission error: %s', this.data);
this.setAttribute('status', 'error');
this.setAttribute('error', this.data.getErrorString());
</method>
<!--- @access private -->
<method name="_recvtimeout" >
- Debug.write('form submission timeout');
+ Debug.error('form submission timeout');
this.setAttribute('status', 'timeout');
this.setAttribute('error', this.data.getErrorString());
</method>
@@ -121,6 +121,6 @@
</class>
</library>
<!-- * 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 ****************************************************** -->
Modified: openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx
===================================================================
--- openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/incubator/rich-text/scrollrichedittext.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -37,7 +37,7 @@
}
if ($debug) {
if (typeof(lz[classname]) == "undefined") {
- Debug.write("scrollbarclassname undefined", this);
+ Debug.error("%s.scrollbarclassname invalid: %s", this, classname);
}
}
var vsinit = function () {
Modified: openlaszlo/trunk/lps/components/lz/list.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/list.lzx 2008-04-08 15:48:43 UTC (rev 8589)
+++ openlaszlo/trunk/lps/components/lz/list.lzx 2008-04-08 17:10:27 UTC (rev 8590)
@@ -91,7 +91,7 @@
<handler name="onaddsubview" args="v"> <![CDATA[
if ( classroot.itemclassname == "" ){
- classroot.itemclassname = v.constructor.classname;
+ classroot.itemclassname = v.constructor.tagname;
}
if ( ( classroot.dataoption == "lazy" ||
classroot.dataoption == "resize" ) &&
@@ -115,12 +115,11 @@
if (classname == "") {
classname = "vscrollbar";
}
- if ($debug) {
- if (typeof(global[classname]) == "undefined") {
- Debug.write("scrollbarclassname undefined", this);
- }
+ if (classname && lz[classname]) {
+ this._sbar = new lz[classname](this, { stepsize: "20" });
+ } else if ($debug) {
+ Debug.error("%s.scrollbarclassname invalid: %s", classroot, classname)
}
- this._sbar = new lz[classname](this, { stepsize: "20" });
}
</method>
More information about the Laszlo-checkins
mailing list