On Mon, Apr 5, 2010 at 13:40, Bruce Bockius <[email protected]> wrote:
> I have a question about TreeVirtual and the changeSelection event.
>
>
>
> Please see http://demo.qooxdoo.org/devel/playground/#gist%3D356624
>
>
>
> I'm trying to programmatically force a "changeSelection" event on a
> node. To do so I thought I should be able to set the node as unselected,
> and then back to selected, and expected this to fire the normal
> "changeSelection" event.
>
>
>
> // FIRST Please click on the "Files" node in the tree to select it
> manually!
> // Then push the Refresh Node button.
> var btn=new qx.ui.form.Button('Refresh Node');
> btn.addListener('execute',function() {
> tree.nodeSetSelected(refreshNode,false); // correctly fires
> changeSelection with data=[]
> tree.nodeSetSelected(refreshNode,true); // doesn't fire
> changeSelection??
> });
>
> The nodeSetSelected(refreshNode,false) does fire a changeSelection event,
> with data set to [], as I'd expect.
>
Although it appears so, actually not. There is no data to the
changeSelection event, so e.getData() returns undefined. When you receive
the changeSelection event, to find out what nodes are selected, IIRC, you
need to use to use tree.getSelectionModel().getSelectedRanges(). The method
getSelectionModel is from the helpers of the superclass of TreeVirtual
(qx.ui.table.Table) so you'll find that the selection model is an instance
of qx.ui.table.selection.Model.
> However the nodeSetSelected(refreshNode,true) does not fire any
> changeSelection event. Is this the expected behavior?
>
No, I don't think so. Unfortunately I don't have time to debug at the
moment, but my suggest would be that you put a breakpoint near line 1067 of
qx/ui/treevirtual/SimpleTreeDataModel.js which is in the 'bSelected' portion
of the setState() method. Be sure that it calls setSelectionInterval() when
the nodeSetSelected(...,true) method is called. Assuming it does, you can
set a breakpoint at around line 444 of qx/ui/table/selection/Model.js which
is the call to _fireChangeSelection() and follow it into that method, to see
if the fireEvent() call is being issued.
Sorry I can't debug in detail for you right now.
Cheers,
Derrell
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel