|
From: Peter De B. (JIRA) <no...@at...> - 2007-11-22 11:34:19
|
[ http://opensource.atlassian.com/projects/spring/browse/RCP-488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27887 ]
Peter De Bruycker commented on RCP-488:
---------------------------------------
so now you can do the following:
<snip>
...
dia.setInputConstraint(new Constraint() {
public boolean test(Object argument) {
final String name = (String) argument;
boolean found = ... check if the name already exist
if (found) {
dia.setMessage(new DefaultMessage("not unique", Severity.ERROR));
}
return !found;
}
});
...
</snip>
> InputApplicationDialog.getValidationReporter() could be public
> --------------------------------------------------------------
>
> Key: RCP-488
> URL: http://opensource.atlassian.com/projects/spring/browse/RCP-488
> Project: Spring Framework Rich Client Project
> Issue Type: Improvement
> Components: Helper Classes
> Reporter: Benoit Xhenseval
> Assignee: Peter De Bruycker
>
> I'm trying to use the InputApplicationDialog and I think that a private method should be made public: getValidationReporter().
> Some basic rules are created for string length for instance but I would like to validate the input once the user tries to press enter (e.g. check the DB/Server).
> I wanted to use the setInputConstraint(Constraint c) and it works fine, the server detects a duplicate and returns false so the dialog cannot be closed via OK, however how could I notify the user in the error reporting area?
> If the method getValidationReporter() was public, one could simply do it like this:
> final InputApplicationDialog dia = new InputApplicationDialog(nameModel, "name");
> dia.setTitle(getMessage("xxxx.title"));
> dia.setInputLabelMessage("Enter a query name");
> dia.setInputConstraint(new Constraint() {
> public boolean test(Object argument) {
> final String name = (String) argument;
> boolean found = ... check if the name already exist
> if (found) {
> dia.getValidationReporter().setMessage(
> new DefaultMessage("not unique", Severity.ERROR));
> }
> return !found;
> }
> });
> dia.showDialog();
>
> So, may I suggest that this method is made public?
> Of course, there may be a better way... could someone enlighten me?
> Thanks
> Benoit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/spring/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|