Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Riena » How to do a multifield validiation in Riena
How to do a multifield validiation in Riena [message #722244] Mon, 05 September 2011 06:54 Go to next message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
I would like to use Riena ridgets in an existing RCP application and I wonder how to best do a client validation that involves several fields. For example suppose there are two date fields and it should be asserted that the second date is after the first.

Best regards,
Peter
Re: How to do a multifield validiation in Riena [message #722437 is a reply to message #722244] Mon, 05 September 2011 18:56 Go to previous messageGo to next message
Christian Campo is currently offline Christian CampoFriend
Messages: 597
Registered: July 2009
Senior Member
Am 05.09.11 08:54, schrieb Peter Kullmann:
> I would like to use Riena ridgets in an existing RCP application and I wonder how to best do a client validation that
> involves several fields. For example suppose there are two date fields and it should be asserted that the second date is
> after the first.
>
> Best regards,
> Peter
>
I think the best way would be to write your own validator and pass the two ridget instances to the validator
constructor. Then add the one validator to each ridget. This way any time any of the two ridgets changes, the validator
can get to the two values and check that the range is ok.

what do you think ?

christian
Re: How to do a multifield validiation in Riena [message #723813 is a reply to message #722437] Fri, 09 September 2011 14:44 Go to previous messageGo to next message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
Hi Christian,

Thanks for the suggestion. I suppose it would work like that but was not yet able to do it. I have currently two problems with this:
1. If I edit for example the second date, how can I trigger a revalidation of the first? Calling ridget.revalidate() would do the trick but would also lead to a recursion if called on the wrong ridget. Or should I add markers to the widgets myself? In this case I probably should always return ok.
2. (This has probably nothing to do with the original question) The messages of my validator are never shown. The control is getting its red border but no message is visible.

Is there something wrong with this?
widgetVon = UIControlsFactory.createDatePickerComposite(parent);
delegate.addUIControl(widgetVon, "von");
...
IDateTextRidget ridgetVon = controller.getRidget("von");
ridgetVon.bindToModel(...);
ridgetVon.updateFromModel();
ridgetVon.setValidationRule(multFieldValidator, ValidationTime.ON_UPDATE_TO_MODEL);
tooltipMessageMarkerViewer.addRidget(ridgetVon);

Other ridgets like normal ITextRidget can display the validation messages with the same tooltipMessageMarkerViewer.

Regards,
Peter
Re: How to do a multifield validiation in Riena [message #724428 is a reply to message #723813] Mon, 12 September 2011 10:42 Go to previous messageGo to next message
Christian Campo is currently offline Christian CampoFriend
Messages: 597
Registered: July 2009
Senior Member
Hi Peter,
I will do that one by one....
Am 09.09.11 16:44, schrieb Peter Kullmann:
> Hi Christian,
>
> Thanks for the suggestion. I suppose it would work like that but was not yet able to do it. I have currently two
> problems with this:
> 1. If I edit for example the second date, how can I trigger a revalidation of the first? Calling ridget.revalidate()
> would do the trick but would also lead to a recursion if called on the wrong ridget. Or should I add markers to the
> widgets myself? In this case I probably should always return ok.
Yes you would do a textRidget.setErrorMarker(true); (or false depending on what has happened) (or setErrorMarker(true,
"something is wrong here"); )
> 2. (This has probably nothing to do with the original question) The messages of my validator are never shown. The
> control is getting its red border but no message is visible.
> Is there something wrong with this?
> widgetVon = UIControlsFactory.createDatePickerComposite(parent);
> delegate.addUIControl(widgetVon, "von");
> ...
> IDateTextRidget ridgetVon = controller.getRidget("von");
> ridgetVon.bindToModel(...);
> ridgetVon.updateFromModel();
> ridgetVon.setValidationRule(multFieldValidator, ValidationTime.ON_UPDATE_TO_MODEL);
> tooltipMessageMarkerViewer.addRidget(ridgetVon);
Looks like a bug to me. Please open a bug in Bugzilla...
>
> Other ridgets like normal ITextRidget can display the validation messages with the same tooltipMessageMarkerViewer.
>
> Regards,
> Peter
>
Re: How to do a multifield validiation in Riena [message #724820 is a reply to message #724428] Tue, 13 September 2011 09:47 Go to previous messageGo to next message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
Christian Campo wrote on Mon, 12 September 2011 06:42

...
> 2. (This has probably nothing to do with the original question) The messages of my validator are never shown. The
> control is getting its red border but no message is visible.
> Is there something wrong with this?
> widgetVon = UIControlsFactory.createDatePickerComposite(parent);
> delegate.addUIControl(widgetVon, "von");
> ...
> IDateTextRidget ridgetVon = controller.getRidget("von");
> ridgetVon.bindToModel(...);
> ridgetVon.updateFromModel();
> ridgetVon.setValidationRule(multFieldValidator, ValidationTime.ON_UPDATE_TO_MODEL);
> tooltipMessageMarkerViewer.addRidget(ridgetVon);
Looks like a bug to me. Please open a bug in Bugzilla...
>
> Other ridgets like normal ITextRidget can display the validation messages with the same tooltipMessageMarkerViewer.
>
> Regards,
> Peter
>


https://bugs.eclipse.org/bugs/show_bug.cgi?id=357461
Re: How to do a multifield validiation in Riena [message #724851 is a reply to message #724428] Tue, 13 September 2011 10:50 Go to previous message
Peter Kullmann is currently offline Peter KullmannFriend
Messages: 240
Registered: July 2009
Senior Member
Christian Campo wrote on Mon, 12 September 2011 06:42
...
Am 09.09.11 16:44, schrieb Peter Kullmann:
> Hi Christian,
>
> Thanks for the suggestion. I suppose it would work like that but was not yet able to do it. I have currently two
> problems with this:
> 1. If I edit for example the second date, how can I trigger a revalidation of the first? Calling ridget.revalidate()
> would do the trick but would also lead to a recursion if called on the wrong ridget. Or should I add markers to the
> widgets myself? In this case I probably should always return ok.
Yes you would do a textRidget.setErrorMarker(true); (or false depending on what has happened) (or setErrorMarker(true,
"something is wrong here"); )
...

Thanks, that helped. It works well now.

Regards,
Peter
Previous Topic:Nesting controllers
Next Topic:How to get a lazy loading tree in Riena?
Goto Forum:
  


Current Time: Fri Apr 19 22:41:00 GMT 2024

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

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

Back to the top