[DataBinding] Observe java.util.Collection [message #552591] |
Thu, 12 August 2010 13:49  |
Eclipse User |
|
|
|
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 #556982 is a reply to message #556905] |
Fri, 03 September 2010 09:52  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 1.06106 seconds