[DataBinding] ListBinding issue with uni-directional ON_REQUEST update [message #330772] |
Wed, 13 August 2008 00:32  |
Eclipse User |
|
|
|
Originally posted by: evolanakis.innoopract.com
Hi,
please let me know if I should file a bug for this, or I just
misunderstood something.
I'm binding two IObservableLists named target and model. Update from
target to model is automatic. Update from model to target is on request.
The strange thing is that invoking binding.updateModelToTarget() will
not pick up the changes in mdlBean (which properly fires events). This
can be worked around by adding a dummy listener to the model. :-P
Code Example (using Eclipse 3.4)
IObservableList target
= BeansObservables.observeList(realm, tgtBean, tgtProperty);
IObservableList model
= BeansObservables.observeList(realm, mdlBean, mdlPropert);
Binding binding = dbc.bindList(
target,
model,
new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE),
new UpdateListStrategy(UpdateListStrategy.POLICY_ON_REQUEST));
// try modifying the model
mdlBean.addSomething(...);
binding.updateModelToTarget(); // result: target/tgtBean unchanged
// add listener (once)
binding.getModel().addChangeListener(new IChangeListener() {
public void handleChange(ChangeEvent event) {
// dummy listener
}});
// try modifying the model
mdlBean.addSomething(...);
binding.updateModelToTarget(); // result: target/tgtBean changed
Thanks for your response,
Elias.
--
---
Elias Volanakis
Innoopract, Inc.
http://www.innoopract.com
|
|
|
Re: [DataBinding] ListBinding issue with uni-directional ON_REQUEST update [message #330812 is a reply to message #330772] |
Wed, 13 August 2008 16:39   |
Eclipse User |
|
|
|
Please file a bug (or could this be caused by
https://bugs.eclipse.org/bugs/show_bug.cgi?id=236605 ?)
Boris
"Elias Volanakis" <evolanakis@innoopract.com> wrote in message
news:g7to4h$td$1@build.eclipse.org...
> Hi,
>
> please let me know if I should file a bug for this, or I just
> misunderstood something.
>
> I'm binding two IObservableLists named target and model. Update from
> target to model is automatic. Update from model to target is on request.
>
> The strange thing is that invoking binding.updateModelToTarget() will
> not pick up the changes in mdlBean (which properly fires events). This can
> be worked around by adding a dummy listener to the model. :-P
>
> Code Example (using Eclipse 3.4)
>
> IObservableList target
> = BeansObservables.observeList(realm, tgtBean, tgtProperty);
> IObservableList model
> = BeansObservables.observeList(realm, mdlBean, mdlPropert);
> Binding binding = dbc.bindList(
> target,
> model,
> new UpdateListStrategy(UpdateListStrategy.POLICY_UPDATE),
> new UpdateListStrategy(UpdateListStrategy.POLICY_ON_REQUEST));
>
> // try modifying the model
> mdlBean.addSomething(...);
> binding.updateModelToTarget(); // result: target/tgtBean unchanged
>
> // add listener (once)
> binding.getModel().addChangeListener(new IChangeListener() {
> public void handleChange(ChangeEvent event) {
> // dummy listener
> }});
>
> // try modifying the model
> mdlBean.addSomething(...);
> binding.updateModelToTarget(); // result: target/tgtBean changed
>
>
> Thanks for your response,
> Elias.
>
> --
> ---
> Elias Volanakis
> Innoopract, Inc.
> http://www.innoopract.com
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03344 seconds