| [DataBinding] No IObservableFactory for table details? [message #318227] |
Mon, 23 July 2007 14:26  |
Juergen King Messages: 3 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am about to port a client framework from my proprietary binding to
JFace databinding. The binding for beans works pretty well, but I also
want to support POJOs without PropetyChangeSupport. The mapping of those
POJOs outside a Table is not the problem, but to map a list of POJOs to
a table my code looks like this:
IObservableList observableList =
aMatchingTarget.createIObservableList();
Class<?> realComponentType = calcComponentType(observableList,
getComponentType());
ObservableListContentProvider contentProvider = new
ObservableListContentProvider();
getViewer().setContentProvider(contentProvider);
final String[] associatedNames = getAssociatedNames();
if ((associatedNames != null) && (associatedNames.length > 0)) {
IObservableMap[] attributeMaps = BeansObservables.observeMaps(
contentProvider.getKnownElements(), realComponentType,
associatedNames);
getViewer().setLabelProvider(new
ObservableMapLabelProvider(attributeMaps));
} else {
getViewer().setLabelProvider(new LabelProvider());
}
getViewer().setInput(observableList);
Using BeansObservables.observeMaps(...) I get an error in stderr about
the missing PropertyChangeSupport.
I can only find a IObservableFactory in the context of
MasterDetailObservables did I miss something important? Should I
implement my own IObservableMap or my own LabelProvider to solve this
problem?
Juergen
--
https://sourceforge.net/projects/jrcaf/
|
|
|
|
|
|
|
| Re: [DataBinding] No IObservableFactory for table details? [message #318576 is a reply to message #318538] |
Tue, 31 July 2007 22:53  |
Brad Reynolds Messages: 309 Registered: July 2009 |
Senior Member |
|
|
Juergen King wrote:
> Hi Brad,
>
>> I logged an enhancement request for us to provide support for
>> POJOs[1]. You're always going to see these error messages if you
>> attempt to use BeansObservables with a POJO. You could create your
>> own implementation of ILogger to eat these messages although it would
>> be a hackish solution... but it would work.
>
> I am not sure if a simple POJO support is generic enough.
>
> In my case I have my own notification mechanism to get notified about
> changes on a POJO by the Controller. So I could create a
> IObservableValue if e.g. a method like
> JavaBeanObservableMap#hookListener(Object domainElement) would delegate
> the creation to a IObservableFactory.
>
> You may want to support a list of POJOs, EMF-Objects or even JavaBeans
> in e.g. a table.
>
> Juergen
We support any observable in a table, not just beans. By invoking
BeansObservables.observeMaps(...) you're saying that your object is a
bean. If it's not it's not going to work because that's all this method
supports. If you have your own model object type you need to write your
own observable implementation and invoke it from your own factory (e.g.
MyTrustyObservables.observeMaps(...).
-brad
|
|
|
Powered by
FUDForum. Page generated in 0.01585 seconds