Author: hqm
Date: 2007-09-08 17:22:45 -0700 (Sat, 08 Sep 2007)
New Revision: 6413
Modified:
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
openlaszlo/branches/wafflecone/test/explicit-replicators/floating-list.lzx
openlaszlo/branches/wafflecone/test/explicit-replicators/lazy-replicator.lzx
openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
openlaszlo/branches/wafflecone/test/explicit-replicators/selection.lzx
openlaszlo/branches/wafflecone/test/explicit-replicators/test-replicator.lzx
Log:
Change 20070908-hqm-0 by [EMAIL PROTECTED] on 2007-09-08 09:30:54 EDT
in /cygdrive/c/users/hqm/openlaszlo/wafflecone3
for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
Summary: fix for lazyreplicator when used with list component
New Features:
Bugs Fixed: LPP-4666
Technical Reviewer: ptw (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Take steps to disable any layouts in the container before instantiating
the clones
Note, also in this patch is changing of xpath attribute to string type (
under review in another patch)
Tests:
Modified:
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
===================================================================
---
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
2007-09-08 13:40:05 UTC (rev 6412)
+++
openlaszlo/branches/wafflecone/lps/components/utils/replicator/lazyreplicator.lzx
2007-09-09 00:22:45 UTC (rev 6413)
@@ -33,8 +33,23 @@
// @keywords private
function construct (p,a) {
super.construct( p, a );
+
+ // TODO [hqm 2007 09] Lock the parent layout so it can't mess
+ // up our placement of clones. The implicit lazy
+ // repl. manager only wraps this inside of _adjustVisibleClones
+ // but I want to be sure any parent container layout is really
+ // turned off before any views get instantiated, and stays off
+ // all the time, it can only cause trouble.
+ //
+ var p = this.container;
+ for (var l in p.layouts) {
+ p.layouts[l].lock();
+ }
+
+
this.__emptyArray = [];
this.clonedel = new LzDelegate( this, '__adjustVisibleClones');
+
}
// @keywords private
@@ -49,6 +64,7 @@
// @keywords private
function __adjustVisibleClones () {
+
if ( ! this.nodes ) {
while ( this.clones.length ) this.poolClone( this.clones.pop() );
return;
@@ -56,7 +72,6 @@
if ( !this.replicatedsize ) this._setSize();
-
var sizeAxis = this._sizes[ this.axis ];
if ( this.nodes.length != null ){
this._lastNodesLength = this.nodes.length;
@@ -144,8 +159,8 @@
if ( cl ){
this.clones[ i ] = cl;
- cl.setAttribute( this.axis ,
- ( i + newstart ) * this.replicatedsize );
+ var val = ( i + newstart ) * this.replicatedsize ;
+ cl.setAttribute( this.axis , val);
this.unbind( cl );
this.bind( cl, newstart + i );
} else {
@@ -173,6 +188,44 @@
}
+ // @keywords private
+ function createChildren (c) {
+ this.replicated = c.pop();
+
+ // TODO [hqm 2007 09] I need to set ignorelayout option before
+ // the clone gets instantiated, otherwise it might get placed
+ // by the parent layout during construction, which we don't
+ // want to happen.
+ var attrs;
+ if (this.replicated.attrs) {
+ attrs = this.replicated.attrs;
+ } else {
+ attrs = {};
+ this.replicated.attrs = attrs;
+ }
+
+ if (attrs.options) {
+ attrs.options.ignorelayout = true;
+ } else {
+ attrs.options = {ignorelayout: true};
+ }
+
+ //Debug.write( 'replicated', replicated );
+ if ( c.length ) {
+ Debug.warn("%s: only a single child view is replicated", this);
+ this.container.createChildren( c );
+ } else {
+ this.__LZinstantiationDone();
+ }
+ }
+
+ // @keywords private overrides replicator.getClone()
+ function getClone () {
+ var cl = super.getClone();
+ cl.setOption( 'ignorelayout', true );
+ return cl;
+ }
+
// @keywords private
function _setSize () {
var c = this.getClone();
@@ -211,9 +264,19 @@
this.poolClone( cl );
}
+ //cl.setOption( 'ignorelayout', true );
return cl;
}
+
+ function destroy ( ) {
+ var p = this.container;
+ for (var l in p.layouts) {
+ p.layouts[l].unlock();
+ }
+ super.destroy.apply(this, arguments);
+ }
+
}
]]>
Modified:
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
===================================================================
---
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
2007-09-08 13:40:05 UTC (rev 6412)
+++
openlaszlo/branches/wafflecone/lps/components/utils/replicator/replicator.lzx
2007-09-09 00:22:45 UTC (rev 6413)
@@ -47,7 +47,7 @@
<!--- Compute nodes from this dataset -->
<attribute name="dataset" />
<!--- Compute nodes from this xpath query against the specified dataset -->
- <attribute name="xpath" />
+ <attribute name="xpath" type="string"/>
<!--- Insert a node in existing list of elements.
@param Number idx: index to insert element
@@ -151,6 +151,7 @@
// @keywords private
function createChildren (c) {
this.replicated = c.pop();
+
//Debug.write( 'replicated', replicated );
if ( c.length ) {
Debug.warn("%s: only a single child view is replicated", this);
@@ -258,6 +259,7 @@
// @keywords private
function _makeClone () {
+
var v = this.container.makeChild( this.replicated );
v.setAttribute( "clonenumber", null );
// emulate datapath behavior
Modified:
openlaszlo/branches/wafflecone/test/explicit-replicators/floating-list.lzx
===================================================================
--- openlaszlo/branches/wafflecone/test/explicit-replicators/floating-list.lzx
2007-09-08 13:40:05 UTC (rev 6412)
+++ openlaszlo/branches/wafflecone/test/explicit-replicators/floating-list.lzx
2007-09-09 00:22:45 UTC (rev 6413)
@@ -9,7 +9,7 @@
<floatinglist id="flist" dataoption="pooling" visible="true"
multiselect="false" width="400" layout="axis: y">
- <replicator name="replicator" dataset="ds" xpath="'/item/@name'">
+ <replicator name="replicator" dataset="ds" xpath="/item/@name">
<attribute name="mask" when="once" value="parent.interior"/>
<attribute name="container" when="once" value="parent.interior.content"/>
<textlistitem width="100%" height="20"/>
Modified:
openlaszlo/branches/wafflecone/test/explicit-replicators/lazy-replicator.lzx
===================================================================
---
openlaszlo/branches/wafflecone/test/explicit-replicators/lazy-replicator.lzx
2007-09-08 13:40:05 UTC (rev 6412)
+++
openlaszlo/branches/wafflecone/test/explicit-replicators/lazy-replicator.lzx
2007-09-09 00:22:45 UTC (rev 6413)
@@ -18,7 +18,7 @@
<view name="container">
<lazyreplicator name="lzreplicator"
dataset="mydata"
- xpath="'/product/@color'" >
+ xpath="/product/@color" >
<text width="200" bgcolor="#cccccc"
onclick="Debug.inspect(this)"/>
</lazyreplicator>
</view>
Modified:
openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
===================================================================
--- openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
2007-09-08 13:40:05 UTC (rev 6412)
+++ openlaszlo/branches/wafflecone/test/explicit-replicators/replicator.lzx
2007-09-09 00:22:45 UTC (rev 6413)
@@ -20,7 +20,7 @@
<simplelayout axis="y" spacing="2" />
<replicator name="foo"
dataset="mydata"
- xpath="'/product/'">
+ xpath="/product/">
<view bgcolor="red" height="23">
<handler name="onclick">
this.data.parentNode.removeChild(this.data);
Modified: openlaszlo/branches/wafflecone/test/explicit-replicators/selection.lzx
===================================================================
--- openlaszlo/branches/wafflecone/test/explicit-replicators/selection.lzx
2007-09-08 13:40:05 UTC (rev 6412)
+++ openlaszlo/branches/wafflecone/test/explicit-replicators/selection.lzx
2007-09-09 00:22:45 UTC (rev 6413)
@@ -42,7 +42,7 @@
resizable="true" title="explicit lazy replicator">
<view>
<dataselectionmanager name="selman" id="dsel"/>
- <lazyreplicator id="elr" dataset="testdata" xpath="'fibs/fib'">
+ <lazyreplicator id="elr" dataset="testdata" xpath="fibs/fib">
<text width="100">
<attribute name="selected" value="false"/>
<attribute name="bgcolor"
@@ -98,7 +98,7 @@
<view>
<selectionmanager name="selman" />
<simplelayout axis="y" spacing="0" />
- <replicator id="esr" dataset="testdata" xpath="'/fibs/fib'">
+ <replicator id="esr" dataset="testdata" xpath="/fibs/fib">
<text width="100">
<attribute name="selected" value="false"/>
<attribute name="bgcolor"
Modified:
openlaszlo/branches/wafflecone/test/explicit-replicators/test-replicator.lzx
===================================================================
---
openlaszlo/branches/wafflecone/test/explicit-replicators/test-replicator.lzx
2007-09-08 13:40:05 UTC (rev 6412)
+++
openlaszlo/branches/wafflecone/test/explicit-replicators/test-replicator.lzx
2007-09-09 00:22:45 UTC (rev 6413)
@@ -42,7 +42,7 @@
resizable="true" title="explicit lazy replicator">
<list width="${immediateparent.width}" height="${immediateparent.height}">
<dataselectionmanager name="selman" id="dsel"/>
- <lazyreplicator id="elr" dataset="testdata" xpath="'fibs/fib'">
+ <lazyreplicator id="elr" dataset="testdata" xpath="fibs/fib">
<text width="100">
<attribute name="selected" value="false"/>
<attribute name="bgcolor"
@@ -98,7 +98,7 @@
<list width="${immediateparent.width}" height="${immediateparent.height}">
<selectionmanager name="selman" />
<simplelayout axis="y" spacing="0" />
- <replicator id="esr" dataset="testdata" xpath="'/fibs/fib'">
+ <replicator id="esr" dataset="testdata" xpath="/fibs/fib">
<text width="100">
<attribute name="selected" value="false"/>
<attribute name="bgcolor"
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins