[Laszlo-checkins] r8431 - in openlaszlo/branches/devildog: . WEB-INF/lps/lfc/core WEB-INF/lps/lfc/data WEB-INF/lps/lfc/events WEB-INF/lps/lfc/helpers WEB-INF/lps/lfc/kernel/swf WEB-INF/lps/lfc/services WEB-INF/lps/lfc/views WEB-INF/lps/server/src/org/openlaszlo/compiler WEB-INF/lps/server/src/org/openlaszlo/sc demos/amazon demos/lzpixmobile/lib test/components/base test/lfc
hqm@openlaszlo.org
hqm at openlaszlo.org
Wed Mar 26 11:27:15 PDT 2008
Author: hqm
Date: 2008-03-26 11:27:00 -0700 (Wed, 26 Mar 2008)
New Revision: 8431
Modified:
openlaszlo/branches/devildog/
openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzDefs.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/events/LaszloEvents.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/helpers/LzState.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
openlaszlo/branches/devildog/WEB-INF/lps/lfc/services/LzCursor.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzInputText.lzs
openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzText.lzs
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ReferenceCollector.java
openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptClass.java
openlaszlo/branches/devildog/demos/amazon/recommendation.lzx
openlaszlo/branches/devildog/demos/amazon/shoppinglist.lzx
openlaszlo/branches/devildog/demos/lzpixmobile/lib/navmanager.lzx
openlaszlo/branches/devildog/test/components/base/lzunit-basedatacombobox.lzx
openlaszlo/branches/devildog/test/lfc/handlerbug.lzx
Log:
Merged revisions 8403-8424 via svnmerge from
http://svn.openlaszlo.org/openlaszlo/trunk
.......
r8403 | max | 2008-03-25 17:50:07 -0400 (Tue, 25 Mar 2008) | 1 line
+ Show list price for recommendations
.......
r8405 | max | 2008-03-25 18:24:20 -0400 (Tue, 25 Mar 2008) | 1 line
+ Shopping cart, list should use list price also
.......
r8420 | ptw | 2008-03-26 10:10:56 -0400 (Wed, 26 Mar 2008) | 23 lines
Change 20080320-ptw-4 by ptw at dueling-banjos.local on 2008-03-20 16:34:26 EDT
in /Users/ptw/OpenLaszlo/ringding-clean/docs/src
for http://svn.openlaszlo.org/openlaszlo/trunk/docs/src
Summary: Redefine LzCursor using 'modern O-O'
Bugs Fixed:
LPP-5617 'LzCursor reference page problems' (partial)
Technical Reviewer: dda (pending)
Doc Reviewer: lou (pending)
Details:
Redefine LzCursor as a global alias for LzCursorService.LzCursor
which is a singleton class implementing LzCursorInterface by
trampolining to LzMouseKernel. This was all being done in a
hand-crafted Object before, but the doc tools couldn't grok that
at all.
Tests:
LzCursor still works. The documentation is different.
.......
r8421 | ptw | 2008-03-26 10:13:13 -0400 (Wed, 26 Mar 2008) | 21 lines
Change 20080324-ptw-C by ptw at dueling-banjos.local on 2008-03-24 09:55:55 EDT
in /Users/ptw/OpenLaszlo/ringding-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix LzDelegate documentation
Bugs Fixed:
Lpp-5522 'LzDelegate program page problems'
Technical Reviewer: hqm (pending)
Doc Reviewer: lou (pending)
Details:
Mark public what should be public and private what should be
private. While I was there, I improved the way execute is
inlined/unrolled in execute.
Tests:
smoekcheck
.......
r8422 | ptw | 2008-03-26 10:14:47 -0400 (Wed, 26 Mar 2008) | 48 lines
Change 20080326-ptw-h by ptw at dueling-banjos.local on 2008-03-26 09:14:50 EDT
in /Users/ptw/OpenLaszlo/ringding-clean
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Constraint dependencies as methods
Bugs Fixed:
LPP-5623 'Implement dependencies-as-methods'
LPP-5628 'Syntax error: the token "with" was not expected at this position.'
Technical Reviewer: hqm (pending)
QA Reviewer: dda (pending)
Details:
lzunit-basedatacombobox: Update assertion to be more informative
on failure
handlerbug: Update to modern idiom
LzNode: Pull out applyConstraintExpr as common subroutine for use
by LzReplicationManager. Move options onto prototype.
LzDefs: Add dependencies method name to LzConstraintExpr
LzInputText, LzText, LaszloView, LzDatapointer, LzDataNode,
LzDataElement: Update to dependecies methods.
LzState: Move dependencies methods in parallel with constraint
methods.
LzReplicationManager: Use applyConstraintExpr
ReferenceCollector: Correct 'namespace', use swf9-safe method test.
ScriptClass: Make user classes dynamic
ClassCompiler: Default optional args in user class constructor.
NodeModel: Compute and install dependencies methods, treat mixins
and interfaces like classes for meta-attributes. Parse mixins
(but we don't do anything with them, yet).
navmanager: Declare interace to Spatialnav
Tests:
smokecheck, amazon, ant runlzunit
.......
r8424 | hqm | 2008-03-26 11:01:54 -0400 (Wed, 26 Mar 2008) | 63 lines
Change 20080326-hqm-F by hqm at badtzmaru.local on 2008-03-26 10:42:53 EDT
in /Users/hqm/openlaszlo/trunk4/WEB-INF/lps/lfc
for http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc
Summary: fix for context-menu bug on views with image resource
New Features:
Bugs Fixed: LPP-5636, LPP-5670
Technical Reviewer: max
QA Reviewer: andre
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ Made setContextMenu set the menu on the foreground movieclip if
there is one
+ Made setResource copy the previous resource movieclip's menu to the
new resource movieclip.
If there was not a menu property on the foreground movieclip, try
copying the menu property from the
background-color movieclip.
Tests:
test case from bug report, right click over image area shows same menu
as over background area.
I used this test case, placed in the test/ directory, so as to access
the resource in
test/resources/gif/logo.gif
<canvas>
<view width="300" height="100" bgcolor="blue" resource="resources/gif/logo.gif">
<handler name="oninit">
var cm = new LzContextMenu();
cm.addItem(cm.makeMenuItem('new item 1'));
cm.addItem(cm.makeMenuItem('new item 2'));
setContextMenu(cm);
</handler>
<handler name="onclick">
this.setSource("resources/png/face.png");
</handler>
</view>
</canvas>
Click right on image and background areas to verify that image and background have custom context menu
Click left on view to load new resource
Click right on image and background areas to verify that image and background have the custom context menu
.......
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-8402
+ /openlaszlo/branches/wafflecone:1-5746,5818-6068,6070-6205,6207-6213,6216-6265,6267-6368,6370-6431,6433-6450,6497 /openlaszlo/trunk:1-8424
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzDefs.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzDefs.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzDefs.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -15,40 +15,49 @@
*/
public class LzDeclaredEventClass /* implements LzEvent */ {
- function LzDeclaredEventClass () {
+ public function LzDeclaredEventClass () {
// Debug.debug("%w.%s(%w)", this, arguments.callee, arguments);
super();
}
- /**
- * @access private
- */
- /* const */ public var ready:Boolean = false;
+/** True when event is ready to be sent.
+ * @type Boolean
+ * @keywords readonly
+ * @devnote TODO: [2008-03-20 ptw] This really should just be:
+ * function get ready() { return this.delegateList.length > 0; }
+ */
+public var ready:Boolean = false;
+
+
/**
- * @access private
+ * Sends the event, passing its argument as the data to all the called
+ * delegates
+ *
+ * @param sd: The data to send with the event.
*/
- public function sendEvent (sd = null ){};
+public function sendEvent (sd = null ){};
+
/**
* @access private
*/
-function clearDelegates ( ){ };
+public function clearDelegates ( ){ };
/**
* @access private
*/
- function removeDelegate (d = null){ };
+public function removeDelegate (d = null){ };
/**
* @access private
*/
-function getDelegateCount ( ){return 0};
+public function getDelegateCount ( ){return 0};
/**
* @access private
*/
-function toString ( ){
+public function toString ( ){
return "LzDeclaredEvent";
}
@@ -98,8 +107,10 @@
* @access private
*/
class LzConstraintExpr extends LzOnceExpr {
- function LzConstraintExpr(constraintMethod:String) {
+ var dependenciesName:String;
+ function LzConstraintExpr(constraintMethod:String, dependenciesMethod:String) {
super(constraintMethod);
+ this.dependenciesName = dependenciesMethod;
}
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/core/LzNode.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -1376,23 +1376,7 @@
var constraints = rdict['$constraints'];
if (constraints != null) {
for (var i = 0, l = constraints.length; i < l; i++) {
- var c = constraints[i];
- // Apply the constraint method
- var constraintMethodName = c.methodName;
- // TODO: [2008-02-06 ptw] the dependency computation needs
- // to be a method also, probably stored in the
- // LzConstraintExpr object
- var cm = this[constraintMethodName];
- if ($debug) {
- if (!(cm && cm instanceof Function)) {
- Debug.debug("Bad constraint %w on %w", c, this);
- }
- }
- var dependencies = null;
- if ('dependencies' in cm) {
- dependencies = cm.dependencies.call(this);
- }
- this.applyConstraintMethod(constraintMethodName , dependencies);
+ this.applyConstraintExpr(constraints[i]);
}
}
// Backward compatibility -- are there any other delayed setters?
@@ -1520,6 +1504,30 @@
this[constraintMethodName]();
}
+ /** @access private */
+ function applyConstraintExpr(expr:LzOnceExpr) {
+ // Apply the constraint method
+ var constraintMethodName = expr.methodName;
+ if ($debug) {
+ if (!(this[constraintMethodName] is Function)) {
+ Debug.debug("Bad constraint %w on %w", expr, this);
+ }
+ }
+ var dependencies = null;
+ // TODO: [2008-03-24 ptw] Use `switch type`...
+ if (expr instanceof LzConstraintExpr) {
+ var c:LzConstraintExpr = (expr cast LzConstraintExpr);
+ var dependenciesMethodName = c.dependenciesName;
+ if ($debug) {
+ if (!(this[dependenciesMethodName] is Function)) {
+ Debug.debug("Bad constraint dependencies %w on %w", expr, this);
+ }
+ }
+ dependencies = this[dependenciesMethodName]();
+ }
+ this.applyConstraintMethod(constraintMethodName , dependencies);
+ }
+
/**
* Release a constraint on an attribute
*
@@ -1724,7 +1732,7 @@
* @keywords final
* @access private
*/
-var options = {};
+prototype.options = {};
/**
* Setter to install options on a class or instance
@@ -1752,7 +1760,7 @@
* @return any: The value for that option (or undefined, if the option
* has not been set)
*/
-function getOption ( key ){
+public function getOption ( key ){
return this.options[ key ];
}
@@ -1763,7 +1771,7 @@
* @param String key: The option to set
* @param any val: The value for the option.
*/
-function setOption ( key , val ){
+public function setOption ( key , val ){
// Ensure you have your own private options dictionary, not the one
// inherited from your class, nor the default empty one inherited
// from LzNode!
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDataElement.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -182,11 +182,8 @@
function getAttr (name){
if (this.attributes) return this.attributes[ name ];
}
-
-/**
- * @access private
- */
-prototype.getAttr.dependencies = function (who , self){
+/** @access private */
+function $lzc$getAttr_dependencies (who , self){
return [ self, 'attributes' ];
}
@@ -239,6 +236,10 @@
function hasAttr (name){
return this.attributes[ name ] != null;
}
+/** @access private */
+function $lzc$hasAttr_dependencies (who , self){
+ return [ self, 'attributes' ];
+}
/**
* Returns the first child of this node.
@@ -247,10 +248,8 @@
function getFirstChild (){
return this.childNodes[ 0 ];
}
-/**
- * @access private
- */
-prototype.getFirstChild.dependencies = function( who, self ){
+/** @access private */
+function $lzc$getFirstChild_dependencies( who, self ){
return [ this , "childNodes" ];
}
@@ -261,10 +260,8 @@
function getLastChild (){
return this.childNodes[ this.childNodes.length-1 ];
}
-/**
- * @access private
- */
-prototype.getLastChild.dependencies = function( who, self ){
+/** @access private */
+function $lzc$getLastChild_dependencies( who, self ){
return [ this , "childNodes" ];
}
@@ -281,13 +278,6 @@
/**
- * @access private
- */
-prototype.hasAttr.dependencies = function (who , self){
- return [ self, 'attributes' ];
-}
-
-/**
* Sets the attributes of this node to the given Object.
* @param Object attrs: The object to use as the attrs for this node.
*/
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzDatapointer.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -190,47 +190,6 @@
/**
* Returns the result of an XPath query without changing the pointer.
- * The result can be:
- * <ul>
- * <li>a string -- the result of an operator such as name or attribute</li>
- * <li>a single datapointer -- if the query resolves to a single node</li>
- * <li>an array of datapointers -- if the query resolves to multiple nodes</li>
- * </ul>
- * @param Object p: the XPath
- * @deprecated Use <code>LzDatapointer.xpathQuery()</code> or a
- * <code>$path{}</code> instead.
- */
-function getXPath ( p ){
- if ( $debug ){
- if ( !this.didGetXPathWarn ){
- Debug.info("%w.%s is deprecated. Use %w.%s or a $path{} constraint instead.",
- this, arguments.callee, this, this.xpathQuery);
- }
- this.didGetXPathWarn = true;
- }
- var r = this.xpathQuery( p );
- var nr
- //testing for nodeType is the best way I can think of to check if the
- //return value is a node
-
- if ( r[0].nodeType ){
- //it's an array of dataNodes
- nr = [];
- for ( var i = 0; i < r.length; i++ ){
- nr[i] = new LzDatapointer( null, { p : r[ i ] } );
- }
- } else if ( r.nodeType ){
- nr = new LzDatapointer( null, { p : r } );
- } else {
- nr = r;
- }
-
- return nr;
-
-}
-
-/**
- * Returns the result of an XPath query without changing the pointer.
* @param Object p: the xpath
* @return any: <dl class="compact">
* <dt><code>null</code></dt><dd>if the
@@ -274,9 +233,8 @@
return nodes;
}
}
-
/** @access private */
-xpathQuery.dependencies = function ( who , self , p ){
+function $lzc$xpathQuery_dependencies ( who , self , p ){
if (this.parsePath) {
var pp = this.parsePath( p );
return [ pp.hasDotDot ? self.context.getContext().ownerDocument : self ,
@@ -287,8 +245,49 @@
}
+/**
+ * Returns the result of an XPath query without changing the pointer.
+ * The result can be:
+ * <ul>
+ * <li>a string -- the result of an operator such as name or attribute</li>
+ * <li>a single datapointer -- if the query resolves to a single node</li>
+ * <li>an array of datapointers -- if the query resolves to multiple nodes</li>
+ * </ul>
+ * @param Object p: the XPath
+ * @deprecated Use <code>LzDatapointer.xpathQuery()</code> or a
+ * <code>$path{}</code> instead.
+ */
+function getXPath ( p ){
+ if ( $debug ){
+ if ( !this.didGetXPathWarn ){
+ Debug.info("%w.%s is deprecated. Use %w.%s or a $path{} constraint instead.",
+ this, arguments.callee, this, this.xpathQuery);
+ }
+ this.didGetXPathWarn = true;
+ }
+ var r = this.xpathQuery( p );
+ var nr
+ //testing for nodeType is the best way I can think of to check if the
+ //return value is a node
+
+ if ( r[0].nodeType ){
+ //it's an array of dataNodes
+ nr = [];
+ for ( var i = 0; i < r.length; i++ ){
+ nr[i] = new LzDatapointer( null, { p : r[ i ] } );
+ }
+ } else if ( r.nodeType ){
+ nr = new LzDatapointer( null, { p : r } );
+ } else {
+ nr = r;
+ }
+
+ return nr;
+
+}
/** @access private */
-getXPath.dependencies = xpathQuery.dependencies;
+var $lzc$getXPath_dependencies;
+$lzc$getXPath_dependencies = $lzc$xpathQuery_dependencies;
/**
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzMiniNode.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -80,10 +80,8 @@
return this.__LZo;
}
-/**
- * @access private
- */
-prototype.getPreviousSibling.dependencies = function( who, self ){
+/** @access private */
+function $lzc$getPreviousSibling_dependencies( who, self ){
return [ this.parentNode , "childNodes" , this , "parentNode" ];
}
@@ -97,13 +95,13 @@
return this.parentNode.childNodes[ this.__LZo + 1 ];
}
-/**
- * @access private
- */
-prototype.getNextSibling.dependencies = function( who, self ){
+/** @access private */
+function $lzc$getNextSibling_dependencies( who, self ){
return [ this.parentNode , "childNodes" , this , "parentNode" ];
}
+
+
/**
* Tells whether the given node is above this one in the node hierarchy.
* @param LzDataElement el: The LzDataElement to test to see if it is above
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/data/LzReplicationManager.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -218,33 +218,21 @@
this.cloneAttrs = new LzInheritedHash(this.cloneAttrs);
this.cloneAttrs.datapath = LzNode._ignoreAttribute;
// but, we want the constraint to apply to this object instead
- var constraintMethodName = ia.datapath.methodName;
- // TODO: [2008-02-06 ptw] the dependency computation needs
- // to be a method also, probably stored in the
- // LzConstraintExpr object
- var dependencyMethod = view[constraintMethodName].dependencies;
-
this.__LZpreventXPathUpdate = true;
// NOTE: [2008-02-07 ptw] The method had better be available
// on the clone (which means we really want a clone class here
// to instantiate, rather than an instance to clone).
- this.applyConstraintMethod(constraintMethodName, dependencyMethod != null ? dependencyMethod.call(this) : []);
+ this.applyConstraintExpr(ia.datapath);
this.__LZpreventXPathUpdate = false;
} else if (oa && 'xpath' in oa && oa.xpath instanceof LzConstraintExpr){
//<view><datapath xpath="${ ... }"/>
hadxpathconstraint = true;
//we want the constraint to apply to this object instead
- var constraintMethodName = oa.xpath.methodName;
- // TODO: [2008-02-06 ptw] the dependency computation needs
- // to be a method also, probably stored in the
- // LzConstraintExpr object
- var dependencyMethod = odp[constraintMethodName].dependencies;
-
this.__LZpreventXPathUpdate = true;
// NOTE: [2008-02-07 ptw] The method had better be available
// on the clone (which means the compiler really has to move
// it from the datapath subnode to the clone class).
- this.applyConstraintMethod(constraintMethodName, dependencyMethod != null ? dependencyMethod.call(this) : []);
+ this.applyConstraintExpr(oa.xpath);
this.__LZpreventXPathUpdate = false;
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/events/LaszloEvents.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/events/LaszloEvents.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/events/LaszloEvents.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -21,7 +21,7 @@
* @shortdesc The receiver in Laszlo's point-to-point event system.
* @see LzEvent
*/
-dynamic class LzDelegate {
+final class LzDelegate {
var __delegateID:int = 0;
@@ -34,11 +34,12 @@
* @param String eventName: Optional, but required if eventSender is used; The name
* of the event to register the new delegate for.
*/
- function LzDelegate (context, functionName, eventSender:* = null, eventName:* = null) {
- // too expensive to leave on all the time
- // if ($debug) {
- // this._dbg_created = Debug.backtrace();
- // }
+public function LzDelegate (context, functionName, eventSender = null, eventName = null) {
+ super();
+ // too expensive to leave on all the time
+// if ($debug) {
+// this._dbg_created = Debug.backtrace();
+// }
this.c = context;
if ( $debug ){
if (typeof(functionName) != "string")
@@ -61,29 +62,32 @@
static var __nextID:int = 1;
/** The context in which to call the method
- * @type Object
- */
+ * @access private
+ * @type Object
+ */
var c;
/** The name of the method to call
- * @type String
- */
+ * @access private
+ * @type String
+ */
var f;
+/** @access private */
var lastevent = 0;
+/** @access private */
var enabled = true;
+/** @access private */
var event_called = false;
/**
* Executes the named method in the given context with the given data. Returns
- * the result of the call. In rare cases, this method may be overriden by a
- * subclass, and so it is marked 'protected' instead of 'private'.
- *
+ * the result of the call.
+ *
* @param sd: The data with which to call the method.
* @return: The value returned by the method call.
- * @access protected
*/
-function execute (sd){
+public function execute (sd){
// Don't execute if context has been deleted, as that could
// 'resurrect' the deleted view, causing a memory leak
// Usually this is because a deleted view has idle or timer events
@@ -93,7 +97,7 @@
if (context['__LZdeleted']) {
return;
}
- return context[this.f]( sd );
+ return context[this.f](sd);
}
}
@@ -106,7 +110,7 @@
* @param Object eventSender: The object which publishes the event.
* @param String eventName: The name (string) of the event to register for.
*/
-function register ( eventSender , eventName){
+public function register ( eventSender , eventName){
if (! eventSender) {
if ($debug) {
Debug.error('No eventSender (%w) for %s', eventSender, eventName);
@@ -152,7 +156,7 @@
/**
* Unregisters the delegate for all of the events it is registered for.
*/
-function unregisterAll ( ){
+public function unregisterAll ( ){
for (var i = 0; i< this.lastevent ; i++){
this[ i ].removeDelegate( this );
this[ i ] = null;
@@ -165,7 +169,7 @@
* @param LzEvent event: The event to unregister the delegate from.
* (e.g. myview.onmouseup)
*/
-function unregisterFrom ( event ){
+public function unregisterFrom ( event ){
var keep = [];
for (var i = 0; i< this.lastevent ; i++){
var ev = this[ i ];
@@ -187,14 +191,14 @@
/**
* Disables the delegate until enable method is called.
*/
-function disable (){
+public function disable (){
this.enabled = false;
}
/**
* Enables a delegate that has been disabled
*/
-function enable (){
+public function enable (){
this.enabled = true;
}
@@ -355,7 +359,6 @@
*/
public class LzEvent extends LzDeclaredEventClass {
-
var delegateList:Array = null;
/**
@@ -389,15 +392,15 @@
}
}
-// Because this is not created with Class
-//prototype.classname = "LzEvent";
-
/** True when event is being sent.
* @type Boolean
+ * @access private
*/
var locked:Boolean = false;
+// public var ready:Boolean = false;
+
/**
* Adds the given delegate to the event's delegate list. Although this listed
* as a public function it should rarely be called explicitly -- it is used
@@ -405,19 +408,12 @@
*
* @param LzDelegate d: The delegate to add to the list of delegates called by the event.
*/
-function addDelegate (d){
+public function addDelegate (d){
this.ready = true;
this.delegateList.push(d);
}
-
-/**
- * Sends the event, passing its argument as the data to all the called
- * delegates
- *
- * @param sd: The data to send with the event.
- */
public override function sendEvent ( sd = null ){
if ( this.locked ) { return; } //don't allow for multiple calls
@@ -441,18 +437,20 @@
for (var i = dll; i >= 0; i--){
d = this.delegateList[ i ];
//pointer may be bad due to deletions
- if ( d && ! d.event_called){
+ if ( d && d.enabled && (! d.event_called)){
d.event_called = true; //this delegate has been called
calledDelegates.push( d );
// We don't worry about deleted contexts here, because
// we assume that delegates registered on events are
// properly managed
- if (d.enabled && d.c) {
- if (d.c.__LZdeferDelegates) {
+ var c = d.c;
+ if (c && (! c.__LZdeleted)) {
+ if (c.__LZdeferDelegates) {
evq.push(this, d, sd);
} else {
// d.execute( sd ); inlined
- if (d.c && ! d.c.__LZdeleted && d.c[d.f]) d.c[d.f]( sd );
+ var f = d.f;
+ if (c[f]) c[f](sd);
}
}
}
@@ -482,11 +480,11 @@
*
* @param LzDelegate d: The delegate to remove from the delegateList.
*/
-override function removeDelegate ( d = null ){
+public override function removeDelegate ( d = null ){
var dll = this.delegateList.length;
for (var i = 0; i < dll; i++){
- if (this.delegateList[i] == d){
+ if (this.delegateList[i] === d){
this.delegateList.splice(i, 1);
break;
}
@@ -499,7 +497,7 @@
/**
* Removes all delegates from call list
*/
-override function clearDelegates (){
+public override function clearDelegates (){
while (this.delegateList.length ){
this.delegateList[ 0 ].unregisterFrom( this );
}
@@ -511,11 +509,12 @@
* Returns the number of delegates registered for the event
* @return Number: The number of delegates registered for the event.
*/
-override function getDelegateCount ( ){
+override public function getDelegateCount ( ){
return this.delegateList.length;
}
-override function toString (){
+/** @access private */
+public override function toString (){
return ( "LzEvent");
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/helpers/LzState.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/helpers/LzState.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/helpers/LzState.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -360,14 +360,25 @@
// methods they call from held to stateArgs
for (var key in stateArgs) {
var val = stateArgs[key];
- if (val instanceof LzInitExpr) {
+ if (val is LzInitExpr) {
var methodName = val.methodName;
// Method could be in held args
if (methodName in held) {
stateArgs[methodName] = held[methodName];
delete held[methodName];
+ } else {
+ // If it is already a method on the state, nothing to do
}
- // If it is already a method on the state, nothing to do
+ if (val is LzConstraintExpr) {
+ var dependenciesName = val.dependenciesName;
+ // Method could be in held args
+ if (dependenciesName in held) {
+ stateArgs[dependenciesName] = held[dependenciesName];
+ delete held[dependenciesName];
+ } else {
+ // If it is already a method on the state, nothing to do
+ }
+ }
}
}
@@ -377,34 +388,47 @@
var rename = null;
for (var key in held) {
var val = held[key];
- if (val instanceof LzInitExpr) {
- var methodName = val.methodName;
- // Method could be in held args
- if (held[methodName] is Function) {
- if (rename == null) { rename = []; }
- rename.push(key, held[methodName]);
- }
- // Or it could be a method on the state, in which case we have
- // to re-tach it to the parent
- if (this[methodName] is Function) {
- if (rename == null) { rename = []; }
- rename.push(key, this[methodName]);
- }
+ if (val is LzInitExpr) {
+ if (rename == null) { rename = []; }
+ rename.push(key, val);
}
}
+
if (rename != null) {
for (var i = 0, l = rename.length; i < l; i += 2) {
var key = rename[i];
- var val = rename[i + 1];
- var expr = held[key];
+ var expr = rename[i + 1];
var methodName = expr.methodName;
var newMethodName = methodName + this.__LZUID;
- // Clone the init expr with the new name
- held[key] = new (expr.constructor)(newMethodName);
- // Promote the binding method to held
- held[newMethodName] = val;
- // If the binding method was in held, remove it
- delete held[methodName];
+ if (held[methodName] is Function) {
+ // Method could be in held args, in which case we just rename
+ // it
+ held[newMethodName] = held[methodName];
+ delete held[methodName];
+ } else if (this[methodName] is Function) {
+ // It could be a method on the state, in which case we have to
+ // attach it to the parent
+ held[newMethodName] = this[methodName];
+ }
+ if (expr is LzConstraintExpr) {
+ var dependenciesName = expr.dependenciesName;
+ var newDependenciesName = dependenciesName + this.__LZUID;
+ if (held[dependenciesName] is Function) {
+ // Method could be in held args, in which case we just rename
+ // it
+ held[newDependenciesName] = held[dependenciesName];
+ delete held[dependenciesName];
+ } else if (this[dependenciesName] is Function) {
+ // It could be a method on the state, in which case we have to
+ // attach it to the parent
+ held[newDependenciesName] = this[dependenciesName];
+ }
+ // Clone the init expr with the new nameS
+ held[key] = new (expr.constructor)(newMethodName, newDependenciesName);
+ } else {
+ // Clone the init expr with the new name
+ held[key] = new (expr.constructor)(newMethodName);
+ }
}
}
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as 2008-03-26 18:27:00 UTC (rev 8431)
@@ -197,6 +197,11 @@
this.setHeight(this.hassetheight?this.height:null);
this.setWidth(this.hassetwidth?this.width:null);
+ if (this.__contextmenu) {
+ this.setContextMenu(this.__contextmenu);
+ }
+
+
this.owner.__LZvizLoad = true;
this.owner.__LZupdateShown();
this.owner.resourceload({width: this.resourcewidth, height: this.resourceheight, resource: this.resource, skiponload: false});
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzSprite.as
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/kernel/swf/LzSprite.as 2008-03-26 18:27:00 UTC (rev 8431)
@@ -296,6 +296,10 @@
//from this context, but it's not necessary.
var mc = this.owner.immediateparent.sprite.attachResourceToChildView( resourceName, this );
this.setMovieClip( mc , resourceName );
+ // Copy previous right-click context menu if there is one,
+ // from background-color movieclip.
+ var oldmenu = this.__LZbgRef.menu;
+ mv.menu = oldmenu;
}
this.resource = resourceName;
@@ -318,10 +322,15 @@
var reclick = this.__LZbuttonRef._visible;
this.__LZbuttonRef = null;
+ var oldmenu = this.__LZmovieClipRef.menu;
+ if (oldmenu == null) {
+ oldmenu = this.__LZbgRef.menu;
+ }
var oldname = this.__LZmovieClipRef._name;
var mc = this.owner.immediateparent.sprite.attachResourceToChildView( resourceName, this, oldname);
this.setMovieClip( mc , resourceName );
+ mc.menu = oldmenu;
if ( reclick ){
this.setClickable( true );
@@ -541,6 +550,10 @@
}
this.__LZbgColorO.setRGB( bgc );
}
+ // Reapply context menu if needed
+ if (this.__contextmenu) {
+ this.setContextMenu(this.__contextmenu);
+ }
}
@@ -1650,6 +1663,12 @@
}
this._bgcolorhidden = true;
mb.menu = cmenu;
+
+ // Install menu on foreground resource clip if there is one
+ var mc = this.getMCRef();
+ if (mc != null) {
+ mc.menu = cmenu;
+ }
}
if ($debug) {
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/services/LzCursor.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/services/LzCursor.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/services/LzCursor.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -1,84 +1,120 @@
-/**
- *
- * @copyright Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved.
- * Use is subject to license terms.
- *
- * @affects lzcursor
- * @access public
- * @topic LFC
- * @subtopic Services
- */
+ /**
+ *
+ * @copyright Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved.
+ * Use is subject to license terms.
+ *
+ * @affects lzcursor
+ * @access public
+ * @topic LFC
+ * @subtopic Services
+ */
/**
- * <p>The <classname>LzCursor</classname> service provides methods for
- * changing the mouse cursor. For example:</p>
- *
- * <example>
- * <canvas height="30">
- * <resource name="waitcursor" src="resources/lzwaitcursor_rsc.swf"/>
- *
- * <view bgcolor="yellow" cursor="waitcursor">
- *
- * <text>Roll over to change the cursor</text>
- * </view>
- * </canvas>
- * </example>
- *
- * <p>This example changes the cursor for 1/2 second when the button is
- * clicked:</p>
- *
- * <example title="Changing the cursor with LzCursor">
- * <canvas height="30">
- *
- * <resource name="waitcursor" src="resources/lzwaitcursor_rsc.swf"/>
- * <button onclick="setCursor()" text="Click me to change the cursor for 1/2 second">
- * <method name="setCursor">
- * LzCursor.setCursorGlobal('waitcursor');
- * var del= new LzDelegate(LzCursor, 'unlock');
- * LzTimer.addTimer(del, 500);
- * </method>
- * </button>
- * </canvas>
- *
- * </example>
- *
- * @shortdesc Provides methods for changing the mouse cursor.
- */
-var LzCursor = new Object;
+ * Interface to the kernel cursor controls
+ * @devnote TODO: [2008-03-20 ptw] This should be `interface` not `class`.
+ */
+class LzCursorInterface {
+ /**
+ * Shows or hides the hand cursor for all clickable views.
+ * @param Boolean show: true shows the hand cursor for buttons, false hides it
+ */
+ function showHandCursor(show:boolean) {};
-/**
- * Shows or hides the hand cursor for all clickable views.
- * @param Boolean show: true shows the hand cursor for buttons, false hides it
- * @type Function
- */
-LzCursor.showHandCursor = LzMouseKernel.showHandCursor;
+ /**
+ * Sets the cursor to a resource
+ * @param String resource: The resource to use as the cursor.
+ */
+ function setCursorGlobal(resource:String) {};
-/**
- * Sets the cursor to a resource
- * @param String what: The resource to use as the cursor.
- * @type Function
- */
-LzCursor.setCursorGlobal = LzMouseKernel.setCursorGlobal;
+ /**
+ * Prevents the cursor from being changed until unlock is called.
+ */
+ function lock() {};
-/**
- * Prevents the cursor from being changed until unlock is called.
- *
- * @type Function
- */
-LzCursor.lock = LzMouseKernel.lock;
+ /**
+ * Restores the default cursor.
+ */
+ function unlock() {};
+ /**
+ * Restores the default cursor if there is no locked cursor on
+ * the screen.
+ */
+ function restoreCursor() {};
+};
+
/**
- * Restores the default cursor.
- *
- * @type Function
- */
-LzCursor.unlock = LzMouseKernel.unlock;
+ * Implementation of cursor controls
+ * @devnote TODO: [2008-03-20 ptw] This should be `implements` not `extends`.
+ */
+class LzCursorService extends LzCursorInterface {
+ /** The cursor service. Also available as the global
+ * <code>LzCursor</code>.
+ *
+ * @type LzCursorService
+ * @keywords readonly
+ * @devnote this should be a public getter to enforce readonly
+ */
+ static var LzCursor:LzCursorService;
+ /** @access private
+ * @devnote AS3 does not allow private constructors, so we need the
+ * error
+ */
+ function LzCursorService() {
+ if (LzCursorService.LzCursor) {
+ throw new Error("There can be only one LzCursor");
+ }
+ }
+ LzCursorService.LzCursor = new LzCursorService;
+
+ /** @access private */
+ var showHandCursor = LzMouseKernel.showHandCursor;
+ /** @access private */
+ var setCursorGlobal = LzMouseKernel.setCursorGlobal;
+ /** @access private */
+ var lock = LzMouseKernel.lock;
+ /** @access private */
+ var unlock = LzMouseKernel.unlock;
+ /** @access private */
+ var restoreCursor = LzMouseKernel.restoreCursor;
+};
+
/**
- * This function restores the default cursor if there is no locked cursor on
- * the screen.
- *
- * @type Function
- */
-LzCursor.restoreCursor = LzMouseKernel.restoreCursor
+ * @shortdesc Alias for <link linkend="LzCursorService">LzCursorService.LzCursor</link>
+ *
+ * <p>The <code>LzCursor</code> service provides methods for
+ * changing the mouse cursor.</p>
+ *
+ * <p>This example shows how the cursor can be set on a view so that
+ * it will change when the mouse is over that view:</p>
+ *
+ * <example title="Setting the cursor for a view">
+ * <canvas height="30">
+ * <resource name="waitcursor" src="resources/lzwaitcursor_rsc.swf"/>
+ * <view bgcolor="yellow" cursor="waitcursor">
+ * <text>Roll over to change the cursor</text>
+ * </view>
+ * </canvas>
+ * </example>
+ *
+ * <p>This example changes the cursor for 1/2 second when the button is
+ * clicked:</p>
+ *
+ * <example title="Changing the cursor with LzCursor">
+ * <canvas height="30">
+ * <resource name="waitcursor" src="resources/lzwaitcursor_rsc.swf"/>
+ * <button onclick="setCursor()" text="Click me to change the cursor for 1/2 second">
+ * <method name="setCursor">
+ * LzCursor.setCursorGlobal('waitcursor');
+ * var del= new LzDelegate(LzCursor, 'unlock');
+ * LzTimer.addTimer(del, 500);
+ * </method>
+ * </button>
+ * </canvas>
+ * </example>
+ *
+ * @type LzCursorService
+ */
+var LzCursor = LzCursorService.LzCursor;
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LaszloView.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -1775,15 +1775,11 @@
return o;
}
-
/** @access private */
-if ($swf9) { } else {
- // TODO [hqm 2008-03] update this when new dependencies scheme is put in
-prototype.getBounds.dependencies = function ( who , self ){
+function $lzc$getBounds_dependencies ( who , self ){
return [ self, 'rotation' , self, 'x' , self , 'y' , self , 'width' ,
self , 'height' ];
}
-}
/**
* Sets the vertical alignment for the view to the given value. The
* alignment is based on the height of this view as compared to the
@@ -2166,16 +2162,12 @@
}
-if ($swf9) {
- // TODO [hqm 2008-03] update this when new dependencies scheme is put in
-
-} else {
-
-/** @devnote This routine is unused.
- * getAttributeRelative is the routine that is used in dependencies.
- * "who" below should refer to "self"
- */
-prototype.setAttributeRelative.dependencies = function ( who,self, prop ,
+/** @access private
+ * @devnote This routine is unused.
+ * getAttributeRelative is the routine that is used in dependencies.
+ * "who" below should refer to "self"
+ */
+function $lzc$setAttributeRelative_dependencies ( who,self, prop ,
refView ){
// Debug.write("here i am, about to call getLinkage");
var tLink = who.getLinkage( refView );
@@ -2209,9 +2201,9 @@
}
return d;
}
-}
+
/**
* Transform the specified attribute (width/height/x/y) from the existing
* coordinate space to the reference view's coordinate space. This
@@ -2241,10 +2233,8 @@
}
}
-if ($swf9) { } else {
- // TODO [hqm 2008-03] update this when new dependencies scheme is put in
-
-prototype.getAttributeRelative.dependencies = function( who,self, prop ,
+/** @access private */
+function $lzc$getAttributeRelative_dependencies( who,self, prop ,
refView ){
var tLink = self.getLinkage( refView );
var pass = 2;
@@ -2279,8 +2269,8 @@
return d;
}
-}
+
/** @access private */
var __LZviewLinks = null;
@@ -2331,14 +2321,12 @@
return this.__mousecache[xory];
}
-if ($swf9) {
- // TODO [hqm 2008-03] add this back in when new dependencies scheme is working
-} else {
-prototype.getMouse.dependencies = function( ) {
+/** @access private */
+function $lzc$getMouse_dependencies( ) {
return [ LzIdle, "idle" ];
}
-}
+
/**
* returns true if the point is contained within the view.
* @param Number x: an x value relative to the this view's coordinates
@@ -2713,12 +2701,12 @@
}
}
-if ($swf9) { } else {
-prototype.getCurrentTime.dependencies = function ( who, self ){
+/** @access private */
+function $lzc$getCurrentTime_dependencies ( who, self ){
return [ self , "frame" ];
}
-}
+
/**
* Returns the total amount of time the resource would take to play.
* @return Number: Seconds of media controlled by this view.
@@ -2731,6 +2719,10 @@
return this.totalframes / canvas.framerate;
}
}
+/** @access private */
+function $lzc$getTotalTime_dependencies ( who, self ){
+ return [ self , "load" ];
+}
/**
* Returns an object containing the media's id3 tag, assuming it's mp3 loaded
@@ -2745,14 +2737,6 @@
}
-if ($swf9) {
- // TODO [hqm 2008-03] update this when new dependencies scheme is put in
-} else {
-prototype.getTotalTime.dependencies = function ( who, self ){
- return [ self , "load" ];
-}
-}
-
var __LZdidPPwarn = false;
/** @access private */
@@ -2767,11 +2751,11 @@
return this.frame/this.totalframes;
}
-if ($swf9) { } else {
-prototype.getPlayPerc.dependencies = function ( who , self ){
+/** @access private */
+function $lzc$getPlayPerc_dependencies ( who , self ){
return [ self, "frame" ];
}
-}
+
/**
* Shows or hides the hand cursor for this view.
* @param Boolean s: true shows the hand cursor for this view, false hides
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzInputText.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzInputText.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzInputText.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -269,12 +269,6 @@
return this.sprite.getText();
}
-if ($swf9) { } else {
- // TODO [hqm 2008-03] fix this when new dependencies mechanism is in
- prototype.getText.dependencies = function(who, self) {
- return [ self, "text" ];
-}
-}
/**
* this attribute control the LzText::selectable attribute trough its setter
* @access private
Modified: openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzText.lzs
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzText.lzs 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/lfc/views/LzText.lzs 2008-03-26 18:27:00 UTC (rev 8431)
@@ -533,8 +533,11 @@
var tsprite:LzTextSprite = (this.sprite cast LzTextSprite);
return tsprite.getTextWidth();
}
+/** @access private */
+function $lzc$getTextWidth_dependencies ( who , self){
+ return [ self , "text" ];
+}
-
/**
* Calculates the current height of the text held by the text field.
*/
@@ -543,9 +546,11 @@
return tsprite.getTextHeight();
//return this.__LZtextclip.textHeight;
}
+/** @access private */
+function $lzc$getTextHeight_dependencies ( who , self){
+ return [ self , "text" ];
+}
-
-
/**
* @access private
*/
@@ -606,6 +611,10 @@
var tsprite:LzTextSprite = (this.sprite cast LzTextSprite);
return tsprite.getMaxScroll();
}
+/** @access private */
+function $lzc$getMaxScroll_dependencies ( who , self){
+ return [ self , "maxscroll" ];
+}
/**
@@ -809,34 +818,6 @@
}
/**
- * @access private
- */
- if($swf9) { } else {
- prototype.getTextWidth.dependencies = function ( who , self){
- return [ self , "text" ];
-}
- }
-/**
- * @access private
- */
-
-if ($swf9) { } else {
- prototype.getTextHeight.dependencies = function ( who , self){
- return [ self , "text" ];
-}
-}
-
-/**
- * @access private
- */
-if ($swf9) { } else {
- prototype.getMaxScroll.dependencies = function ( who , self){
- return [ self , "maxscroll" ];
-}
-}
-
-
-/**
* Returns the string represented in the text field
* @return: The string in the text field
*/
@@ -844,16 +825,11 @@
return this.text;
}
-/**
- * @access private
- */
-if ($swf9) { } else {
- prototype.getText.dependencies = function ( who , self){
+/** @access private */
+function $lzc$getText_dependencies ( who , self){
return [ self , "text" ];
}
-}
-
static var escapeChars = { '>': '>', '<': '<'};
/**
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java 2008-03-26 18:27:00 UTC (rev 8431)
@@ -288,7 +288,7 @@
className,
// All nodes get these args when constructed
// "parent:LzNode, attrs:Object, children:Object? = null, async:boolean = false",
- "parent:LzNode, attrs:Object, children:Object?, async:boolean",
+ "parent:LzNode, attrs:Object, children:Object?=null, async:boolean=null",
body,
null));
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java 2008-03-26 18:27:00 UTC (rev 8431)
@@ -200,7 +200,15 @@
Element source;
String srcloc;
String bindername;
+ String dependenciesname;
+ static org.openlaszlo.sc.Compiler compiler;
+
+ org.openlaszlo.sc.Compiler getCompiler() {
+ if (compiler != null) { return compiler; }
+ return compiler = new org.openlaszlo.sc.Compiler();
+ }
+
public CompiledAttribute (String name, Schema.Type type, String value, String when, Element source) {
this.name = name;
this.type = type;
@@ -211,6 +219,9 @@
if (when.equals(WHEN_PATH) || (when.equals(WHEN_STYLE)) || when.equals(WHEN_ONCE) || when.equals(WHEN_ALWAYS)) {
this.bindername = "$lzc$bind_" + name;
}
+ if (when.equals(WHEN_ALWAYS)) {
+ this.dependenciesname = "$lzc$dependencies_" + name;
+ }
}
public Function getBinderMethod() {
@@ -220,9 +231,8 @@
String installer = "setAttribute";
String body = "\n#beginAttribute\n" + srcloc + value + "\n#endAttribute\n)";
String pragmas =
- // Should be unnecessary for JS2 methods
"\n#pragma 'withThis'\n";
- if (when.equals(WHEN_ONCE)) {
+ if (when.equals(WHEN_ONCE) || when.equals(WHEN_ALWAYS)) {
// default
} else if (when.equals(WHEN_PATH)) {
installer = "dataBindAttribute";
@@ -233,11 +243,6 @@
// be determined until the style property value is
// derived (at run time)
installer = "__LZstyleBindAttribute";
- } else if (when.equals(WHEN_ALWAYS)) {
- pragmas =
- "\n#pragma 'constraintFunction'\n" +
- // Should be unnecessary for JS2 methods
- "\n#pragma 'withThis'\n";
}
Function binder = new Function(
bindername,
@@ -250,6 +255,20 @@
return binder;
}
+ public Function getDependenciesMethod() {
+ if (! when.equals(WHEN_ALWAYS)) {
+ return null;
+ }
+ String body = "\n#pragma 'withThis'\n" +
+ "return " + getCompiler().dependenciesForExpression(value);
+ Function dependencies = new Function(
+ dependenciesname,
+ "",
+ body,
+ srcloc);
+ return dependencies;
+ }
+
public Object getInitialValue () {
// A null value indicates an attribute that was declared only
if (value == null) { return null; }
@@ -269,6 +288,10 @@
kind = "LzConstraintExpr";
} else if (when.equals(WHEN_ALWAYS)) {
kind = "LzConstraintExpr";
+ // Always constraints have a second value, the dependencies method
+ return new BindingExpr("new " + kind + "(" +
+ ScriptCompiler.quote(bindername) + ", " +
+ ScriptCompiler.quote(dependenciesname) + ")");
}
// Return an initExpr as the 'value' of the attribute
return new BindingExpr("new " + kind + "(" + ScriptCompiler.quote(bindername) +")");
@@ -489,11 +512,37 @@
ClassModel getParentClassModel() {
String parentName = this.className;
return
- parentName.equals("class")?
+ ("class".equals(parentName) || "interface".equals(parentName))?
schema.getClassModel(element.getAttributeValue("extends", ClassCompiler.DEFAULT_SUPERCLASS_NAME)):
schema.getClassModel(parentName);
}
+ // TODO: [2008-03-26 ptw] Need to integrate mixins into the search
+ // for inherited attributes
+ ClassModel[] mixinModels;
+
+ ClassModel[] getMixinModels() {
+ String parentName = this.className;
+ if (! "class".equals(parentName)) { return null; }
+ if (mixinModels != null) { return mixinModels; }
+ String mixinSpec = element.getAttributeValue("with");
+ String mixins[];
+ if (mixinSpec != null) {
+ mixins = mixinSpec.split("\\s+,\\s+");
+ mixinModels = new ClassModel[mixins.length];
+ for (int i = 0; i < mixins.length; i++) {
+ ClassModel mm = schema.getClassModel(mixins[i]);
+ if (mm == null) {
+ throw new CompilationError(
+ "No model for mixin: " + mixins[i],
+ element);
+ }
+ mixinModels[i] = mm;
+ }
+ }
+ return mixinModels;
+ }
+
void setClassName(String name) {
this.className = name;
this.parentClassModel = getParentClassModel();
@@ -507,7 +556,7 @@
return schema.getAttributeType(parent, attrname);
}
- // Should only be called on a <class> definition element.
+ // Should only be called on a <class> or <interface> definition element.
ViewSchema.Type getAttributeTypeInfoFromSuperclass(
Element classDefElement, String attrname)
throws UnknownAttributeException
@@ -533,7 +582,7 @@
return attr.type;
}
// Otherwise, check if it's defined on the "class" element
- // (e.g., 'name' or 'extends')
+ // (e.g., 'name', 'extends', or 'with')
superclassModel = schema.getClassModel("class");
return superclassModel.getAttributeTypeOrException(attrname);
}
@@ -638,13 +687,12 @@
// attributes are really 'meta' attributes, not
// attributes of the class -- they will be processed by
// the ClassModel or ClassCompiler
- if ("class".equals(className)) {
+ if ("class".equals(className) || "interface".equals(className) || "mixin".equals(className)) {
// TODO: [2008-03-22 ptw] This should somehow be
// derived from the schema, but this does not work, so
// we hard-code the meta-attributes here
// if (superclassModel.getAttribute(name) != null) {
if ("name".equals(name) || "extends".equals(name) || "with".equals(name)) {
- System.err.println("Skipping meta-attribute: " + name);
continue;
}
}
@@ -675,7 +723,8 @@
//
if ((name.equals("id")) ||
(name.equals("name") &&
- topLevelDeclaration() && !className.equals("class"))) {
+ topLevelDeclaration() &&
+ (! ("class".equals(className) || "interface".equals(className) || "mixin".equals(className))))) {
ElementWithLocationInfo dup =
(ElementWithLocationInfo) env.getId(value);
// we don't want to give a warning in the case
@@ -704,7 +753,7 @@
Schema.Type type;
try {
- if (className.equals("class")) {
+ if ("class".equals(className) || "interface".equals(className) || "mixin".equals(className)) {
// Special case, if we are compiling a "class"
// tag, then get the type of attributes from the
// superclass.
@@ -817,6 +866,9 @@
if (cattr.bindername != null) {
attrs.put(cattr.bindername, cattr.getBinderMethod());
}
+ if (cattr.dependenciesname != null) {
+ attrs.put(cattr.dependenciesname, cattr.getDependenciesMethod());
+ }
attrs.put(name, cattr.getInitialValue());
}
@@ -1192,7 +1244,7 @@
// Just check method declarations on regular node.
// Method declarations inside of class definitions will be already checked elsewhere,
// in the call from ClassCompiler.updateSchema to schema.addElement
- if (!"class".equals(classname)) {
+ if (!("class".equals(className) || "interface".equals(className) || "mixin".equals(className))) {
schema.checkInstanceMethodDeclaration(element, classname, name, env);
}
}
@@ -1491,7 +1543,7 @@
boolean forceOverride = parentAttrSpec != null && "true".equals(parentAttrSpec.override);
try {
- if (parent.getName().equals("class")) {
+ if ("class".equals(className) || "interface".equals(className)) {
parenttype = getAttributeTypeInfoFromSuperclass(parent, name);
} else {
parenttype = schema.getAttributeType(parent, name);
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ReferenceCollector.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ReferenceCollector.java 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ReferenceCollector.java 2008-03-26 18:27:00 UTC (rev 8431)
@@ -109,7 +109,7 @@
} else {
callee = new ASTThisReference(0);
}
- String depnm = "$lsc$" + ((ASTIdentifier)fn).getName() + "_dependencies";
+ String depnm = "$lzc$" + ((ASTIdentifier)fn).getName() + "_dependencies";
// the function uses #pragma "warnUndefinedReferences=false"
// to avoid warnings for non-existent dependencies
@@ -117,7 +117,7 @@
map.put("_1", callee);
map.put("_2", new Compiler.Splice(node.get(1).getChildren()));
- return parser.substitute("('" + depnm + "' in _1) ? _1['" + depnm + "'](this, _1, _2) : []", map);
+ return parser.substitute("_1['" + depnm + "'] ? _1['" + depnm + "'](this, _1, _2) : []", map);
}
// TODO: [2006-02-22 dda] Remove this 'subfunction' version soon.
Modified: openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptClass.java
===================================================================
--- openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptClass.java 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptClass.java 2008-03-26 18:27:00 UTC (rev 8431)
@@ -26,7 +26,8 @@
}
public String toString() {
- String str = "class " + name + (superclass != null?(" extends " + superclass + " "):"") + "{\n";
+ // For now we make all user classes dynamic
+ String str = "dynamic class " + name + (superclass != null?(" extends " + superclass + " "):"") + "{\n";
int n = 1; Map attrs = classAttributes; String prefix = "static ";
for (; n <= 2; n++, attrs = attributes, prefix = "") {
for (Iterator i = attrs.entrySet().iterator(); i.hasNext(); ) {
Modified: openlaszlo/branches/devildog/demos/amazon/recommendation.lzx
===================================================================
--- openlaszlo/branches/devildog/demos/amazon/recommendation.lzx 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/demos/amazon/recommendation.lzx 2008-03-26 18:27:00 UTC (rev 8431)
@@ -36,7 +36,7 @@
fgcolor="#666699">
<simplelayout axis="x" spacing="4"/>
<text>Our Price:</text>
- <text datapath="OfferSummary/LowestNewPrice/FormattedPrice/text()" width="50"/>
+ <text datapath="ItemAttributes/ListPrice/FormattedPrice/text()" width="50"/>
</view>
</view>
<view y="${classroot.cover.height + 8}"
Modified: openlaszlo/branches/devildog/demos/amazon/shoppinglist.lzx
===================================================================
--- openlaszlo/branches/devildog/demos/amazon/shoppinglist.lzx 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/demos/amazon/shoppinglist.lzx 2008-03-26 18:27:00 UTC (rev 8431)
@@ -27,7 +27,7 @@
<view fontsize="12" fontstyle="bold">
<simplelayout axis="x" spacing="4"/>
<text>Our Price:</text>
- <text datapath="OfferSummary/LowestNewPrice/FormattedPrice/text()" width="${parent.width}"/>
+ <text datapath="ItemAttributes/ListPrice/FormattedPrice/text()" width="${parent.width}"/>
</view>
</view>
@@ -51,12 +51,12 @@
<method name="addItem" args="dpath">
this.panel_to_nudge.nudge();
- this.setAttribute("total", total+parseFloat(dpath.xpathQuery("OfferSummary/LowestNewPrice/FormattedPrice/text()").substring(1)));
+ this.setAttribute("total", total+parseFloat(dpath.xpathQuery("ItemAttributes/ListPrice/FormattedPrice/text()").substring(1)));
datapath.addNodeFromPointer(dpath);
</method>
<method name="removeItem" args="dpath">
- this.setAttribute("total", total-parseFloat(dpath.xpathQuery("OfferSummary/LowestNewPrice/FormattedPrice/text()").substring(1)));
+ this.setAttribute("total", total-parseFloat(dpath.xpathQuery("ItemAttributes/ListPrice/FormattedPrice/text()").substring(1)));
dpath.deleteNode();
</method>
Modified: openlaszlo/branches/devildog/demos/lzpixmobile/lib/navmanager.lzx
===================================================================
--- openlaszlo/branches/devildog/demos/lzpixmobile/lib/navmanager.lzx 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/demos/lzpixmobile/lib/navmanager.lzx 2008-03-26 18:27:00 UTC (rev 8431)
@@ -4,6 +4,12 @@
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ******************************************************-->
<library>
+ <interface name="Spatialnav">
+ <method name="findnext" />
+ <method name="findprev" />
+ <method name="handlekeydown" args="k" />
+ <method name="handlekeyup" args="k" />
+ </interface>
<script when="immediate">
<![CDATA[
mixin Spatialnav {
Modified: openlaszlo/branches/devildog/test/components/base/lzunit-basedatacombobox.lzx
===================================================================
--- openlaszlo/branches/devildog/test/components/base/lzunit-basedatacombobox.lzx 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/test/components/base/lzunit-basedatacombobox.lzx 2008-03-26 18:27:00 UTC (rev 8431)
@@ -53,7 +53,7 @@
scbox._updateSelectionByIndex( -1, false, false);
// Changing the selection to -1 should make the value become undefined, or null,
// but it shouldn't just keep the same value as before.
- assertFalse( 2 == scbox.getValue() );
+ assertNotSame( 2, scbox.getValue() );
</method>
<method name="testSelectItemAt">
@@ -76,7 +76,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 ****************************************************** -->
<!-- @LZX_VERSION@ -->
Modified: openlaszlo/branches/devildog/test/lfc/handlerbug.lzx
===================================================================
--- openlaszlo/branches/devildog/test/lfc/handlerbug.lzx 2008-03-26 18:12:01 UTC (rev 8430)
+++ openlaszlo/branches/devildog/test/lfc/handlerbug.lzx 2008-03-26 18:27:00 UTC (rev 8431)
@@ -1,9 +1,9 @@
<canvas width="640" height="480" debug="true">
<class name="foo1" oninit="debug.write('oninit foo1')">
<method name="init">
- Debug.write("about to send oninit for " + this.class.classname );
+ Debug.write("about to send oninit for " + this.constructor.tagname );
super.init();
- Debug.write("just sent for " + this.class.classname );
+ Debug.write("just sent for " + this.constructor.tagname );
</method>
</class>
<class name="foo2" extends="foo1" />
@@ -14,6 +14,6 @@
<simplelayout/>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-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