Java Code Examples for com.smartgwt.client.widgets.form.fields.TextItem#setValidators()
The following examples show how to use
com.smartgwt.client.widgets.form.fields.TextItem#setValidators() .
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: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static TextItem newEmailItem(String name, String title, boolean multiple) { TextItem item = new TextItem(); item.setName(filterItemName(name)); if (title != null) item.setTitle(I18N.message(title)); else item.setShowTitle(false); if (multiple) item.setValidators(new EmailsValidator()); else item.setValidators(new EmailValidator()); item.setWrapTitle(false); item.setWidth(200); return item; }
Example 2
Source File: DigitalObjectChildrenEditor.java From proarc with GNU General Public License v3.0 | 6 votes |
private DynamicForm createParamsForm() { ClientMessages i18n = GWT.create(ClientMessages.class); DynamicForm f = new DynamicForm(); f.setAutoHeight(); TextItem newPid = new TextItem(DigitalObjectDataSource.FIELD_PID); newPid.setTitle(i18n.NewDigObject_OptionPid_Title()); newPid.setTooltip(i18n.NewDigObject_OptionPid_Hint()); newPid.setRequired(true); newPid.setLength(36 + 5); newPid.setWidth((36 + 5) * 8); newPid.setValidators(new CustomUUIDValidator(i18n)); f.setFields(newPid); f.setAutoFocus(true); return f; }
Example 3
Source File: PrinterPublisherFormFactory.java From proarc with GNU General Public License v3.0 | 6 votes |
@Override public DynamicForm create() { DynamicForm form = new DynamicForm(); form.setNumCols(6); TextItem place = new TextItem(ModsCustomDataSource.FIELD_PRINTER_PUBLISHER_PLACE, i18n.PeriodicalForm_PrinterPublisherPlace_Title()); place.setPrompt(i18n.PeriodicalForm_PrinterPublisherPlace_Hint()); place.setValidators(new StringTrimValidator()); TextItem name = new TextItem(ModsCustomDataSource.FIELD_PRINTER_PUBLISHER_NAME, i18n.PeriodicalForm_PrinterPublisherName_Title()); name.setPrompt(publisher ? i18n.PeriodicalForm_PublisherName_Hint() : i18n.PeriodicalForm_PrinterName_Hint()); name.setValidators(new StringTrimValidator()); TextItem date = new TextItem(ModsCustomDataSource.FIELD_PRINTER_PUBLISHER_DATE, i18n.PeriodicalForm_PrinterPublisherDate_Title()); date.setValidators(new StringTrimValidator()); form.setFields(name, place, date); return form; }
Example 4
Source File: StringFormFactory.java From proarc with GNU General Public License v3.0 | 6 votes |
@Override public DynamicForm create() { DynamicForm form = new DynamicForm(); TextItem value = new TextItem(name, title); value.setShowTitle(showTitle); if (width == Integer.MAX_VALUE) { value.setWidth("100%"); form.setWidth100(); } else if (width > 0) { value.setWidth(width); } value.setRequired(required); value.setValidators(new StringTrimValidator()); form.setFields(value); return form; }
Example 5
Source File: IdentifierDataSource.java From proarc with GNU General Public License v3.0 | 5 votes |
public IdentifierDataSource() { setID(ID); ClientMessages i18n = GWT.create(ClientMessages.class); SmartGwtMessages i18nSmartGwt = ClientUtils.createSmartGwtMessages(); DataSourceField type = new DataSourceField(FIELD_TYPE, FieldType.TEXT, i18n.PageForm_IdentifierType_Title()); type.setRequired(Boolean.TRUE); ComboBoxItem typeEditor = new ComboBoxItem(IdentifierDataSource.FIELD_TYPE); LocalizationDataSource.setOptionDataSource(typeEditor, BundleName.MODS_IDENTIFIER_TYPES); typeEditor.setType("comboBox"); typeEditor.setCharacterCasing(CharacterCasing.LOWER); typeEditor.setBrowserSpellCheck(Boolean.FALSE); type.setEditorType(typeEditor); DataSourceField value = new DataSourceField(FIELD_VALUE, FieldType.TEXT, i18n.PageForm_IdentifierValue_Title()); value.setRequired(Boolean.TRUE); TextItem valueEditor = new TextItem(IdentifierDataSource.FIELD_VALUE); valueEditor.setWidth("250"); valueEditor.setBrowserSpellCheck(Boolean.FALSE); valueEditor.setRequired(Boolean.TRUE); valueEditor.setValidators(new IdentifierValidator(i18n, i18nSmartGwt)); value.setEditorType(valueEditor); DataSourceField object = new DataSourceField(FIELD_VALUE, FieldType.ANY); object.setHidden(true); setFields(type, value); setClientOnly(true); setCacheAllData(true); }
Example 6
Source File: NewDigObject.java From proarc with GNU General Public License v3.0 | 5 votes |
private DynamicForm createOptionsForm() { SelectItem selectModel = new SelectItem(DigitalObjectDataSource.FIELD_MODEL, i18n.NewDigObject_OptionModel_Title()); selectModel.setRequired(true); selectModel.setWidth(300); // issue 46: always start with empty model selectModel.setAllowEmptyValue(true); selectModel.setEmptyDisplayValue(ClientUtils.format("<i><%s></i>", i18n.NewDigObject_OptionModel_EmptyValue_Title())); selectModel.setOptionDataSource(MetaModelDataSource.getInstance()); // selectModel.setShowOptionsFromDataSource(true); selectModel.setValueField(MetaModelDataSource.FIELD_PID); selectModel.setDisplayField(MetaModelDataSource.FIELD_DISPLAY_NAME); selectModel.setAutoFetchData(true); selectModel.setValidators(new CustomValidator() { @Override protected boolean condition(Object value) { boolean valid = getFormItem().getSelectedRecord() != null; return valid; } }); TextItem newPid = new TextItem(DigitalObjectDataSource.FIELD_PID); newPid.setTitle(i18n.NewDigObject_OptionPid_Title()); newPid.setTooltip(i18n.NewDigObject_OptionPid_Hint()); newPid.setLength(36 + 5); newPid.setWidth((36 + 5) * 8); newPid.setValidators(new CustomUUIDValidator(i18n)); //newPid.setValidators(new RegExpValidator( // "uuid:[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}")); DynamicForm form = new DynamicForm(); form.setWrapItemTitles(false); form.setAutoFocus(true); form.setNumCols(4); form.setBrowserSpellCheck(false); form.setFields(selectModel, newPid); form.setAutoWidth(); form.setMargin(4); return form; }
Example 7
Source File: DigitalObjectSearchView.java From proarc with GNU General Public License v3.0 | 5 votes |
private static TextItem createAdvancedItem(String name, String title, FormItemIfFunction showIf) { TextItem item = new TextItem(name, title); if (showIf != null) { item.setShowIfCondition(showIf); } item.setWidth("100%"); item.setColSpan(3); item.setValidators(new LengthRangeValidator() {{ setMax(1000); }}); return item; }
Example 8
Source File: MonographUnitForm.java From proarc with GNU General Public License v3.0 | 5 votes |
public MonographUnitForm(final ClientMessages i18n) { setWidth100(); setHeight100(); setTitleOrientation(TitleOrientation.TOP); setNumCols(1); // identifiers final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS, i18n.MonographUnitForm_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"); TextItem unitNumber = new TextItem(ModsCustomDataSource.FIELD_MONOGRAPHUNIT_NUMBER); unitNumber.setTitle(i18n.MonographUnitForm_UnitNumber_Title()); unitNumber.setRequired(true); unitNumber.setValidators(new IsIntegerValidator()); TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.MonographUnitForm_Note_Title()); note.setWidth("*"); note.setHeight("*"); note.setColSpan("*"); setFields(unitNumber, identifiers, note); }
Example 9
Source File: PersonFormFactory.java From proarc with GNU General Public License v3.0 | 5 votes |
@Override public DynamicForm create() { DynamicForm form = new DynamicForm(); form.setNumCols(4); TextItem family = new TextItem(ModsCustomDataSource.FIELD_NAME_FAMILY, i18n.PeriodicalForm_FamilyName_Title()); family.setPrompt(i18n.PeriodicalForm_FamilyName_Hint()); family.setValidators(new StringTrimValidator()); TextItem given = new TextItem(ModsCustomDataSource.FIELD_NAME_GIVEN, i18n.PeriodicalForm_GivenName_Title()); given.setPrompt(i18n.PeriodicalForm_GivenName_Hint()); given.setValidators(new StringTrimValidator()); form.setFields(family, given); return form; }
Example 10
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 11
Source File: SaveDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
public SaveDialog() { super(); setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON); setTitle(I18N.message("savesearch")); setWidth(350); setHeight(100); setCanDragResize(true); setIsModal(true); setShowModalMask(true); centerInPage(); setPadding(5); setAutoSize(true); final ValuesManager vm = new ValuesManager(); final DynamicForm form = new DynamicForm(); form.setValuesManager(vm); form.setWidth(350); form.setMargin(5); TextItem name = ItemFactory.newTextItem("name", "name", null); name.setRequired(true); name.setValidators(new SimpleTextValidator()); name.setWidth(100); TextItem description = ItemFactory.newTextItem("description", "description", null); description.setWidth(300); ButtonItem save = new ButtonItem(); save.setTitle(I18N.message("save")); save.setAutoFit(true); save.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vm.validate(); if (!vm.hasErrors()) { final GUISearchOptions options = Search.get().getOptions(); options.setName(vm.getValueAsString("name")); options.setDescription(vm.getValueAsString("description")); SearchService.Instance.get().save(Search.get().getOptions(), new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Boolean b) { if (!b) SC.warn(I18N.message("duplicateelement")); else { SavedSearchesPanel.get().addEntry( vm.getValueAsString("name"), vm.getValueAsString("description"), options.getType() == GUISearchOptions.TYPE_FULLTEXT ? I18N.message("fulltext") : I18N.message("parametric")); destroy(); } } }); } } }); form.setFields(name, description, save); addItem(form); }
Example 12
Source File: DigitalObjectSearchView.java From proarc with GNU General Public License v3.0 | 4 votes |
private DynamicForm createFilter() { DynamicForm form = new DynamicForm(); form.setBrowserSpellCheck(false); form.setValidateOnExit(true); form.setSaveOnEnter(true); form.setAutoHeight(); form.setWidth100(); form.setNumCols(6); final RadioGroupItem filterType = new RadioGroupItem(DigitalObjectResourceApi.SEARCH_TYPE_PARAM); filterType.setVertical(false); filterType.setShowTitle(false); filterType.setWrap(false); // setRedrawOnChange(true) enforces evaluation of other FormItem.setShowIfCondition filterType.setRedrawOnChange(true); filterType.setColSpan(5); final LinkedHashMap<String, String> filterMap = new LinkedHashMap<String, String>(); filterMap.put(FILTER_ALPHABETICAL, i18n.DigitalObjectSearchView_FilterGroupAlphabetical_Title()); filterMap.put(FILTER_LAST_CREATED, i18n.DigitalObjectSearchView_FilterGroupLastCreated_Title()); filterMap.put(FILTER_LAST_MODIFIED, i18n.DigitalObjectSearchView_FilterGroupLastModified_Title()); if (!Editor.getInstance().hasPermission("proarc.permission.repository.search.groupOwner")) { filterMap.put(FILTER_PHRASE, i18n.DigitalObjectSearchView_FilterGroupPhrase_Title()); } filterMap.put(FILTER_QUERY, i18n.DigitalObjectSearchView_FilterGroupAdvanced_Title()); if (Editor.getInstance().hasPermission("proarc.permission.admin")) { filterMap.put(FILTER_DELETED, i18n.DigitalObjectSearchView_FilterGroupDeleted_Title()); } filterType.setValueMap(filterMap); filterType.setValue(FILTER_LAST_CREATED); FormItemIfFunction showIfAdvanced = new StringMatchFunction(filterType, FILTER_QUERY, FILTER_DELETED); FormItemIfFunction showIfPhrase = new StringMatchFunction(filterType, FILTER_PHRASE); FormItemIfFunction showIfCreatedModifiedQuery = new StringMatchFunction(filterType, FILTER_LAST_CREATED, FILTER_LAST_MODIFIED, FILTER_QUERY, FILTER_DELETED, FILTER_ALPHABETICAL); FormItemIfFunction showIfAplhabetical = new StringMatchFunction(filterType, FILTER_LAST_CREATED, FILTER_LAST_MODIFIED, FILTER_ALPHABETICAL); final TextItem phrase = createAdvancedItem(DigitalObjectResourceApi.SEARCH_PHRASE_PARAM, i18n.DigitalObjectSearchView_FilterPhrase_Title(), showIfPhrase); phrase.setValidators(new RequiredIfValidator(new RequiredIfFunction() { @Override public boolean execute(FormItem formItem, Object value) { return FILTER_PHRASE.equals(filterType.getValueAsString()); } }), new LengthRangeValidator() {{ setMax(1000); }}); SubmitItem submit = new SubmitItem("search", i18n.DigitalObjectSearchView_FilterSearchButton_Title()); form.setFields(filterType, createSpacerItem("100%", null), phrase, createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_TITLE_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedTitle_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_IDENTIFIER_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedIdentifier_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_CREATOR_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedCreator_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_QUERY_LABEL_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedLabel_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createAdvancedItem(DigitalObjectResourceApi.SEARCH_OWNER_PARAM, i18n.DigitalObjectSearchView_FilterAdvancedOwner_Title(), showIfAdvanced), createSpacerItem("100%", showIfAdvanced), createModelItem(i18n.DigitalObjectSearchView_FilterAdvancedModel_Title(), showIfCreatedModifiedQuery), createSortItem(i18n.DigitalObjectSearchView_FilterSort_Title(), showIfAplhabetical), createRememberModelItem(i18n.DigitalObjectSearchView_FilterAdvancedModel_Remember_Title(), showIfCreatedModifiedQuery), createSpacerItem("100%", showIfCreatedModifiedQuery), submit); form.addSubmitValuesHandler(new SubmitValuesHandler() { @Override public void onSubmitValues(SubmitValuesEvent event) { if (filters.validate(false)) { filter(); } } }); return form; }
Example 13
Source File: NdkAudioPageForm.java From proarc with GNU General Public License v3.0 | 4 votes |
/** * Create a new form. * @param i18n I18N * @param typeValueMapId {@link ValueMapDataSource#getOptionDataSource} * reference to bundle with page types. */ public NdkAudioPageForm(ClientMessages i18n, String typeValueMapId) { // save on Enter is supposed mainly for ImportBatchItemEditor // see submit handler in ModsMultiEditor setSaveOnEnter(true); setWidth100(); setHeight100(); setTitleOrientation(TitleOrientation.TOP); TextItem pageType = new TextItem(ModsCustomDataSource.FIELD_PAGE_TYPE); pageType.setTitle(i18n.PageForm_PageType_Title()); pageType.setEndRow(true); pageType.setRequired(true); pageType.setReadOnly(); pageType.disable(); IntegerItem pageIndex = new IntegerItem(ModsCustomDataSource.FIELD_PAGE_INDEX); pageIndex.setTitle(i18n.PageForm_PageIndex_Title()); pageIndex.setValidators(new IsIntegerValidator()); pageIndex.setRequired(true); pageIndex.setEndRow(true); TextItem pageNumber = new TextItem(ModsCustomDataSource.FIELD_PAGE_NUMBER); pageNumber.setTitle(i18n.PageForm_PageNumber_Title()); pageNumber.setEndRow(true); pageNumber.setRequired(true); pageNumber.setValidators(new StringTrimValidator()); // pageNumber.setLength(5); final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS, i18n.PageForm_Identifiers_Title()); identifiers.setDataSource(IdentifierDataSource.getInstance()); identifiers.setRequired(true); 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("3"); // TextAreaItem note = new AutoFitTextAreaItem(ModsCustomDataSource.FIELD_NOTE, "Note"); TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PageForm_Note_Title()); note.setWidth("*"); //https://github.com/proarc/proarc/issues/645 GWT v.6.0-p20161023 form draw issue note.setHeight("*"); note.setColSpan("*"); setFields(pageType, pageIndex, pageNumber, identifiers, note); IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator(); integerRangeValidator.setMin(0); integerRangeValidator.setMax(Integer.MAX_VALUE); pageIndex.setValidators(integerRangeValidator); }
Example 14
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 15
Source File: PageForm.java From proarc with GNU General Public License v3.0 | 4 votes |
/** * Create a new form. * @param i18n I18N * @param typeValueMapId {@link ValueMapDataSource#getOptionDataSource} * reference to bundle with page types. */ public PageForm(ClientMessages i18n, String typeValueMapId) { // save on Enter is supposed mainly for ImportBatchItemEditor // see submit handler in ModsMultiEditor setSaveOnEnter(true); setWidth100(); setHeight100(); setTitleOrientation(TitleOrientation.TOP); SelectItem pageType = new SelectItem(ModsCustomDataSource.FIELD_PAGE_TYPE, i18n.PageForm_PageType_Title()); pageType.setOptionDataSource(ValueMapDataSource.getInstance().getOptionDataSource(typeValueMapId)); pageType.setValueField(BundleValue.KEY); pageType.setDisplayField(BundleValue.VALUE); pageType.setDefaultValue(ModsCustomDataSource.getDefaultPageType()); pageType.setWidth(200); pageType.setEndRow(true); IntegerItem pageIndex = new IntegerItem(ModsCustomDataSource.FIELD_PAGE_INDEX); pageIndex.setTitle(i18n.PageForm_PageIndex_Title()); pageIndex.setValidators(new IsIntegerValidator()); pageIndex.setRequired(true); pageIndex.setEndRow(true); TextItem pageNumber = new TextItem(ModsCustomDataSource.FIELD_PAGE_NUMBER); pageNumber.setTitle(i18n.PageForm_PageNumber_Title()); pageNumber.setEndRow(true); pageNumber.setRequired(true); pageNumber.setValidators(new StringTrimValidator()); // pageNumber.setLength(5); final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS, i18n.PageForm_Identifiers_Title()); identifiers.setDataSource(IdentifierDataSource.getInstance()); identifiers.setRequired(true); 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("3"); // TextAreaItem note = new AutoFitTextAreaItem(ModsCustomDataSource.FIELD_NOTE, "Note"); TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PageForm_Note_Title()); note.setWidth("*"); //https://github.com/proarc/proarc/issues/645 GWT v.6.0-p20161023 form draw issue note.setHeight("*"); note.setColSpan("*"); setFields(pageType, pageIndex, pageNumber, identifiers, note); IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator(); integerRangeValidator.setMin(0); integerRangeValidator.setMax(Integer.MAX_VALUE); pageIndex.setValidators(integerRangeValidator); }
Example 16
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 2 votes |
/** * Creates a new TextItem that validates a simple text * * @param name The item name (mandatory) * @param title The item title (mandatory) * @param value The item value (optional) * * @return the new item */ public static TextItem newSimpleTextItem(String name, String title, String value) { TextItem item = newTextItem(filterItemName(name), I18N.message(title), value); item.setValidators(new SimpleTextValidator()); return item; }