Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [Databinding] Force a validation of a field
[Databinding] Force a validation of a field [message #899276] Tue, 31 July 2012 10:12 Go to next message
Cedric Moonen is currently offline Cedric Moonen
Messages: 274
Registered: August 2009
Senior Member
Hello,

I have a dialog on which I have several widgets and I use JFace databinding to link the widgets to my model. I also use validators for some of the fields (with control decoration support).
The validation of one of the fields on the dialog depends somehow on other fields. To make it concrete: the dialog allows the user to define parameter data (name, type, default value, ...). The default value field is validated depending on the chosen type. So, whenever the user changes the type, the default value field has to be revalidated (and an error decoration needs to be displayed in case of error).

I tried to listen on modification of the type binding and then call "validateTargetToModel" on the default value binding but this doesn't solve my problem.

How can I make sure that the status and visible state of the default value field is updated when I change the type field ?

Thanks
Re: [Databinding] Force a validation of a field [message #899300 is a reply to message #899276] Tue, 31 July 2012 12:11 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi,

calling validateTargetToModel should IMHO do exactly what you want. Did you debug it?

Or you can use the MultiValidator
http://eclipsesource.com/blogs/2009/02/27/databinding-crossvalidation-with-a-multivalidator/
Re: [Databinding] Force a validation of a field [message #899483 is a reply to message #899300] Wed, 01 August 2012 06:58 Go to previous message
Cedric Moonen is currently offline Cedric Moonen
Messages: 274
Registered: August 2009
Senior Member
Hello Jan,

Thanks for the reply. After checking my code I realized that the validation code was wrong (it was using values from the model, which of course were not up to date because the validation happens before the value is set to the model).
So the behaviour was that the validation didn't work properly in all cases. This is now fixed and it works properly.
Previous Topic:TreeNodeContentProvider vs ITreePathContentProvider
Next Topic:DnD of POJOs
Goto Forum:
  


Current Time: Tue Sep 16 19:36:57 GMT 2014

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

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