Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [DataBinding] Delay model updates until dialog confirmation
[DataBinding] Delay model updates until dialog confirmation [message #551526] Fri, 06 August 2010 20:05 Go to next message
Marian Seitner is currently offline Marian SeitnerFriend
Messages: 5
Registered: August 2010
Junior Member
I have a TitleAreaDialog with default buttons where I use data binding to synchronize the model and the widgets. How do I delay model updates until the user clicks the 'OK' button?

Thanks!
Re: [DataBinding] Delay model updates until dialog confirmation [message #552417 is a reply to message #551526] Thu, 12 August 2010 07:41 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
On 08/06/2010 02:05 PM, marian.seitner@googlemail.com wrote:
> I have a TitleAreaDialog with default buttons where I use data binding
> to synchronize the model and the widgets. How do I delay model updates
> until the user clicks the 'OK' button?
>
> Thanks!

Typically you do this by specifying POLICY_CONVERT as the
target-to-model update policy:

UpdateValueStrategy targetToModel = new UpdateValueStrategy(
UpdateValueStrategy.POLICY_CONVERT);
UpdateValueStrategy modelToTarget = new UpdateValueStrategy();

bindingContext.bindValue(target, model, targetToModel, modelToTarget);

The POLICY_CONVERT policy will execute the target-to-model bindings
whenever the target observables change, but stop short of actually
writing the values to model. However this generally includes enough of
the binding pipeline so that your validations can run and keep your
validation alerts current in your TitleAreaDialog.

When the user clicks finish, do this:

bindingContext.updateModels();

This explicitly runs all the target-to-model bindings all the way through.

Hope this helps,

Matthew
icon6.gif  Re: [DataBinding] Delay model updates until dialog confirmation [message #553478 is a reply to message #551526] Tue, 17 August 2010 16:20 Go to previous message
Marian Seitner is currently offline Marian SeitnerFriend
Messages: 5
Registered: August 2010
Junior Member
Thank you, exactly what I was looking for!
Previous Topic:How can I get 'all' visible nodes in a TreeViewer
Next Topic:Displaying Special Characters in JFace Error Dialog
Goto Forum:
  


Current Time: Thu Apr 25 07:29:20 GMT 2024

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

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

Back to the top