[Laszlo-checkins] r8565 - in openlaszlo/trunk: WEB-INF/lps/server/src/org/openlaszlo/compiler lps/components/extensions lps/components/extensions/views lps/components/utils/replicator

ptw@openlaszlo.org ptw at openlaszlo.org
Sat Apr 5 16:23:01 PDT 2008


Author: ptw
Date: 2008-04-05 16:22:55 -0700 (Sat, 05 Apr 2008)
New Revision: 8565

Modified:
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
   openlaszlo/trunk/lps/components/extensions/drawview.lzx
   openlaszlo/trunk/lps/components/extensions/views/richinputtext.lzx
   openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx
   openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
Log:
Change 20080405-ptw-k by ptw at dueling-banjos.local on 2008-04-05 14:12:50 EDT
    in /Users/ptw/OpenLaszlo/ringding-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix components that use JS classes

Bugs Fixed:
LPP-5700 'drawview broken'

Technical Reviewer: a.bargull at intensis.de (pending)
QA Reviewer: promanik (Message-Id: <20080405230820.5EC8110E06F at hemicuda.laszlosystems.com>)

Details:
    NodeModel: Consider interfaces and mixins for getParentClassModel

    ClassModel: Store the 'kind' (class, interface, mixin), don't
    generate any code for interfaces (for now).

    drawview, richinputtext, lazyreplicator, replicator: Obey the new
    LFC tag class conventions.

Tests:
    drawview examples work again



Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java	2008-04-05 18:26:28 UTC (rev 8564)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java	2008-04-05 23:22:55 UTC (rev 8565)
@@ -20,6 +20,7 @@
     protected final ClassModel superclass;
     // This is null for the root class
     protected final Element definition;
+    protected String kind;
     protected NodeModel nodeModel;
     
     /** Set of tags that can legally be nested in this element */
@@ -56,6 +57,10 @@
         this.className = className;
         this.superclass = superclass;
         this.definition = definition;
