Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [DataBinding] Observe java.util.Collection
[DataBinding] Observe java.util.Collection [message #552591] Thu, 12 August 2010 17:49 Go to next message
Gaston M. Tonietti is currently offline Gaston M. ToniettiFriend
Messages: 7
Registered: July 2009
Junior Member
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 04:15 Go to previous messageGo to next message
Gaston M. Tonietti is currently offline Gaston M. ToniettiFriend
Messages: 7
Registered: July 2009
Junior Member
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 04:33 Go to previous messageGo to next message
Gaston M. Tonietti is currently offline Gaston M. ToniettiFriend
Messages: 7
Registered: July 2009
Junior Member
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 06:36 Go to previous messageGo to next message
budili Missing name is currently offline budili Missing nameFriend
Messages: 64
Registered: May 2010
Member
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 13:52 Go to previous message
Gaston M. Tonietti is currently offline Gaston M. ToniettiFriend
Messages: 7
Registered: July 2009
Junior Member
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: Fri Apr 26 03:14:34 GMT 2024

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

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

Back to the top