|How to trigger JFace Databinding validation [message #539934]
||Mon, 14 June 2010 06:20
Registered: February 2010
I have setup JFace databinding in an Eclipse RCP app.
I have an UpdateValueStrategy for each field that needs to show the user
whether a field is correct or not (i.e a decoration, warning message).
I have the following use case:
A user loads a saved form, the form is then rendered and the controls are
filled in according to what was in the model.
The form shows only fields that are valid, e.g some fields are disabled
because they are not relevant.
And now the question:
At the moment, the validation only occurs when the user actually enters
something into the fields. How do I trigger this programatically (say when
the form is first loaded) ?
|Re: How to trigger JFace Databinding validation [message #540972 is a reply to message #539934]
||Thu, 17 June 2010 16:36
Registered: December 2009
the common way is not to allow invalid data in the model.
But if you have the requirement to validate invalid data,
whether they load in the UI, then you have the possibility
with the Eclipse DataBinding Framework.
If you set your UpdateStrategy, you have the choice to decide
which strategy you set, if the data goes in the model and if the data loads in the UI.
UpdateValueStrategy target2model = new UpdateValueStrategy();
UpdateValueStrategy model2Target = new UpdateValueStrategy();
dataBindingContext.bindValue(target, model, target2model, model2Target);
Hope this helps.
Powered by FUDForum
. Page generated in 0.01524 seconds