Java Code Examples for com.smartgwt.client.widgets.form.fields.SelectItem#setOptionDataSource()
The following examples show how to use
com.smartgwt.client.widgets.form.fields.SelectItem#setOptionDataSource() .
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 newWorkflowSelector() { SelectItem item = new SelectItem("workflow", I18N.message("workflow")); item.setRequiredMessage(I18N.message("fieldrequired")); ListGridField name = new ListGridField("name", I18N.message("name")); ListGridField description = new ListGridField("description", I18N.message("description")); item.setWidth(250); item.setPickListWidth(300); item.setPickListFields(name, description); item.setDisplayField("name"); item.setValueField("id"); item.setWrapTitle(false); item.setOptionDataSource(new WorkflowsDS(false, true)); if (!Feature.enabled(Feature.WORKFLOW)) item.setDisabled(true); 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 newStorageSelector(String name, Integer value) { SelectItem item = new SelectItem(); item.setName(filterItemName(name)); item.setTitle(I18N.message("storage")); item.setWrapTitle(false); item.setDisplayField("name"); item.setValueField("id"); item.setWidth(100); ListGridField nameField = new ListGridField("name", I18N.message("name")); nameField.setWidth("*"); nameField.setShowTitle(false); item.setPickListFields(nameField); item.setOptionDataSource(new StoragesDS(true, false)); if (value != null) item.setValue(value.toString()); return item; }
Example 3
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Creates a select list with the barcode templates * * @param withEmpty id an empty row must be shown * @param filterTemplateId the document template id to filter the ocr * templates * @param selectedTemplateId identifier of the template to be selected by * default * * @return the item */ public static SelectItem newBarcodeTemplateSelector(boolean withEmpty, Long filterTemplateId, Long selectedTemplateId) { SelectItem templateItem = new SelectItem("barcodetemplate", I18N.message("barcodetemplate")); templateItem.setDisplayField("name"); templateItem.setValueField("id"); templateItem.setWidth(150); templateItem.setMultiple(false); templateItem.setWrapTitle(false); templateItem.setMultipleAppearance(MultipleAppearance.PICKLIST); templateItem.setOptionDataSource(new BarcodeTemplatesDS(withEmpty, filterTemplateId)); if (selectedTemplateId != null) templateItem.setValue(selectedTemplateId.toString()); return templateItem; }
Example 4
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static SelectItem newUserSelector(String name, String title, String groupIdOrName, boolean required) { SelectItem user = new SelectItem(filterItemName(name)); user.setTitle(I18N.message(title)); user.setWrapTitle(false); ListGridField id = new ListGridField("id", I18N.message("id")); id.setHidden(true); ListGridField username = new ListGridField("username", I18N.message("username")); ListGridField label = new ListGridField("label", I18N.message("name")); user.setValueField("id"); user.setDisplayField("username"); user.setPickListWidth(300); user.setPickListFields(id, username, label); user.setOptionDataSource(new UsersDS(groupIdOrName, required)); user.setPickListProperties(new UserPickListProperties()); return user; }
Example 5
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static SelectItem newTemplateSelector(boolean withEmpty, Long selectedTemplateId) { SelectItem templateItem = new SelectItem("template", I18N.message("template")); templateItem.setDisplayField("name"); templateItem.setValueField("id"); templateItem.setWidth(150); templateItem.setMultiple(false); templateItem.setWrapTitle(false); templateItem.setMultipleAppearance(MultipleAppearance.PICKLIST); templateItem.setOptionDataSource(new TemplatesDS(withEmpty, selectedTemplateId, null)); if (!Feature.enabled(Feature.TEMPLATE)) templateItem.setDisabled(true); if (selectedTemplateId != null) templateItem.setValue(selectedTemplateId.toString()); return templateItem; }
Example 6
Source File: UrnNbnAction.java From proarc with GNU General Public License v3.0 | 6 votes |
private DynamicForm createOptionResolver() { DynamicForm form = new DynamicForm(); SelectItem selection = new SelectItem(UrnNbnResourceApi.FIND_RESOLVER_PARAM, i18n.UrnNbnAction_Window_Select_Title()); selection.setRequired(true); selection.setOptionDataSource(UrnNbnResolverDataSource.getInstance()); selection.setValueField(UrnNbnResourceApi.RESOLVER_ID); selection.setDisplayField(UrnNbnResourceApi.RESOLVER_NAME); selection.setAutoFetchData(true); selection.setDefaultToFirstOption(true); selection.setWidth(350); selection.setAutoFetchData(true); form.setFields(selection); form.setBrowserSpellCheck(false); form.setWrapItemTitles(false); form.setTitleOrientation(TitleOrientation.TOP); return form; }
Example 7
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newArchiveSelector(int mode, Integer status) { SelectItem item = new SelectItem("archive"); item.setTitle(""); item.setRequiredMessage(I18N.message("fieldrequired")); ListGridField name = new ListGridField("name", I18N.message("name")); ListGridField description = new ListGridField("description", I18N.message("description")); item.setValueField("id"); item.setDisplayField("name"); item.setPickListWidth(300); item.setPickListFields(name, description); item.setOptionDataSource(new ArchivesDS(mode, null, status, null)); if (!Feature.enabled(Feature.IMPEX)) item.setDisabled(true); return item; }
Example 8
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newAttributesSelector() { final SelectItem selectItem = new SelectItem("attributes", I18N.message("attributes")); selectItem.setMultiple(true); selectItem.setMultipleAppearance(MultipleAppearance.PICKLIST); selectItem.setDisplayField("label"); selectItem.setValueField("name"); selectItem.setPickListWidth(150); selectItem.setOptionDataSource(new AttributesDS()); selectItem.setWrapTitle(false); return selectItem; }
Example 9
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newAttributeSetSelector() { final SelectItem selectItem = new SelectItem("attributeset", I18N.message("attributeset")); selectItem.setMultiple(false); selectItem.setMultipleAppearance(MultipleAppearance.PICKLIST); selectItem.setDisplayField("name"); selectItem.setValueField("id"); selectItem.setWidth(120); selectItem.setOptionDataSource(new AttributeSetsDS(false, GUIAttributeSet.TYPE_DEFAULT)); selectItem.setWrapTitle(false); return selectItem; }
Example 10
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * Creates a select list with the OCR templates * * @param withEmpty id an empty row must be shown * @param filterTemplateId the document template id to filter the ocr * templates * @param selectedTemplateId identifier of the template to be selected by * default * * @return the item */ public static SelectItem newOCRTemplateSelector(boolean withEmpty, Long filterTemplateId, Long selectedTemplateId) { SelectItem templateItem = new SelectItem("ocrtemplate", I18N.message("ocrtemplate")); templateItem.setDisplayField("name"); templateItem.setValueField("id"); templateItem.setWidth(150); templateItem.setMultiple(false); templateItem.setWrapTitle(false); templateItem.setMultipleAppearance(MultipleAppearance.PICKLIST); templateItem.setOptionDataSource(new OCRTemplatesDS(withEmpty, filterTemplateId)); if (selectedTemplateId != null) templateItem.setValue(selectedTemplateId.toString()); return templateItem; }
Example 11
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newConversionFormatItem(String fileName) { SelectItem select = ItemFactory.newSelectItem("format", I18N.message("format")); select.setMultiple(false); select.setWrapTitle(false); select.setOptionDataSource(new ConversionFormatsDS(fileName)); select.setValueField("extension"); select.setDisplayField("extension"); return select; }
Example 12
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newDashletSelector(String name, String title) { SelectItem select = new SelectItem(filterItemName(name), title); select.setAllowEmptyValue(false); select.setOptionDataSource(new DashletsDS()); select.setPickListWidth(200); select.setDisplayField("title"); select.setValueField("name"); return select; }
Example 13
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newTagsMultiplePickList(String name, String title, TagsDS options, Object[] tags) { final SelectItem item = newSelectItem(name, title); item.setMultiple(true); item.setMultipleAppearance(MultipleAppearance.PICKLIST); item.setValueField("word"); item.setDisplayField("word"); item.setOptionDataSource(options); if (tags != null) item.setValue(tags); return item; }
Example 14
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 15
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newFormSelector() { SelectItem item = new SelectItem("form", I18N.message("form")); item.setRequiredMessage(I18N.message("fieldrequired")); ListGridField name = new ListGridField("name", I18N.message("name")); item.setPickListFields(name); item.setDisplayField("name"); item.setValueField("id"); item.setWrapTitle(false); item.setOptionDataSource(new FormsDS()); if (!Feature.enabled(Feature.FORM)) item.setDisabled(true); return item; }
Example 16
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newStampSelector() { SelectItem item = new SelectItem("stamp", I18N.message("stamp")); item.setRequiredMessage(I18N.message("fieldrequired")); ListGridField name = new ListGridField("name", I18N.message("name")); item.setWidth(200); item.setPickListWidth(200); item.setPickListFields(name); item.setDisplayField("name"); item.setValueField("id"); item.setWrapTitle(false); item.setOptionDataSource(new StampsDS(Session.get().getUser().getId(), true)); if (!Feature.enabled(Feature.STAMP)) item.setDisabled(true); return item; }
Example 17
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newFolderTemplateSelector() { SelectItem item = new SelectItem("foldertemplate"); item.setTitle(I18N.message("foldertemplate")); item.setRequiredMessage(I18N.message("fieldrequired")); item.setValueField("id"); item.setDisplayField("name"); item.setWrapTitle(false); item.setOptionDataSource(new FolderTemplatesDS()); if (!Feature.enabled(Feature.FOLDER_TEMPLATE)) item.setDisabled(true); return item; }
Example 18
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public static SelectItem newStorageTypeSelector() { SelectItem item = new SelectItem("type", I18N.message("type")); item.setWidth(140); item.setWrapTitle(false); item.setDisplayField("name"); item.setValueField("id"); item.setOptionDataSource(new StoragesTypesDS()); return item; }
Example 19
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 20
Source File: WorkflowNewJobView.java From proarc with GNU General Public License v3.0 | 4 votes |
private SelectItem createProfileSelector() { final SelectItem profile = new SelectItem(WorkflowResourceApi.NEWJOB_PROFILE, i18n.WorkflowJob_NewJobView_Field_Profile_Title()); profile.setOptionDataSource(WorkflowProfileDataSource.getInstance()); profile.setValueField(WorkflowProfileDataSource.FIELD_ID); profile.setDisplayField(WorkflowProfileDataSource.FIELD_LABEL); profile.setOptionCriteria(new Criteria(WorkflowProfileDataSource.FIELD_DISABLED, Boolean.FALSE.toString())); profile.setFilterLocally(true); profile.setRequired(true); profile.setWidth(300); profile.setAllowEmptyValue(true); ListGrid profilePickListProperties = new ListGrid(); profilePickListProperties.setCanHover(true); profilePickListProperties.setShowHover(true); profilePickListProperties.setHoverWidth(300); profilePickListProperties.setHoverCustomizer(new HoverCustomizer() { @Override public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) { String hint = record.getAttribute(WorkflowProfileDataSource.FIELD_HINT); return hint; } }); profile.setPickListProperties(profilePickListProperties); profile.addDataArrivedHandler(new DataArrivedHandler() { @Override public void onDataArrived(DataArrivedEvent event) { if (event.getStartRow() == 0) { ResultSet data = event.getData(); int length = data.getLength(); if (length == 1) { Record r = data.get(0); String profileId = r.getAttribute(WorkflowProfileDataSource.FIELD_ID); profile.setValue(profileId); profile.setDefaultValue(profileId); fetchModelMenu(r); // fill up model menu on init } } } }); return profile; }