Java Code Examples for com.smartgwt.client.widgets.form.fields.SelectItem#setDefaultValue()
The following examples show how to use
com.smartgwt.client.widgets.form.fields.SelectItem#setDefaultValue() .
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 SelectItem newCharsetSelector(String name) { SelectItem item = new SelectItem(); item.setName(filterItemName(name)); item.setTitle(I18N.message("charset")); item.setWrapTitle(false); item.setDefaultValue("UTF-8"); item.setDisplayField("name"); item.setValueField("code"); ListGridField code = new ListGridField("code", I18N.message("code")); code.setWidth(90); code.setHidden(true); code.setShowTitle(false); ListGridField nameField = new ListGridField("name", I18N.message("name")); nameField.setWidth("*"); nameField.setShowTitle(false); item.setPickListFields(code, nameField); item.setOptionDataSource(new CharsetsDS()); return item; }
Example 2
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static SelectItem newTagInputMode(String name, String title) { SelectItem mode = new SelectItem(); LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>(); opts.put("free", I18N.message("free")); opts.put("preset", I18N.message("preset")); mode.setValueMap(opts); mode.setName(filterItemName(name)); if (title != null) mode.setTitle(I18N.message(title)); else mode.setShowTitle(false); mode.setWrapTitle(false); mode.setDefaultValue("free"); mode.setWidth(150); return mode; }
Example 3
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static SelectItem newRetentionDateOption(int value) { SelectItem selector = new SelectItem("dateoption", I18N.message("dateoption")); LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>(); opts.put("" + GUIRetentionPolicy.DATE_OPT_CREATION, I18N.message("created")); opts.put("" + GUIRetentionPolicy.DATE_OPT_PUBLISHED, I18N.message("published")); opts.put("" + GUIRetentionPolicy.DATE_OPT_STOPPUBLISHING, I18N.message("stoppublishing")); opts.put("" + GUIRetentionPolicy.DATE_OPT_ARCHIVED, I18N.message("archiveds")); selector.setValueMap(opts); selector.setWrapTitle(false); selector.setWidth(150); selector.setValue("" + value); selector.setDefaultValue("" + value); return selector; }
Example 4
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static SelectItem newImportFolderProviderOption(String value) { SelectItem selector = new SelectItem("provider", I18N.message("type")); LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>(); if (Feature.enabled(Feature.IMPORT_LOCAL_FOLDERS)) opts.put(GUIImportFolder.PROVIDER_FILE, I18N.message("localfolder")); if (Feature.enabled(Feature.IMPORT_REMOTE_FOLDERS)) { opts.put(GUIImportFolder.PROVIDER_SMB, I18N.message("smbshare")); opts.put(GUIImportFolder.PROVIDER_SMB2, I18N.message("smb2share")); opts.put(GUIImportFolder.PROVIDER_SMB3, I18N.message("smb3share")); opts.put(GUIImportFolder.PROVIDER_FTP, I18N.message("fftp")); opts.put(GUIImportFolder.PROVIDER_FTPS, I18N.message("ftps")); opts.put(GUIImportFolder.PROVIDER_SFTP, I18N.message("sftp")); } selector.setValueMap(opts); selector.setWrapTitle(false); selector.setWidth(150); selector.setValue(value); selector.setDefaultValue(value); return selector; }
Example 5
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static SelectItem newRetentionAction(int value) { SelectItem selector = new SelectItem("action", I18N.message("action")); LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>(); opts.put("" + GUIRetentionPolicy.ACTION_ARCHIVE, I18N.message("archive")); opts.put("" + GUIRetentionPolicy.ACTION_UNPUBLISH, I18N.message("unpublish")); opts.put("" + GUIRetentionPolicy.ACTION_DELETE, I18N.message("ddelete")); selector.setValueMap(opts); selector.setWrapTitle(false); selector.setWidth(150); selector.setValue("" + value); selector.setDefaultValue("" + value); return selector; }
Example 6
Source File: FormGenerator.java From proarc with GNU General Public License v3.0 | 5 votes |
public SelectItem getSelectItem(Field f, String lang) { SelectItem item = new SelectItem(f.getName(), f.getTitle(lang)); if (f.getOptionDataSource() != null) { setOptionDataSource(item, f, lang); } else { item.setValueMap(f.getValueMap()); } item.setDefaultValue(f.getDefaultValue()); return item; }
Example 7
Source File: DigitalObjectSearchView.java From proarc with GNU General Public License v3.0 | 5 votes |
private FormItem createSortItem(String title, FormItemIfFunction showIf) { SelectItem item = new SelectItem(DigitalObjectResourceApi.SEARCH_SORT_PARAM, title); item.setWidth(300); item.setAllowEmptyValue(false); LinkedHashMap<String, String> valueMap = new LinkedHashMap(); valueMap.put("asc", i18n.DigitalObjectSearchView_FilterAsc_Title()); valueMap.put("desc", i18n.DigitalObjectSearchView_FilterDesc_Title()); item.setDefaultValue("desc"); item.setValueMap(valueMap); if (showIf != null) { item.setShowIfCondition(showIf); } return item; }
Example 8
Source File: PageMetadataEditor.java From proarc with GNU General Public License v3.0 | 5 votes |
/** * @see #setPageTypeValueMapId */ private void createPageTypeUi() { formPageType = createForm(); allowPageTypes = new CheckboxItem("fillPageTypes", i18n.PageMetadataEditor_CheckboxPageTypes_Title()); allowPageTypes.setStartRow(true); allowPageTypes.setColSpan("*"); allowPageTypes.setShowTitle(false); pageType = new SelectItem(ModsCustomDataSource.FIELD_PAGE_TYPE, i18n.PageForm_PageType_Title()); pageType.setDefaultValue(ModsCustomDataSource.getDefaultPageType()); pageType.setValue(ModsCustomDataSource.getDefaultPageType()); allowPageTypes.addChangedHandler(new DisableStateHandler(pageType)); }
Example 9
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 10
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)); }