+        if (definition != null) {
+          // class, interface, mixin
+          this.kind = definition.getName();
+        }
         this.schema = schema;
         this.sortkey = className;
         if (superclass != null) {
@@ -288,7 +293,9 @@
 
   boolean isCompiled() {
     // Classes that are builtin or have been compiled
-    return isBuiltin() || hasNodeModel();
+    // Or and interface:  for now, we generate nothing for an LZX
+    // interface
+    return isBuiltin() || hasNodeModel() || "interface".equals(kind);
   }
 
     ClassModel getSuperclassModel() {

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-05 18:26:28 UTC (rev 8564)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java	2008-04-05 23:22:55 UTC (rev 8565)
@@ -525,8 +525,8 @@
     ClassModel getParentClassModel() {
         String parentName = this.className;
         return
-            ("class".equals(parentName) || "interface".equals(parentName))?
-            schema.getClassModel(element.getAttributeValue("extends", ClassCompiler.DEFAULT_SUPERCLASS_NAME)):
+            ("class".equals(parentName) || "interface".equals(parentName) || "mixin".equals(parentName)) ?
+            schema.getClassModel(element.getAttributeValue("extends", ClassCompiler.DEFAULT_SUPERCLASS_NAME)) :
             schema.getClassModel(parentName);
     }
 

Modified: openlaszlo/trunk/lps/components/extensions/drawview.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/drawview.lzx	2008-04-05 18:26:28 UTC (rev 8564)
+++ openlaszlo/trunk/lps/components/extensions/drawview.lzx	2008-04-05 23:22:55 UTC (rev 8565)
@@ -256,9 +256,14 @@
     <when runtime="dhtml">
       <script when="immediate"><![CDATA[
       
-        class drawview extends LzView {
+        // Classes that implement an interface must obey the LZX
+        // tag->class mapping convention
+        class $lzc$class_drawview extends LzView {
+            // Next two are part of the required LFC tag class protocol
             static var tagname = 'drawview';
-            
+            static var attributes = new LzInheritedHash(LzView.attributes);
+            static var uid = 0;
+
             var globalAlpha = 1;
             var lineWidth = 1;
             var lineCap = 'round';
@@ -284,8 +289,8 @@
             }
     
             function _buildcanvas(width, height) {
-                if (drawview.prototype.uid == null) {
-                    drawview.prototype.uid = 0;
+                if ($lzc$class_drawview.uid == null) {
+                    $lzc$class_drawview.uid = 0;
                 }
                 this.beginPath();
     
@@ -306,7 +311,7 @@
                         return;
                     }
                 }
-                this.__id = 'canvas-' + drawview.prototype.uid++;
+                this.__id = 'canvas-' + $lzc$class_drawview.uid++;
                 //Debug.write('_buildcanvas', this.__id, width, height);
     
                 this.__LZcanvas = document.createElement('canvas');
@@ -546,9 +551,12 @@
       <!-- TODO [jgrandy 6/1/2007] <otherwise> should be <when runtime="as2"> but that isn't currently supported -->
       <script when="immediate"><![CDATA[
 
-        class drawview extends LzView {
-
+        // Classes that implement an interface must obey the LZX
+        // tag->class mapping convention
+        class $lzc$class_drawview extends LzView {
+            // Next two are part of the required LFC tag class protocol
             static var tagname = 'drawview';
+            static var attributes = new LzInheritedHash(LzView.attributes);
             
             var globalAlpha = 1;
             var lineWidth = 1;

Modified: openlaszlo/trunk/lps/components/extensions/views/richinputtext.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/views/richinputtext.lzx	2008-04-05 18:26:28 UTC (rev 8564)
+++ openlaszlo/trunk/lps/components/extensions/views/richinputtext.lzx	2008-04-05 23:22:55 UTC (rev 8565)
@@ -22,9 +22,13 @@
 <script when='immediate'>
 <![CDATA[
 
-class richinputtext extends LzInputText {
+// Classes that implement an interface must obey the LZX
+// tag->class mapping convention
+class $lzc$class_richinputtext extends LzInputText {
+  // Next two are part of the required LFC tag class protocol
+  static var tagname = 'richinputtext';
+  static var attributes = new LzInheritedHash(LzInputText.attributes);
 
-  static var tagname = 'richinputtext';
   var defaultformat = null;
 
   //-----------------------------------------------------------------------------

Modified: openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx
===================================================================
--- openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx	2008-04-05 18:26:28 UTC (rev 8564)
+++ openlaszlo/trunk/lps/components/utils/replicator/lazyreplicator.lzx	2008-04-05 23:22:55 UTC (rev 8565)
@@ -1,4 +1,4 @@
-<!-- Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved. -->
+<!-- Copyright 2001-2008 Laszlo Systems, Inc.  All Rights Reserved. -->
 <library>
     <include href="replicator.lzx"/>
     <!-- A replicator which creates as many clones as are necessary to fill in
@@ -14,9 +14,12 @@
   <script when="immediate">
     <![CDATA[
 
-class lazyreplicator extends replicator {
-
+// Classes that implement an interface must obey the LZX
+// tag->class mapping convention
+class $lzc$class_lazyreplicator extends $lzc$class_replicator {
+    // Next two are part of the required LFC tag class protocol
     static var tagname = 'lazyreplicator';
+    static var attributes = new LzInheritedHash($lzc$class_replicator.attributes);
 
     // mostly copied from LzLazyReplicationManager
     // @keywords private

Modified: openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx
===================================================================
--- openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx	2008-04-05 18:26:28 UTC (rev 8564)
+++ openlaszlo/trunk/lps/components/utils/replicator/replicator.lzx	2008-04-05 23:22:55 UTC (rev 8565)
@@ -96,9 +96,12 @@
   <script when="immediate">
     <![CDATA[
 
-class replicator extends LzNode {
-
+// Classes that implement an interface must obey the LZX
+// tag->class mapping convention
+class $lzc$class_replicator extends LzNode {
+    // Next two are part of the required LFC tag class protocol
     static var tagname = 'replicator';
+    static var attributes = new LzInheritedHash(LzNode.attributes);
 
     var pool = true;
 



More information about the Laszlo-checkins mailing list