Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How to trigger JFace Databinding validation
How to trigger JFace Databinding validation [message #539934] Mon, 14 June 2010 06:20 Go to next message
Geejay is currently offline Geejay
Messages: 160
Registered: February 2010
Senior Member
Hi all

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) ?

Thanks

Greg
Re: How to trigger JFace Databinding validation [message #540972 is a reply to message #539934] Thu, 17 June 2010 16:36 Go to previous message
Tim  is currently offline Tim
Messages: 12
Registered: December 2009
Junior Member
Hi,

First:
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();
target2UI.setConverter();
target2UI.setValidator(); 
etc.
UpdateValueStrategy model2Target = new UpdateValueStrategy();
model2Target.setConverter();
model2Target.setValidator(); 

dataBindingContext.bindValue(target, model, target2model, model2Target);


Hope this helps.
Previous Topic:get treeviewer from item
Next Topic:Widgets in tables
Goto Forum:
  


Current Time: Mon Jul 28 20:41:04 EDT 2014

Powered by FUDForum. Page generated in 0.01659 seconds