« Return to Thread: TransformedList question

Re: Re: TransformedList question

by wsnyder6 :: Rate this Message:

Reply to Author | View in Thread

Yes. I see that it didn't work. But the CollectionList did. Sweet!

Taking this one step further, what if User was a hierarchical object? Is it possible to have a JTree (instead of a JList) to hold a User hierarchy for filtering?

Hmm, Maybe a 'Category' object would be a better example. So if I clicked on 'All Categories' I would see all Issues. If I clicked on Category A, I would see Category A and Category B issues, etc...

All Categories
+--Category A
  +--Category B
+--Category C

Does GlazedLists have a TreeModel/SelectionListener that would do something like this?

Thanks for all your gracious help!

--Bill

Jesse Wilson wrote:
On 8/15/06, wsnyder6 <wsnyder6@gmail.com> wrote:
> I also thought that I could use the TransformedList like such:
>  class ItemsToLabelsList extends TransformedList {
>         public IssuesToUsersList(EventList source) {
>             super(source);
>             for (Object elem : source) {
>                 addAll( ((Issue)elem).getUsers() );
>             }
>             source.addListEventListener(this);
>         }
>         public void listChanged(ListEvent listChanges) {
>             updates.forwardEvent(listChanges);
>         }
>     }

Unforunately, this won't work since the TransformedList needs
to map indices from one list to another. For example, the addAll()
method won't work - it will just call through to source.

Regardless, CollectionList does what you want. Let us know
if you run into further problems!

Cheers,
Jesse

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glazedlists.dev.java.net
For additional commands, e-mail: users-help@glazedlists.dev.java.net

 « Return to Thread: TransformedList question