- private class UniqueUserNameValidator implements IInputValidator{
-
- private static final String USER_EXISTS = "Username already exists";
- private static final String NAME_TO_SHORT = "Username is empty";
-
- @Override
- public String isValid(String newText) {
- // query for username
- if(newText.length() < 1){
- setPageComplete(false);
- return NAME_TO_SHORT;
- }
- if(CdmStore.getService(IUserService.class).userExists(newText)){
- setPageComplete(false);
- return USER_EXISTS;
- }
-
- setPageComplete(true);
- return null;
- }
- }
-