You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by aappddeevv <aa...@verizon.net> on 2010/06/07 05:00:20 UTC

TreeView selection detection

I was looking to wire up some selection processing once my nodes in a
TreeView are selected. I noticed that there is a listener list for that that
I can add a listener to but I did not see anything easy to use such as a
simple method I can override on the TreeView that is called when the
selection changes. 

 

Is it expected that even subclasses of the actual class have to add a bunch
of boilerplate listeners to the controls to track these types of events? Is
there a default listener installed that translates the listener methods into
simple-to-override calls in the subclass?

 

I saw the tutorial on event listener attributes, but it was not clear how I
could simply, without a lot of specification or script tags, invoke a method
on my TreeView subclass with the arguments of the listener so I could
process the selection change event. What is in the bindings if the inline
script is executed and how to reference "this."? How do I reference the
argument of the listener event e.g. the path that changed in this example?

 

Essentially, I just want my subclass's method onSelectionPathAdded(Path
added) to be called which mostly mirrors the listener. 


Re: TreeView selection detection

Posted by Greg Brown <gk...@mac.com>.
Yes - setSelectedPath() delegates to setSelectedPaths(). In some cases we have made convenience methods like this final so it is clear which method to override. We could consider doing that here as well, though on the other hand I don't want to impose any unnecessary restrictions on callers who may have a legitimate reason to override setSelectedPath()...

On Jun 7, 2010, at 9:14 AM, aappddeevv wrote:

> K. Am I guaranteed that setSelectedPaths() will always be called even from the internal tree machinery? It looks like that’s the case because the listeners are called there but just want to confirm.
>  
> From: Greg Brown [mailto:gkbrown@mac.com] 
> Sent: Monday, June 07, 2010 8:00 AM
> To: user@pivot.apache.org
> Subject: Re: TreeView selection detection
>  
> You can override setSelectedPaths(). If your TreeView is multi-select, you should also override addSelectedPath() and removeSelectedPath().
>  
> In event listener attributes, you can access the event arguments via an "arguments" array that is passed to the function. 
>  
> On Jun 6, 2010, at 11:00 PM, aappddeevv wrote:
> 
> 
> I was looking to wire up some selection processing once my nodes in a TreeView are selected. I noticed that there is a listener list for that that I can add a listener to but I did not see anything easy to use such as a simple method I can override on the TreeView that is called when the selection changes.
>  
> Is it expected that even subclasses of the actual class have to add a bunch of boilerplate listeners to the controls to track these types of events? Is there a default listener installed that translates the listener methods into simple-to-override calls in the subclass?
>  
> I saw the tutorial on event listener attributes, but it was not clear how I could simply, without a lot of specification or script tags, invoke a method on my TreeView subclass with the arguments of the listener so I could process the selection change event. What is in the bindings if the inline script is executed and how to reference “this.”? How do I reference the argument of the listener event e.g. the path that changed in this example?
>  
> Essentially, I just want my subclass’s method onSelectionPathAdded(Path added) to be called which mostly mirrors the listener.
>  


RE: TreeView selection detection

Posted by aappddeevv <aa...@verizon.net>.
K. Am I guaranteed that setSelectedPaths() will always be called even from
the internal tree machinery? It looks like that's the case because the
listeners are called there but just want to confirm.

 

From: Greg Brown [mailto:gkbrown@mac.com] 
Sent: Monday, June 07, 2010 8:00 AM
To: user@pivot.apache.org
Subject: Re: TreeView selection detection

 

You can override setSelectedPaths(). If your TreeView is multi-select, you
should also override addSelectedPath() and removeSelectedPath().

 

In event listener attributes, you can access the event arguments via an
"arguments" array that is passed to the function. 

 

On Jun 6, 2010, at 11:00 PM, aappddeevv wrote:





I was looking to wire up some selection processing once my nodes in a
TreeView are selected. I noticed that there is a listener list for that that
I can add a listener to but I did not see anything easy to use such as a
simple method I can override on the TreeView that is called when the
selection changes.

 

Is it expected that even subclasses of the actual class have to add a bunch
of boilerplate listeners to the controls to track these types of events? Is
there a default listener installed that translates the listener methods into
simple-to-override calls in the subclass?

 

I saw the tutorial on event listener attributes, but it was not clear how I
could simply, without a lot of specification or script tags, invoke a method
on my TreeView subclass with the arguments of the listener so I could
process the selection change event. What is in the bindings if the inline
script is executed and how to reference "this."? How do I reference the
argument of the listener event e.g. the path that changed in this example?

 

Essentially, I just want my subclass's method onSelectionPathAdded(Path
added) to be called which mostly mirrors the listener.

 


Re: TreeView selection detection

Posted by Greg Brown <gk...@mac.com>.
You can override setSelectedPaths(). If your TreeView is multi-select, you should also override addSelectedPath() and removeSelectedPath().

In event listener attributes, you can access the event arguments via an "arguments" array that is passed to the function. 

On Jun 6, 2010, at 11:00 PM, aappddeevv wrote:

> I was looking to wire up some selection processing once my nodes in a TreeView are selected. I noticed that there is a listener list for that that I can add a listener to but I did not see anything easy to use such as a simple method I can override on the TreeView that is called when the selection changes.
>  
> Is it expected that even subclasses of the actual class have to add a bunch of boilerplate listeners to the controls to track these types of events? Is there a default listener installed that translates the listener methods into simple-to-override calls in the subclass?
>  
> I saw the tutorial on event listener attributes, but it was not clear how I could simply, without a lot of specification or script tags, invoke a method on my TreeView subclass with the arguments of the listener so I could process the selection change event. What is in the bindings if the inline script is executed and how to reference “this.”? How do I reference the argument of the listener event e.g. the path that changed in this example?
>  
> Essentially, I just want my subclass’s method onSelectionPathAdded(Path added) to be called which mostly mirrors the listener.