Skip to main content



      Home
Home » Eclipse Projects » JFace » [DataBinding] Observe java.util.Collection
[DataBinding] Observe java.util.Collection [message #552591] Thu, 12 August 2010 13:49 Go to next message
Eclipse UserFriend
Hi all,

I have an object which has a collection property, but the class of this property only implements java.util.Collection.

So when I want to bind it to a table viewer, obviously, the method BeansObservables.observeSet(element, "collectionProp") fails due to a ClassCastException.
It could be nice to have a method observeCollection wich casts the values to java.util.Collection instead of casting it to an specific type of collection, but it is nowhere.

I can't either figure out the right place to wrap the collection inside a proxy implementing the Set interface, since the value is taken directly from element very deep inside databinding code.

Any piece of advice is very welcome.
Thank you so much in advance.
Gaston.
Re: [DataBinding] Observe java.util.Collection [message #556890 is a reply to message #552591] Fri, 03 September 2010 00:15 Go to previous messageGo to next message
Eclipse UserFriend
Hi again guys.
Any ideas? I still need to solve this problem

Thanks
Gaston.
Re: [DataBinding] Observe java.util.Collection [message #556891 is a reply to message #552591] Fri, 03 September 2010 00:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi again guys.
Any ideas? I still need to solve this problem

Thanks
Gaston.
Re: [DataBinding] Observe java.util.Collection [message #556905 is a reply to message #556891] Fri, 03 September 2010 02:36 Go to previous messageGo to next message
Eclipse UserFriend
What do you want to do?
Put the collection in a tableviewer? Then a writableList could help you:

WritableList wList = new WritableList(hereIsTheBeanCollection);
tableViewer.setInput(wList);


Maybe this helps.
Re: [DataBinding] Observe java.util.Collection [message #556982 is a reply to message #556905] Fri, 03 September 2010 09:52 Go to previous message
Eclipse UserFriend
Hi, thank you for answering me.

I cannot do it this way since the collection is just used to populate the observablelist with some content.

I need to keep track of changes as the bean fires a prop change event when the collection changes. This way I bind the viewer with the bean's collection and it gets updated when any element is deleted or added.

I will wrap the whole bean inside an object which converts the Collection into a Set and bind the viewer with this wrapper.

What I have to figure out is if only the collection getter is always used or I have to intercept the prop change event and convert old and new values as well.

Thank you anyways.
Gaston.
Previous Topic:[DataBinding] Observe java.util.Collection
Next Topic:[databinding] too many events while listening to changes inside IObservableList/Set
Goto Forum:
  


Current Time: Tue Jul 01 05:24:49 EDT 2025

Powered by FUDForum. Page generated in 1.06106 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top