[Laszlo-checkins] r13601 - openlaszlo/trunk/lps/components/utils/diagnostic/inspector

bargull@openlaszlo.org bargull at openlaszlo.org
Sun Apr 5 01:13:49 PDT 2009


Author: bargull
Date: 2009-04-05 01:13:45 -0700 (Sun, 05 Apr 2009)
New Revision: 13601

Modified:
   openlaszlo/trunk/lps/components/utils/diagnostic/inspector/inspector.lzx
Log:
Change 20090405-bargull-S0e by bargull at dell--p4--2-53 on 2009-04-05 00:19:54
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix inspector for swf9

New Features:

Bugs Fixed: LPP-7846 (inspector has warnings (and is broken in swf9))

Technical Reviewer: sallen
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
- clear globalMouseDel delegate in toggletext on blur to avoid mem-leaks
- default item#isview to false (so I won't ever again make the canvas invisible and wonder what did happen ;-)
- use the item#isview for state 
- default subnodes/subviews to empty arrays
- use the "modern" way for instanceof tests => 'is lz.view'
- calling destroy() on a subview changes the 'subviews'-array so be careful when removing the "children"-subviews
- remove the global "id" for the inspector instance so it won't globber the global namespace
- and generate prettier names for item's text

    

Tests:
inspector-example.lzx works in swf9



Modified: openlaszlo/trunk/lps/components/utils/diagnostic/inspector/inspector.lzx
===================================================================
--- openlaszlo/trunk/lps/components/utils/diagnostic/inspector/inspector.lzx	2009-04-05 08:00:05 UTC (rev 13600)
+++ openlaszlo/trunk/lps/components/utils/diagnostic/inspector/inspector.lzx	2009-04-05 08:13:45 UTC (rev 13601)
@@ -61,6 +61,7 @@
                                                   "onmousedown" );
                 </handler>
                 <handler name="onblur">
+                    this.globalMouseDel.unregisterAll();
                     parent.setAttribute( 'editing' , false );
                 </handler>
                 <method name="checkMouse" args="who">
@@ -96,7 +97,7 @@
         <attribute name="open" value="false"/>
         <attribute name="opendefaultplacement" value="true"/>
         <attribute name="showcomponenthelpers" value="false"/>
-        <attribute name="isview" value="true" type="boolean"/>
+        <attribute name="isview" value="false" type="boolean"/>
         <simplelayout/>
         <view layout="axis:x; spacing:4">
             <text text="..." onclick="Debug.write(classroot.reference)"/>
@@ -107,12 +108,40 @@
                 onclick="classroot.isview ?
                          classroot.reference.setAttribute('visible', !classroot.reference['visible'])
                          : false"/>
-            <text text="${classroot.reference.name == null ?
-                    classroot.reference.constructor.tagname : classroot.reference.name}"
+            <text
                 onclick="classroot.toggle()"
                 onmouseover="parent.setAttribute('bgcolor', 0xddddff)"
-                onmouseout="parent.setAttribute('bgcolor', null)"/>
-            <state applied="${classroot.reference instanceof lz.view}">
+                onmouseout="parent.setAttribute('bgcolor', null)">
+                <handler name="oninit" ><![CDATA[
+                    var ref = classroot.reference;
+                    var idname = '';
+                    if (ref.id != null) {
+                        idname = '#' + ref.id;
+                    } else if (ref.name != null) {
+                        idname = ref.name;
+                    }
+                    if (ref.constructor.hasOwnProperty('tagname')) {
+                        var text = '&lt;' + ref.constructor.tagname + '&gt;';
+                    } else {
+                        if ($as3) {
+                            // '[class xxx]'
+                            var cname = ref.constructor.toString();
+                            cname = cname.substring('[class '.length, cname.length - 1);
+                        } else {
+                            var cname = ref.constructor['classname'] || '';
+                        }
+                        if (cname.indexOf('Lz') == 0) {
+                            if (lz[cname.substring(2)] === ref.constructor) {
+                                // c.f. lz.ReplicationManager
+                                cname = 'lz.' + cname.substring(2);
+                            }
+                        }
+                        var text = cname;
+                    }
+                    this.setAttribute('text', idname ? text + ' (' + idname + ')' : text);
+                ]]></handler>
+            </text>
+            <state applied="${classroot.isview}">
                 <colorbox y="1" obj="classroot.reference"/>
                 <propedit text="${classroot.reference.x}" obj="classroot.reference" prop="x"/>
                 <propedit text="${classroot.reference.y}" obj="classroot.reference" prop="y"/>
@@ -123,7 +152,7 @@
         <view name="children" layout="class:simplelayout"/>
         <method name="toggle"> <![CDATA[
             if (!open) {
-                var nodes = this.reference.subnodes;
+                var nodes = this.reference.subnodes || [];
 
                 if (this.root.opendefaultplacement) {
                      if (this.reference.defaultplacement != null) {
@@ -147,12 +176,13 @@
                     if (show) new lz.item(this.children, 
                                            {reference: nodes[i],
                                             root:this.root,
-                                            isview: nodes[i] instanceof(LzView)});
+                                            isview: nodes[i] is lz.view});
                 }
                 setAttribute('open', true);
             } else {
-                for (var i=0, len=this.children.subviews.length; i<len; i++) {
-                    this.children.subviews[i].destroy();
+                var sviews = this.children.subviews || [];
+                while (sviews.length) {
+                    sviews[0].destroy();
                 }
                 setAttribute('open', false);
             }
@@ -176,6 +206,6 @@
         </view>
     </class>
 
-    <inspector id="i"/>
+    <inspector />
 
 </library>



More information about the Laszlo-checkins mailing list