[Laszlo-checkins] r12643 - in openlaszlo/trunk/docs/src: nav reference/navbuilder

bargull@openlaszlo.org bargull at openlaszlo.org
Sun Jan 25 03:24:27 PST 2009


Author: bargull
Date: 2009-01-25 03:24:23 -0800 (Sun, 25 Jan 2009)
New Revision: 12643

Modified:
   openlaszlo/trunk/docs/src/nav/nav.lzx
   openlaszlo/trunk/docs/src/reference/navbuilder/index-frames.html.proto
Log:
Change 20090124-bargull-UE1 by bargull at dell--p4--2-53 on 2009-01-24 17:34:40
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: proper colors for nav and make search-control work again

New Features:

Bugs Fixed: LPP-7674

Technical Reviewer: hqm
QA Reviewer: ptw
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
"fgcolor" doesn't convert color-names, instead use fixed number (e.g. 0x0000FF instead of "blue"). (see LPP-7336)
With the last change, the tree-control will only build-up lazily, that improved start-up, but the search-control doesn't work anymore.
So I needed to refactor "findNext()", now it works on data-elements ("datasel" attribute is used to mark the search results). I also added a few more comments, so it's more obvious how the search should work.

(And I removed the two "Show/Hide Examples" button, they weren't visible and I didn't even find a javascript function named "lzSetShowInlineExamples".)

And as a last change, I added "lzt=html" to the reference html-page, so the nav.lzx application won't be loaded with the dev-console.
(If you go to "http://openlaszlo.org/lps4.2/docs/reference/" and inspect the page with firebug, you can see that the dev-console is also loaded.)
    

Tests:



Modified: openlaszlo/trunk/docs/src/nav/nav.lzx
===================================================================
--- openlaszlo/trunk/docs/src/nav/nav.lzx	2009-01-25 09:00:05 UTC (rev 12642)
+++ openlaszlo/trunk/docs/src/nav/nav.lzx	2009-01-25 11:24:23 UTC (rev 12643)
@@ -20,15 +20,23 @@
 
   <!-- Create linktree so we can keyboard navigate. -->
   <class name="linktree" extends="basetree" isleaf="true" recurse="false" >
+      <attribute name="datasel" value="$path{'@datasel'}" type="boolean" />
+      <setter name="datasel" args="dsel" >
+          this.datasel = dsel;
+          this.setAttribute('selected', dsel);
+          if (dsel) {
+              this.changeFocus(null);
+          }
+      </setter>
       <method name="keySelect">
           super.keySelect();
           lz.Browser.loadURL(this.datapath.xpathQuery('@href'), canvas.target);
       </method>
-      <text text="${parent.text}" placement="item" name="t" resize="true" 
+      <text text="${parent.text}" placement="item"
             onmouseover="setAttribute('fgcolor', classroot.style['texthilitecolor'])"
-            onmouseout="setAttribute('fgcolor',   classroot.selected 
+            onmouseout="setAttribute('fgcolor', classroot.selected 
                                                 ? 'blue'
-                                                : (   classroot.focused 
+                                                : (classroot.focused 
                                                     ? classroot.style['texthilitecolor']
                                                     : classroot.style['textcolor'] ))"
             fgcolor="${classroot.selected
@@ -42,7 +50,7 @@
           <handler name="onclick">
               lz.Browser.loadURL(classroot.datapath.xpathQuery('@href'), canvas.target);
               classroot.setAttribute('selected', true);
-              classroot.changeFocus(classroot);
+              classroot.changeFocus(null);
           </handler>
       </text>
   </class>
@@ -69,46 +77,66 @@
             onclick="lz.Browser.loadURL('ref.preface.html', canvas.target)"/>
       <view name="treeparent" clip="true" width="${parent.width - 20}"
             height="${Math.max(0,parent.parent.height - parent.search.height - 80)}">
