Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Riena » UI Validation
UI Validation [message #14186] Mon, 13 October 2008 22:57 Go to next message
Robert Kwolek is currently offline Robert KwolekFriend
Messages: 10
Registered: July 2009
Junior Member
Hi,


I've got a IValidator which can return more than one possible statuses.

How can I use a message from IStatus returned by this IValidator instead
of using a message which was set using a
IRidget.addValidationMessage(String) method?


Regards,
Robert
Re: UI Validation [message #14203 is a reply to message #14186] Mon, 13 October 2008 23:22 Go to previous messageGo to next message
Robert Kwolek is currently offline Robert KwolekFriend
Messages: 10
Registered: July 2009
Junior Member
Robert Kwolek wrote:
> Hi,
>
>
> I've got a IValidator which can return more than one possible statuses.
>
> How can I use a message from IStatus returned by this IValidator instead
> of using a message which was set using a
> IRidget.addValidationMessage(String) method?


As I can see one of possibilities is to use one message per validator
and to use IEditableRidget.addValidationMessage(String, IValidator). Are
there any other alternatives?


Robert
Re: UI Validation [message #14320 is a reply to message #14203] Thu, 16 October 2008 06:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: evolanakis.innoopract.com

Hi Robert,

the current API does not support this use case.

Currently, the IValidator (i.e. validation rule) returns a message via
the IStatus object. However this message is subsequently ignored. If a
ValidationMessage exists for this rule, it is displayed -- but it
provides only a fixed string.

Personally, I would prefer to use the string from the IStatus directly.

I'm not sure why an additional ValidationMessage is necessary. However
I'm not very familiar with that API, so there might be a valid use case
for the ValidationMessage.

Can you file a bug to track this feature request?

> How can I use a message from IStatus returned by this IValidator instead
> of using a message which was set using a
> IRidget.addValidationMessage(String) method?

I will discuss this with my colleagues and see what we can do.

Kind regards,
Elias.

---
Elias Volanakis
Innoopract, Inc.
http://www.innoopract.com
Re: UI Validation [message #15296 is a reply to message #14320] Thu, 16 October 2008 09:40 Go to previous message
Robert Kwolek is currently offline Robert KwolekFriend
Messages: 10
Registered: July 2009
Junior Member
Elias Volanakis wrote:
> Hi Robert,
>
> the current API does not support this use case.
>
> Currently, the IValidator (i.e. validation rule) returns a message via
> the IStatus object. However this message is subsequently ignored. If a
> ValidationMessage exists for this rule, it is displayed -- but it
> provides only a fixed string.
>
> Personally, I would prefer to use the string from the IStatus directly.
>
> I'm not sure why an additional ValidationMessage is necessary. However
> I'm not very familiar with that API, so there might be a valid use case
> for the ValidationMessage.
>
>
Can you file a bug to track this feature request?


https://bugs.eclipse.org/bugs/show_bug.cgi?id=251060

>
>> How can I use a message from IStatus returned by this IValidator instead
>> of using a message which was set using a
>> IRidget.addValidationMessage(String) method?
>
> I will discuss this with my colleagues and see what we can do.

By the way, consider such scenario: we have a person object with a birth
date (just 20081010) and special ID from which the birth date can be
extracted (e.g. "fdsfdsf20081010sds"). The validator shall check if the
birth date from the special ID and the "normal" birth date are the same.

Currently there is no way to provide such functionality without passing
the person object to validator outside the validation API.

I had the same problem in my previous project and the solution was
providing an extension point for the validation process.
All you had to do was implementing an interface with a method:

IStatus validate(Object object, String property);

where an object in our case would be a person object and a property
would be "birthDate" or "specialID".

Another advantage of such approach is that UI forms are separated from
validation (and vice versa ;-) ) and you can add validator without
modification of existing code.

Regards,
Robert Kwolek
Re: UI Validation [message #576133 is a reply to message #14186] Mon, 13 October 2008 23:22 Go to previous message
Robert Kwolek is currently offline Robert KwolekFriend
Messages: 10
Registered: July 2009
Junior Member
Robert Kwolek wrote:
> Hi,
>
>
> I've got a IValidator which can return more than one possible statuses.
>
> How can I use a message from IStatus returned by this IValidator instead
> of using a message which was set using a
> IRidget.addValidationMessage(String) method?


As I can see one of possibilities is to use one message per validator
and to use IEditableRidget.addValidationMessage(String, IValidator). Are
there any other alternatives?


Robert
Re: UI Validation [message #576299 is a reply to message #14203] Thu, 16 October 2008 06:03 Go to previous message
Elias Volanakis is currently offline Elias VolanakisFriend
Messages: 43
Registered: July 2009
Member
Hi Robert,

the current API does not support this use case.

Currently, the IValidator (i.e. validation rule) returns a message via
the IStatus object. However this message is subsequently ignored. If a
ValidationMessage exists for this rule, it is displayed -- but it
provides only a fixed string.

Personally, I would prefer to use the string from the IStatus directly.

I'm not sure why an additional ValidationMessage is necessary. However
I'm not very familiar with that API, so there might be a valid use case
for the ValidationMessage.

Can you file a bug to track this feature request?

> How can I use a message from IStatus returned by this IValidator instead
> of using a message which was set using a
> IRidget.addValidationMessage(String) method?

I will discuss this with my colleagues and see what we can do.

Kind regards,
Elias.

---
Elias Volanakis
Innoopract, Inc.
http://www.innoopract.com
Re: UI Validation [message #576380 is a reply to message #14320] Thu, 16 October 2008 09:40 Go to previous message
Robert Kwolek is currently offline Robert KwolekFriend
Messages: 10
Registered: July 2009
Junior Member
Elias Volanakis wrote:
> Hi Robert,
>
> the current API does not support this use case.
>
> Currently, the IValidator (i.e. validation rule) returns a message via
> the IStatus object. However this message is subsequently ignored. If a
> ValidationMessage exists for this rule, it is displayed -- but it
> provides only a fixed string.
>
> Personally, I would prefer to use the string from the IStatus directly.
>
> I'm not sure why an additional ValidationMessage is necessary. However
> I'm not very familiar with that API, so there might be a valid use case
> for the ValidationMessage.
>
>
Can you file a bug to track this feature request?


https://bugs.eclipse.org/bugs/show_bug.cgi?id=251060

>
>> How can I use a message from IStatus returned by this IValidator instead
>> of using a message which was set using a
>> IRidget.addValidationMessage(String) method?
>
> I will discuss this with my colleagues and see what we can do.

By the way, consider such scenario: we have a person object with a birth
date (just 20081010) and special ID from which the birth date can be
extracted (e.g. "fdsfdsf20081010sds"). The validator shall check if the
birth date from the special ID and the "normal" birth date are the same.

Currently there is no way to provide such functionality without passing
the person object to validator outside the validation API.

I had the same problem in my previous project and the solution was
providing an extension point for the validation process.
All you had to do was implementing an interface with a method:

IStatus validate(Object object, String property);

where an object in our case would be a person object and a property
would be "birthDate" or "specialID".

Another advantage of such approach is that UI forms are separated from
validation (and vice versa ;-) ) and you can add validator without
modification of existing code.

Regards,
Robert Kwolek
Previous Topic:ITableRidget - nested properties
Next Topic:Riena Getting started: Update on Injectors
Goto Forum:
  


Current Time: Tue Apr 16 22:48:21 GMT 2024

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

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

Back to the top