[Laszlo-checkins] r6362 - in openlaszlo/branches/wafflecone: WEB-INF/lps/lfc/helpers test/data
pbr@openlaszlo.org
pbr at openlaszlo.org
Wed Sep 5 09:53:53 PDT 2007
Author: pbr
Date: 2007-09-05 09:53:49 -0700 (Wed, 05 Sep 2007)
New Revision: 6362
Added:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/LzDataSelectionManager.lzs
Modified:
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/Library.lzs
openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs
openlaszlo/branches/wafflecone/test/data/selectionmanager.lzx
Log:
Change 20070903-sallen-6 by sallen at sallen-new on 2007-09-03 16:04:47 PDT
in /cygdrive/c/laszlo/svn/openlaszlo/branches/wafflecone
for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone
Summary: split selectionmanager and dataselectionmanager into two files
(for readability) and fixed bug in test file
Bugs Fixed: LPP-4638 selectionmanager test broken
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Tests:
ran test/data/selectionmanager.lzx
Files:
M test/data/selectionmanager.lzx
A WEB-INF/lps/lfc/helpers/LzDataSelectionManager.lzs
M WEB-INF/lps/lfc/helpers/Library.lzs
M WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/20070903-sallen-6.tar
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/Library.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/Library.lzs 2007-09-05 12:53:39 UTC (rev 6361)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/Library.lzs 2007-09-05 16:53:49 UTC (rev 6362)
@@ -1,7 +1,7 @@
/**
* Library.lzs
*
- * @copyright Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved.
+ * @copyright Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved.
* Use is subject to license terms.
*
* @access private
@@ -9,6 +9,7 @@
#include "helpers/LzFont.lzs"
#include "helpers/LzSelectionManager.lzs"
+#include "helpers/LzDataSelectionManager.lzs"
#include "helpers/LzCommand.lzs"
if ($as2) {
Added: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/LzDataSelectionManager.lzs
Property changes on: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/LzDataSelectionManager.lzs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs 2007-09-05 12:53:39 UTC (rev 6361)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs 2007-09-05 16:53:49 UTC (rev 6362)
@@ -270,182 +270,4 @@
} // End of LzSelectionManager
-/**
- * Implements same functionality as a normal selection manager, but without
- * storing view references, which become invalid as views created by a datapath
- * that uses lazy replication do. Does this by storing subview numbers.
- *
- * @lzxname dataselectionmanager
- */
-class LzDataSelectionManager extends LzSelectionManager {
-
-/** @access private
- * @modifiers override
- */
-static var tagname = 'dataselectionmanager';
-
-/**
- * Makes the given view selected
- * @access protected
- * @param LzView o: The view to be selected
- */
-function makeSelected ( o ){
- var so = o.datapath.p;
- if ( this.manager == null ) this.manager = o.cloneManager;
- if ( so.sel ) return;
- so.sel = true;
- this.selected.push( so );
- o.datapath[ this.sel ]( true );
-
- if ( this.manager == null ){
- //just one "clone", mark it!
- this.singleClone = o;
- }
-}
-
-/**
- * Unselect the given view
- * @param LzView o: The view to be unselected
- */
-function unselect ( o ){
- if ( this.manager == null ) this.manager = o.cloneManager;//try to get a cloneManager
-
- var so = o.datapath.p;
- so.sel = false;
- for ( var i = this.selected.length-1 ; i >= 0; i-- ){
- if ( this.selected[ i ] == so ) {
- this.selected.splice( i , 1 );
- break;
- }
- }
- o.datapath[ this.sel ]( false );
-
- if ( o == this.singleClone ) this.singleClone = null;//clear "singleClone"
-}
-
-/**
- * Selects the range between the datapath that was lastselected and the newly
- * selected view
- * @access private
- * @param LzDataPath s: The datapath that was at top of the selection stack
- * @param LzView e: The newly selected view
- */
-function selectRange ( s , e ){
- if ( this.manager == null ){
- this.manager = e.cloneManager;
-
- //maybe we've got now clones
- if ( this.manager == null ){
- //still no clones?
- //so it's nothing to do, just hope so...
- if ( $debug ){
- Debug.write( "selectRange failed, no clones" );
- }
- return;
- }
- }
-
- var nodes = this.manager.nodes;
-
- var st = -1;
- var en = -1;
- var i = 0;
- var ennode = e.datapath.p;
- //find the start and end in the sort array of parents
-
- while ( ( st == -1 || en == -1 ) && i < nodes.length ){
- if ( nodes[ i ] == s ){
- st = i;
- }
- if ( nodes[ i ] == ennode ){
- en = i;
- }
- i++;
- }
-
-
- var dir = st > en ? -1 : 1;
-
- this.clearSelection();
-
- this.lastRange = s;
-
- //couldn't find -- wierd
- if ( st == -1 || en == -1 ) return;
-
- for ( var i = st; i != en + dir; i += dir ) {
- var p = nodes[ i ];
- p.sel = true;
- this.selected.push( p );
- this.__LZsetSelected( p, true );
- }
-}
-
-/**
- * Returns a list of datapointers, which point to the selected records
- * @return Array: A list of datapointers
- */
-function getSelection (){
- var r = [];
- for ( var i = 0; i < this.selected.length ; i++ ){
- r.push( new LzDatapointer( null , {pointer : this.selected[i] }));
- }
- return r;
-}
-
-/**
- * Unselects everything that is currently selected and clears the selection
- * list
- *
- */
-function clearSelection ( ){
- while ( this.selected.length ){
- var p = this.selected.pop();
- p.sel = false;
- this.__LZsetSelected( p , false );
- }
- this.lastRange = null;
-}
-
-/**
- * Tests whether the given view is selected
- * @param LzView o: The view to test for selectedness
- * @return Boolean: The selectedness of the input object.
- */
-function isSelected ( o){
- if ( this.manager == null ) this.manager = o.cloneManager;//try to get a cloneManager
-
- return o.datapath.p.sel;
-}
-
-/**
- * sets the selected attribute of the data, if there is a clone, it will
- * call setselected on the clone
- * @param LzDataElement p: the node we want to set
- * @param Boolean val: new value for selected
- * @access private
- */
-function __LZsetSelected ( p, val ){
- if ( this.manager != null ){
- var cl = this.manager.getCloneForNode( p, true );
- if ( cl ){
- cl.datapath[this.sel]( val );
- } else { // no clone on screen
- p.sel = val;
- }
- } else {//no clones
- //if caller is selectRange, then "this.manager" won't be "null"
- //but if caller is clearSelection, "this.manager" could be "null", but then "val" is definitely "false"
- if ( !val ){
- if ( this.singleClone != null && this.singleClone.datapath.p == p ){
- this.singleClone.datapath[this.sel]( false );
- this.singleClone = null;
- return;//job is done...
- }
- }
- p.sel = val;//default action
- }
-}
-
-} // End of LzDataSelectionManager
Modified: openlaszlo/branches/wafflecone/test/data/selectionmanager.lzx
===================================================================
--- openlaszlo/branches/wafflecone/test/data/selectionmanager.lzx 2007-09-05 12:53:39 UTC (rev 6361)
+++ openlaszlo/branches/wafflecone/test/data/selectionmanager.lzx 2007-09-05 16:53:49 UTC (rev 6362)
@@ -1,19 +1,25 @@
-<canvas width="200" height="200">
+<canvas width="500" height="300">
<dataset name="mydata" type="http" src="http:../resources/xml/800_forms.xml" request="true"/>
+ <text x="10" width="${canvas.width-20}" multiline="true">
+ Click on an item in the list, it should appear yellow to indicate that the
+ dataselectionmanager is working. Selecting another item should de-select the first.
+ Scrolling should retain selection.
+ </text>
+
<class name="selectme" onclick="immediateparent.selector.select(this)"
height="17" width="100" bgcolor="white">
<text datapath="text()"/>
- <method name="setselected" args="isselected">
+ <method name="setSelected" args="isselected">
if (isselected) setAttribute('bgcolor', yellow);
else setAttribute('bgcolor', white);
</method>
</class>
- <view height="70" clip="true">
+ <view y="50" height="70" clip="true">
<view>
<dataselectionmanager name="selector"/>
- <selectme>
+ <selectme id="v">
<datapath xpath="mydata:/resultset/row/reporter/" replication="lazy"/>
</selectme>
<simplelayout/>
@@ -21,4 +27,7 @@
<scrollbar/>
</view>
</canvas>
-
+<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
+* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Use is subject to license terms. *
+* X_LZ_COPYRIGHT_END ****************************************************** -->
More information about the Laszlo-checkins
mailing list