com.smartgwt.client.widgets.form.validator.RegExpValidator Java Examples
The following examples show how to use
com.smartgwt.client.widgets.form.validator.RegExpValidator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PeriodicalVolumeForm.java From proarc with GNU General Public License v3.0 | 5 votes |
public PeriodicalVolumeForm(ClientMessages i18n) { setWidth100(); setHeight100(); setTitleOrientation(TitleOrientation.TOP); setNumCols(1); TextItem volumeNumber = new TextItem(ModsCustomDataSource.FIELD_PER_VOLUME_NUMBER, i18n.PeriodicalVolumeForm_Number_Title()); volumeNumber.setRequired(true); // javascript regexp ^([1-9]\d{0,4}(-[1-9]\d{0,4})?)$ volumeNumber.setValidators(new StringTrimValidator(), new RegExpValidator("^([1-9]\\d{0,4}(-[1-9]\\d{0,4})?)$")); TextItem date = new TextItem(ModsCustomDataSource.FIELD_PER_VOLUME_YEAR, i18n.PeriodicalVolumeForm_Date_Title()); date.setRequired(true); // issue 43; see https://docs.google.com/document/d/1zSriHPdnUY5d_tKv0M8a6nEym560DKh2H6XZ24tGAEw/edit?pli=1 // javascript regexp ^([1-9]\d{3}(-[1-9]\d{3})?)$ date.setValidators(new StringTrimValidator(), new RegExpValidator("^([1-9]\\d{3}(-[1-9]\\d{3})?)$")); date.setEndRow(true); // identifiers final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS, i18n.PeriodicalVolumeForm_Identifiers_Title()); identifiers.setDataSource(IdentifierDataSource.getInstance()); identifiers.setValidators( new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID))); DynamicForm identifierForm = new DynamicForm(); identifierForm.setUseAllDataSourceFields(true); identifierForm.setNumCols(4); identifiers.setFormPrototype(identifierForm); identifiers.setEndRow(true); identifiers.setColSpan("2"); TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PeriodicalVolumeForm_Note_Title()); note.setWidth("*"); note.setHeight("*"); note.setColSpan("*"); setFields(volumeNumber, date, identifiers, note); }
Example #2
Source File: RegisterLayout.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
public RegisterLayout() { super(i18n.registration()); setStyleName("n52_sensorweb_client_form_content"); DataSourceTextField userNameField = new DataSourceTextField("userName", i18n.userName(), 50, true); DataSourceTextField nameField = new DataSourceTextField("name", i18n.name(), 50, false); DataSourcePasswordField passwordField = new DataSourcePasswordField("password", i18n.password(), 20, true); DataSourceTextField emailField = new DataSourceTextField("email", i18n.email(), 100, true); RegExpValidator emailValidator = new RegExpValidator(); emailValidator.setErrorMessage(i18n.invalidEmail()); emailValidator.setExpression("^([a-zA-Z0-9_.\\-+])+@(([a-zA-Z0-9\\-])+\\.)+[a-zA-Z0-9]{2,4}$"); emailField.setValidators(emailValidator); DataSource dataSource = new DataSource(); dataSource.setFields(userNameField, nameField, passwordField, emailField); this.form.setDataSource(dataSource); createNameTextInputs(); createPasswordTextInputs(); createEmailTextInputs(); createAcceptTermsOfUse(); ButtonItem registerButton = createRegisterButton(); LinkItem backToLoginLink = createBackToLoginLink(); this.form.setFields(this.headerItem, this.userNameItem, this.nameItem, this.passwordItem, this.verifyPasswordItem, this.emailItem, this.verifyEmailItem, this.linkTerms, this.acceptBox, registerButton, backToLoginLink); addMember(this.form); setAutoWidth(); }
Example #3
Source File: PeriodicalIssueForm.java From proarc with GNU General Public License v3.0 | 4 votes |
public PeriodicalIssueForm(ClientMessages i18n) { setWidth100(); setHeight100(); setTitleOrientation(TitleOrientation.TOP); setNumCols(1); ComboBoxItem issueSequenceNumber = new ComboBoxItem(ModsCustomDataSource.FIELD_PER_ISSUE_NUMBER_SORTING, i18n.PeriodicalIssueForm_NumberSorting_Title()); issueSequenceNumber.setRequired(true); issueSequenceNumber.setValidators(new StringTrimValidator(), new RegExpValidator( "^([1-9]\\d{0,4}(-[1-9]\\d{0,4})?|mimořádné|zvláštní|na ukázku)$")); issueSequenceNumber.setValueMap("mimořádné", "na ukázku", "zvláštní"); issueSequenceNumber.setHideEmptyPickList(true); TextItem date = new TextItem(ModsCustomDataSource.FIELD_PER_ISSUE_DATE, i18n.PeriodicalIssueForm_Date_Title()); date.setRequired(true); // issue 43, see https://docs.google.com/document/d/1zSriHPdnUY5d_tKv0M8a6nEym560DKh2H6XZ24tGAEw/edit?pli=1 // YYYY|YYYY-YYYY|MM.YYYY|MM.-MM.YYYY|DD.MM.YYYY|DD.-DD.MM.YYYY // javascript regex ^([1-9]\d{3}(-[1-9]\d{3})?|(1\d|[1-9])\.(-(1\d|[1-9])\.)?[1-9]\d{3}|([123]\d|[1-9])\.(1\d|[1-9])\.(-([123]\d|[1-9])\.(1\d|[1-9])\.)?[1-9]\d{3})$ date.setValidators(new StringTrimValidator(), new RegExpValidator( "^([1-9]\\d{3}(-[1-9]\\d{3})?|(1\\d|[1-9])\\.(-(1\\d|[1-9])\\.)?[1-9]\\d{3}|([123]\\d|[1-9])\\.(1\\d|[1-9])\\.(-([123]\\d|[1-9])\\.(1\\d|[1-9])\\.)?[1-9]\\d{3})$")); // identifiers final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS, i18n.PeriodicalIssueForm_Identifiers_Title()); identifiers.setDataSource(IdentifierDataSource.getInstance()); identifiers.setValidators( new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID))); DynamicForm identifierForm = new DynamicForm(); identifierForm.setUseAllDataSourceFields(true); identifierForm.setNumCols(4); identifiers.setFormPrototype(identifierForm); identifiers.setEndRow(true); identifiers.setColSpan("2"); TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PeriodicalIssueForm_Note_Title()); note.setWidth("*"); note.setHeight("*"); note.setColSpan("*"); setFields(issueSequenceNumber, date, identifiers, note); }
Example #4
Source File: PageMetadataEditor.java From proarc with GNU General Public License v3.0 | 4 votes |
private void createPageNumberUi() { formPageNumber = createForm(); allowPageNumbers = new CheckboxItem("fillPageNumbers", i18n.PageMetadataEditor_CheckboxPageNubers_Title()); allowPageNumbers.setStartRow(true); allowPageNumbers.setColSpan("*"); allowPageNumbers.setShowTitle(false); PageNumberChangeHandler pageNumberChangeHandler = new PageNumberChangeHandler(); integerStartValidator = new IntegerRangeValidator(); integerStartValidator.setMin(0); integerStartValidator.setMax(1000000); romanStartValidator = new RegExpValidator( "^[1-9][0-9]{0,6}$" + "|^[mM]{0,6}([cC][mM]|[cC][dD]|[dD]?[cC]{0,3})([xX][cC]|[xX][lL]|[lL]?[xX]{0,3})([iI][xX]|[iI][vV]|[vV]?[iI]{0,3})$"); alphabetStartValidator = new RegExpValidator("^[a-zA-Z]{0,6}$"); numberStartRequired = new RequiredIfValidator(new RequiredIfFunction() { @Override public boolean execute(FormItem formItem, Object value) { return true; } }); numberStart = new TextItem("numberStart", i18n.PageMetadataEditor_NumberStartValue_Title()); numberStart.addChangedHandler(pageNumberChangeHandler); prefix = new TextItem("prefix", i18n.PageMetadataEditor_NumberPrefix_Title()); prefix.setLength(20); prefix.addChangedHandler(pageNumberChangeHandler); suffix = new TextItem("suffix", i18n.PageMetadataEditor_NumberSuffix_Title()); suffix.setLength(20); suffix.addChangedHandler(pageNumberChangeHandler); integerIncrementValidator = new IntegerRangeValidator(); integerIncrementValidator.setMin(-1000); integerIncrementValidator.setMax(1000); numberIncrement = new IntegerItem("numberIncrement", i18n.PageMetadataEditor_NumberIncrement_Title()); numberIncrement.addChangedHandler(pageNumberChangeHandler); numberIncrement.setRequired(true); numberIncrement.setValidators(integerIncrementValidator); numberExample = new StaticTextItem("numberExample", i18n.PageMetadataEditor_NumberPreview_Title()); numberExample.setClipValue(true); numberExample.setWidth(120); // enforce clip value seriesType = new SelectItem("seriesType", i18n.PageMetadataEditor_NumberSeriesType_Title()); seriesType.setValueMap(ARABIC_SERIES, ROMAN_UPPER_SERIES, ROMAN_LOWER_SERIES, ALPHABET_UPPER_SERIES, ALPHABET_LOWER_SERIES); seriesType.setDefaultValue(ARABIC_SERIES); seriesType.setValue(ARABIC_SERIES); seriesType.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { setSequenceType(seriesType.getValueAsString()); } }); allowPageNumbers.addChangedHandler(new DisableStateHandler( prefix, numberStart, numberIncrement, suffix, seriesType, numberExample)); }