Examples of RegExpValidator


Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

    datePast.setMax(new Date());
    return datePast;
  }

  private static Validator createFromPattern(PatternConstraintInfo pattern) {
    RegExpValidator regexp = new RegExpValidator();
    regexp.setExpression(pattern.getRegexp());
    return regexp;
  }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

                    if (floatConstraint.getMaximum() != null) {
                        validator.setMax(floatConstraint.getMaximum().floatValue());
                    }
                    validators.add(validator);
                } else if (constraint instanceof RegexConstraint) {
                    RegExpValidator validator = new RegExpValidator("^" + constraint.getDetails() + "$");
                    validators.add(validator);
                }
            }
        }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

        Validator intervalValidator = new IsIntegerValidator();
        intervalValidator.setErrorMessage(MSG.view_dynagroup_recalculationInterval_error());
        recalculationInterval.setValidators(intervalValidator);
        expression.setValue(groupDefinition.getExpression());

        Validator nameValidator = new RegExpValidator("^[^\\<\\$\\'\\{\\[]{1,100}$");
        nameValidator.setErrorMessage("Name must not contain following characters: < $ ' [ {");
        name.setValidators(nameValidator);

        final DynamicForm form = new DynamicForm();
        form.setFields(id, name, description, templateSelectorTitleSpacer, templateSelector, expression, recursive,
            recalculationInterval);
View Full Code Here

Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

        idDataField.setCanEdit(false);
        fields.add(idDataField);

        DataSourceTextField usernameField = createTextField(Field.NAME, MSG.common_title_username(), 3, 100, true);
        // Don't allow characters that could be used in HTML intended for an XSS attack.
        RegExpValidator regExpValidator = new RegExpValidator("[^&<]*");
        usernameField.setValidators(regExpValidator);
        fields.add(usernameField);

        DataSourceTextField ldapField = createBooleanField(Field.LDAP, MSG.dataSource_users_field_ldap(), true);
        ldapField.setCanEdit(false); // read-only
View Full Code Here

Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

        DataSourceTextField firstNameField = new DataSourceTextField("firstName", "First Name", 50, true);
        DataSourceTextField lastNameField = new DataSourceTextField("lastName", "Last Name", 50, true);
        DataSourceTextField emailField = new DataSourceTextField("email", "Email", 100, true);

        RegExpValidator emailValidator = new RegExpValidator();
        emailValidator.setErrorMessage("Invalid email address");
        emailValidator.setExpression("^([a-zA-Z0-9_.\\-+])+@(([a-zA-Z0-9\\-])+\\.)+[a-zA-Z0-9]{2,4}$");
       
        emailField.setValidators(emailValidator);

        DataSourcePasswordField passwordField = new DataSourcePasswordField("password", "Password", 20, true);
View Full Code Here

Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

    public Canvas getViewPanel() {
     
        DataSource dataSource = new DataSource();
        dataSource.setID("regularExpression");
       
        RegExpValidator regExpValidator = new RegExpValidator();
        regExpValidator.setExpression("^([a-zA-Z0-9_.\\-+])+@(([a-zA-Z0-9\\-])+\\.)+[a-zA-Z0-9]{2,4}$");
       
        DataSourceTextField dsTextField = new DataSourceTextField("email");
        dsTextField.setTitle("Email");
        dsTextField.setValidators(regExpValidator);
       
View Full Code Here

Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

    public static class ZipCodeUSType extends SimpleType {
        public ZipCodeUSType() {
            super("zipCodeUS", FieldType.TEXT);

            RegExpValidator validator = new RegExpValidator("^\\d{5}(-\\d{4})?$");
            setValidators(validator);
        }
View Full Code Here

Examples of com.smartgwt.client.widgets.form.validator.RegExpValidator

    // treeGrid.setAutoFetchData(true);

    TreeGridField nameField = new TreeGridField("Name", handleHorizontal(
        650, 900));
    nameField.setCanSort(false);
    RegExpValidator elementName = new RegExpValidator();
    elementName.setErrorMessage("Invalid name for XML element");
    elementName.setExpression("^([a-zA-Z])+([a-zA-Z0-9\\-_\\.])*");

    nameField.setValidators(elementName);

    TreeGridField typeField = new TreeGridField(Type, 60);
    typeField.setCanSort(false);
View Full Code Here

Examples of com.vaadin.data.validator.RegexpValidator

import com.vaadin.ui.Form;

public class TestSerialization extends TestCase {

    public void testValidators() throws Exception {
        RegexpValidator validator = new RegexpValidator(".*", "Error");
        validator.validate("aaa");
        RegexpValidator validator2 = serializeAndDeserialize(validator);
        validator2.validate("aaa");
    }
View Full Code Here

Examples of com.vaadin.data.validator.RegexpValidator

            // should fail
        }
    }

    public void testRegexpValidator() {
        field.addValidator(new RegexpValidator("pattern", true,
                "Validation failed"));
        field.setRequired(false);

        // succeeds
        field.setValue("");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.