Examples of RegexpValidator


Examples of com.vaadin.data.validator.RegexpValidator

        form.addField("e", tf);

        // regular expressions

        tf = new TextField("A field, must match the regular expression a.*b.*c");
        tf.addValidator(new RegexpValidator("a.*b.*c",
                "{0} does not match the regular expression"));
        tf.setValue("aagsabeqgc");
        form.addField("f", tf);

        tf = new TextField(
                "A field, must contain the regular expression a.*b.*c");
        tf.addValidator(new RegexpValidator("a.*b.*c", false,
                "{0} does not contain the regular expression"));
        tf.setValue("aagsabeqgc");
        form.addField("g", tf);

        tf = new TextField(
                "A field, must match the regular expression ^a.*b.*c$");
        tf.addValidator(new RegexpValidator("^a.*b.*c$", false,
                "{0} does not match the regular expression with ^ and $"));
        tf.setValue("aagsabeqgc");
        form.addField("h", tf);

        tf = new TextField(
                "A field, must contain the regular expression ^a.*b.*c$");
        tf.addValidator(new RegexpValidator("^a.*b.*c$", false,
                "{0} does not contain the regular expression with ^ and $"));
        tf.setValue("aagsabeqgc");
        form.addField("i", tf);

        // TODO CompositeValidator
View Full Code Here

Examples of com.vaadin.data.validator.RegexpValidator

    public void setInputCaption(String caption) {
      inputField.setCaption(caption);
    }

    public void setInputRegexValidator(String regex, String errorMessage) {
      inputField.addValidator(new RegexpValidator(regex, errorMessage));
    }
View Full Code Here

Examples of com.vaadin.data.validator.RegexpValidator

  protected abstract Layout wrapFields();

  private TextField createTimeField(String timeCaption, String timeErrorMessage) {
    TextField timeField = new TextField(timeCaption);
    timeField.addValidator(new RegexpValidator("(2[0-3]|[0-1]?[0-9])(:[0-5][0-9]){0,2}", timeErrorMessage));
    timeField.setImmediate(true);
    timeField.setWidth(getAdvisedWidth(timeField), Sizeable.UNITS_PIXELS);
    timeField.setNullRepresentation("");
    timeField.addListener(new ValueChangeListener() {
      @Override
View Full Code Here

Examples of com.vaadin.data.validator.RegexpValidator

        AbstractTextField field = iwe.getSecret() != null && iwe.getSecret() ? new PasswordField() : new TextField();
        if (iwe.getMaxLength() != null) {
            field.setMaxLength(iwe.getMaxLength());
        }
        if (hasText(iwe.getRegexp()) && hasText(iwe.getRegexp())) {
            field.addValidator(new RegexpValidator(WidgetDefinitionLoader.replaceXmlEscapeCharacters(iwe.getRegexp()), iwe.getErrorKey() != null ?
                    iwe.getErrorKey() : getMessage("processdata.block.error.regexp").replaceFirst("%s", iwe.getRegexp())));
        }
        if (nvl(iwe.getRequired(), false)) {
            field.setRequired(true);
            if (hasText(iwe.getCaption())) {
View Full Code Here

Examples of com.vaadin.data.validator.RegexpValidator

        field.setImmediate(true);
        field.setSizeFull();
        field.setStyleName("v-colorpicker-preview-textfield");
        field.setData(this);
        field.addValueChangeListener(this);
        field.addValidator(new RegexpValidator("#[0-9a-fA-F]{6}", true, ""));
        addComponent(field);

        setColor(color);
    }
View Full Code Here

Examples of org.apache.myfaces.trinidad.validator.RegExpValidator

            return false;
        }

        String[] patterns = (String[])metaData.get(CommonMetaDataKeys.PATTERN);

        RegExpValidator regExpValidator;

        for(String pattern : patterns)
        {
            regExpValidator = (RegExpValidator)facesContext.getApplication()
                                                .createValidator("org.apache.myfaces.trinidad.RegExp");

            regExpValidator.setPattern(pattern);
            regExpValidator.setMessageDetailNoMatch((String)metaData.get(
                CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE));

            if(regExpValidator instanceof ClientValidator && uiComponent instanceof EditableValueHolder)
            {
                ((EditableValueHolder)uiComponent).addValidator(
View Full Code Here

Examples of org.apache.myfaces.trinidad.validator.RegExpValidator

            return false;
        }

        String[] patterns = (String[])metaData.get(CommonMetaDataKeys.PATTERN);

        RegExpValidator regExpValidator;

        for(String pattern : patterns)
        {
            regExpValidator = (RegExpValidator)facesContext.getApplication()
                                                .createValidator("org.apache.myfaces.trinidad.RegExp");

            regExpValidator.setPattern(pattern);
            regExpValidator.setMessageDetailNoMatch((String)metaData.get(
                CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE));

            if(regExpValidator instanceof ClientValidator && uiComponent instanceof EditableValueHolder)
            {
                ((EditableValueHolder)uiComponent).addValidator(
View Full Code Here

Examples of org.apache.myfaces.trinidad.validator.RegExpValidator

            return false;
        }

        String[] patterns = (String[])metaData.get(CommonMetaDataKeys.PATTERN);

        RegExpValidator regExpValidator;

        for(String pattern : patterns)
        {
            regExpValidator = (RegExpValidator)facesContext.getApplication()
                                                .createValidator("org.apache.myfaces.trinidad.RegExp");

            regExpValidator.setPattern(pattern);
            regExpValidator.setMessageDetailNoMatch((String)metaData.get(
                CommonMetaDataKeys.PATTERN_VALIDATION_ERROR_MESSAGE));

            ((EditableValueHolder)uiComponent).addValidator(regExpValidator);
        }
        return true;
View Full Code Here

Examples of org.apache.myfaces.trinidad.validator.RegExpValidator

  public void testNull() throws ValidatorException
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    RegExpValidator validator = new RegExpValidator();

    doTestNull(facesContext, wrapper, validator);
  }
View Full Code Here

Examples of org.apache.myfaces.trinidad.validator.RegExpValidator

  public void testNullContext()
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    RegExpValidator validator = new RegExpValidator();

    doTestNullContext(wrapper, validator);
  }
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.