-        <attribute name="cgroup" value="0"/>
-        <attribute name="cleaf" value="0"/>
-        <attribute name="lastfound" value="null"/>
-        <method name="findNext" args="tok">
-            <![CDATA[ 
-            if ( tok == '' || tok == null ) return;
-            tok = tok.toLowerCase();
-            var sgroup = cgroup;
-            var sleaf = cleaf;
-            var canwrap = true;
-            if (this.lastfound) {
-              this.lastfound.setAttribute( 'fgcolor', lz.colors.black );
-              this.lastfound = null;
-            }
-            while( !this.lastfound && 
-                    ( canwrap || ( sgroup > cgroup ) ||
-                      (sgroup == cgroup && sleaf > cleaf) ) ){
+        <attribute name="lastCategory" value="0" type="number" />
+        <attribute name="lastItem" value="-1" type="number" />
+        <attribute name="lastData" value="null" />
+        <method name="findNext" args="tok"><![CDATA[
+            if (tok) {
+                tok = tok.toLowerCase();
 
-                var cgs = top.children.subviews[ cgroup ];
-                var curr = cgs.children.subviews[ cleaf ];
-
-                if ( curr.text.toLowerCase().indexOf( tok )  > -1 ){
-                    //found one!
-                    cgs.setAttribute( "open", true );
-                    cgs.changeFocus(null);
-                    curr.setAttribute( "fgcolor", lz.colors.blue );
-                    curr.changeFocus(null);
-                    this.lastfound = curr;
-                } 
-
-                if ( ++this.cleaf == cgs.children.subviews.length ){
-                    this.cleaf = 0;
-                    if ( ++this.cgroup == top.children.subviews.length ){
-                        canwrap = false;
-                        this.cleaf = this.cgroup = 0;
+                var afterLast = true;
+                var categories = tocdata.getFirstChild().getElementsByTagName("category");
+                for (var i = this.lastCategory; true; ) {
+                    var items = categories[i].getElementsByTagName("item");
+                    if (this.lastCategory == i) {
+                        // same category as last matched category
+                        if (afterLast) {
+                            // check only entries after last match
+                            var startAt = this.lastItem + 1;
+                            var endAt = items.length;
+                        } else {
+                            // check only entries before last match
+                            var startAt = 0;
+                            var endAt = this.lastItem;
+                        }
+                    } else {
+                        // search in full range
+                        var startAt = 0;
+                        var endAt = items.length;
                     }
+                    for (var j = startAt; j < endAt; ++j) {
+                        var title = items[j].getAttr("title") || "";
+                        if (title.toLowerCase().indexOf(tok) > -1) {
+                            if (this.lastData) {
+                                // clear last match
+                                this.lastData.setAttr("datasel", "false");
+                            }
+                            // memorize new match
+                            this.lastCategory = i;
+                            this.lastItem = j;
+                            this.lastData = items[j];
+                            var catTree = this.top.children.subviews[i];
+                            catTree.setAttribute("open", true);
+                            catTree.changeFocus(null);
+                            items[j].setAttr("datasel", "true");
+                            return;
+                        }
+                    }
+                    if (!afterLast && i == this.lastCategory) {
+                        // found no entries, stop search
+                        return;
+                    } else {
+                        i += 1;
+                        if (i == categories.length) {
+                            // restart at 0
+                            i = 0;
+                            // this time check only entries before last match
+                            afterLast = false;
+                        }
+                    }
                 }
             }
-            ]]>
-        </method>
+        ]]></method>
 
         <tree datapath="tocdata:/toc" showroot="false" name="top" autoscroll="true"
               text="$path{'@title'}">
@@ -127,10 +155,6 @@
         <wheelscrollbar/>
       </view>
       <simplelayout spacing="8"/>
-      
-      <button onclick="lz.Browser.loadURL('javascript:lzSetShowInlineExamples(true)')">Show Examples</button>
-      <button onclick="lz.Browser.loadURL('javascript:lzSetShowInlineExamples(false)')">Hide Examples</button>
-
     </tabpane>
     <tabpane width="${parent.width}">
       Classes

Modified: openlaszlo/trunk/docs/src/reference/navbuilder/index-frames.html.proto
===================================================================
--- openlaszlo/trunk/docs/src/reference/navbuilder/index-frames.html.proto	2009-01-25 09:00:05 UTC (rev 12642)
+++ openlaszlo/trunk/docs/src/reference/navbuilder/index-frames.html.proto	2009-01-25 11:24:23 UTC (rev 12643)
@@ -5,10 +5,10 @@
 <TITLE>OpenLaszlo @VERSIONID@ Reference</TITLE>
 </HEAD>
 <FRAMESET cols="240px, *" >
-  <FRAME name="lzxdocnavframe" src="nav.lzx?target=content" scrolling="no"/>
+  <FRAME name="lzxdocnavframe" src="nav.lzx?lzt=html&target=content" scrolling="no"/>
   <FRAME name="content" src="ref.preface.html" />
 </FRAMESET>
 </HTML>
 
-<!-- Copyright 2007, 2008 Laszlo Systems -->
+<!-- Copyright 2007-2009 Laszlo Systems -->
 



More information about the Laszlo-checkins mailing list