[Laszlo-dev] explicit replicator bug notes

Henry Minsky henry.minsky at gmail.com
Fri Sep 7 08:35:50 PDT 2007


Hmm, more info, the bug only occurs when the container is a <list>
component; the
case where the parent is a plain old view seems to scroll fine and instantiate
the nodes in order.

See test case below: the left side window works fine, the right side
has the bug.
So it seems the <list>  is trying to manage  the view order and
scrolling at the same time as the replicator?

<!-- Copyright 2001-2007 Laszlo Systems, Inc.  All Rights Reserved. -->
<canvas debug="true" proxied="false">
  <debug height="90%" width="40%" x="55%" y="5%" />

  <dataset name="testdata">
    <fibs>
      <fib value="2" />
      <fib value="3" />
      <fib value="5" />
      <fib value="8" />
      <fib value="13" />
      <fib value="21" />
      <fib value="34" />
      <fib value="55" />
      <fib value="89" />
      <fib value="144" />
      <fib value="233" />
      <fib value="377" />
      <fib value="610" />
      <fib value="987" />
      <fib value="1597" />
      <fib value="2584" />
      <fib value="4181" />
      <fib value="6765" />
      <fib value="10946" />
      <fib value="17711" />
      <fib value="28657" />
      <fib value="46368" />
      <fib value="75025" />
      <fib value="121393" />
      <fib value="196418" />
      <fib value="317811" />
      <fib value="514229" />
    </fibs>
  </dataset>

  <text multiline="true">
    Compares selection behavior across replicators where the parent is
a view (had problems with parent being a list.)  Be sure to test range
selection and scrolling at various speeds.
  </text>

  <window width="20%" height="20%" x="5%" y="5%" name="explicitlazyrepltest"
          resizable="true" title="explicit lazy replicator">
    <view>
      <dataselectionmanager name="selman" id="dsel"/>
      <lazyreplicator id="elr" dataset="testdata" xpath="fibs/fib">
        <text width="100">
          <attribute name="selected" value="false"/>
          <attribute name="bgcolor"
                     value="${selected ? 0xCCDDEE : null }"/>
          <attribute name="index" value="$path{'position()'}" />
          <attribute name="value" value="$path{'@value'}" />
          <method name="applyData">
            this.format('%s: %d', this.index, this.value);
          </method>
          <handler name="onclick">
            //Debug.write(parent.selman.isSelected( this ),
parent.selman.toggle);
            parent.selman.select( this );
          </handler>
          <method name="setSelected" args="value">
            this.selected = value;
            this.onselected.sendEvent(value);
          </method>
        </text>
      </lazyreplicator>
    </view>
    <scrollbar/>
  </window>

  <window width="20%" height="20%" x="30%" y="5%"
name="explicitlazyrepltest_sel"
          resizable="true" title="explicit lazy replicator with LIST parent">
    <list width="${immediateparent.width}" height="${immediateparent.height}">
      <dataselectionmanager name="selman" id="dsel2"/>
      <lazyreplicator id="elr2" dataset="testdata" xpath="fibs/fib">
        <text width="100">
          <attribute name="selected" value="false"/>
          <attribute name="bgcolor"
                     value="${selected ? 0xCCDDEE : null }"/>
          <attribute name="index" value="$path{'position()'}" />
          <attribute name="value" value="$path{'@value'}" />
          <method name="applyData">
            this.format('%s: %d', this.index, this.value);
          </method>
          <handler name="onclick">
            Debug.write(parent.selman.isSelected( this ), parent.selman.toggle);
            parent.selman.select( this );
          </handler>
          <method name="setSelected" args="value">
            this.selected = value;
            this.onselected.sendEvent(value);
          </method>
        </text>
      </lazyreplicator>
      <!-- FIXME: [2007-08-10 ptw] (LPP-4484) -->
      <!-- NOT WORKING scrollbar id="lsb" scrolltarget="immediateparent" -->
    </list>
  </window>


</canvas>
<!-- Copyright 2007 Laszlo Systems, Inc.  All Rights Reserved. -->


On 9/7/07, Henry Minsky <henry.minsky at gmail.com> wrote:
> I was poking at the lazy explicit replicator bug (LPP-4666) and
> noticed the following two issues:
>
> [1] I noticed in a backtrace that _adjustVisibleClones is getting called
> recursively, which doesn't seem like a good idea, as views get inserted in the
> wrong order somehow.
>
> I tried doing this, commenting out the explicit call to
> __adjustVisibleClones in replicator.setNodes:
>
>     function setNodes (n) {
>         this.nodes = n;
>         //this.__adjustVisibleClones();
>         this.setAttribute("replicatedsize", this.clones.length == 0
>                      ? 0
>                      :
> this.clones[this.clones.length-1][this._sizes[this.axis]]);
>         if (this.onnodes.ready) { this.onnodes.sendEvent(); }
>     }
>
>
> I figured that __adjustVisibleClones would get called later anyway,
> and it does, and the cloned views come in in the proper order for some
> reason. It gets called twice, once with clones list of zero length,
> and once with a length of 7, which seems to do the right thing.
> Here's the backtrace of it getting called I think from an ony event
> from a scrollbar after canvas init.
>
> «Backtrace(15)#199| __adjustVisibleClones <- sendEvent <- setY <-
> setAttribute <- _showEnabl...» {
> length: 15
>    0: kernel/LzIdleKernel.lzs#29/16 @lfc/kernel/LzIdleKernel.lzs#32
>    1: __idleupdate @lfc/services/LzIdle.lzs#103
>    2: sendEvent @lfc/events/LaszloEvents.lzs#437
>    3: checkQ @lfc/services/LzInstantiator.lzs#152
>    4: makeSomeViews @lfc/services/LzInstantiator.lzs#212
>    5: __LZinstantiationDone @lfc/views/LaszloCanvas.lzs#422
>    6: okToInit @lfc/views/LaszloCanvas.lzs#431
>    7: __LZcallInit @lfc/views/LaszloCanvas.lzs#491
>    8: sendEvent @lfc/events/LaszloEvents.lzs#437
>    9: _showEnabled @lz/vscrollbar.lzx#-1
>   10: _showEnabled @base/basescrollbar.lzx#345
>   11: setAttribute @lfc/core/LzNode.lzs#911
>   12: setY @lfc/views/LaszloView.lzs#1334
>   13: sendEvent @lfc/events/LaszloEvents.lzs#437
>   14: __adjustVisibleClones @utils/replicator/lazyreplicator.lzx#52
> }«Backtrace(15)#199| __adjustVisibleClones <- sendEvent <- setY <-
> setAttribute <- _showEnabl...»
> lzx>
>
>
> [2] But scrolling is still screwed up, if you scroll gaps appear, and
> scrolling back
> things come in in random order more or less.
>
> + Looking at the subviews array and clones list, there are the right
> number of clones, with the right bindings for the most part, but
> they seem to have the wrong Y positions, so they cannot be seen.
>
> + There is a reference in adjustvisibleClones to "this.totalsize", but
> nobody is computing this.totalsize?
>
> Probably the y offset calculations are just wrong.
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>


-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com



More information about the Laszlo-dev mailing list