-
Notifications
You must be signed in to change notification settings - Fork 128
FormValidator
kotcrab edited this page Dec 13, 2014
·
13 revisions
FormValidator is a utility classes made for dialog that requires inputing various information and that information cannot be wrong. When input of any field in controlled form in invalid, accept button passed to FormValidaor will be disapled, and errorLabel text will be changed with error information. Demo
Currently FromValidator can check for 3 things:
- Field is not empty
- Path to file entered in text field points to existing file (or directory)
- Path to file entered in text field points to existing file (or directory), but the file is relative to directory form other field.
Example (from the demo):
FormValidator validator = new FormValidator(createButton, errorLabel);
validator.notEmpty(projectRoot, "Project root path cannot be empty!");
validator.notEmpty(sourceLoc, "Source location cannot be empty!");
validator.notEmpty(assetsLoc, "Assets location cannot be empty!");
validator.fileExist(projectRoot, "Project folder does not exist!");
validator.fileExist(sourceLoc, projectRoot, "Source folder does not exist!");
validator.fileExist(assetsLoc, projectRoot, "Assets folder does not exist!");
See README for VisUI introduction.