com.smartgwt.client.widgets.form.fields.ComboBoxItem Java Examples
The following examples show how to use
com.smartgwt.client.widgets.form.fields.ComboBoxItem.
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 MultiComboBoxItem newMultipleUsersSelector(String name, String title, long[] selection) { String[] ids = null; if (selection != null) { ids = new String[selection.length]; for (int i = 0; i < ids.length; i++) ids[i] = Long.toString(selection[i]); } MultiComboBoxItem item = ItemFactory.newMultiComboBoxItem(name, title, new UsersDS(null, false), ids); item.setValueField("id"); item.setDisplayField("username"); ComboBoxItem combo = new ComboBoxItem(); combo.setHint(I18N.message("enterusers")); item.setAutoChildProperties("comboBox", combo); return item; }
Example #2
Source File: ItemFactory.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static ComboBoxItem newEmailComboSelector(String name, String title) { final ComboBoxItem selector = new ComboBoxItem(filterItemName(name)); selector.setTitle(I18N.message(title)); selector.setWrapTitle(false); selector.setValueField("email"); selector.setDisplayField("email"); selector.setPickListWidth(350); selector.setFetchDelay(2000); selector.setHideEmptyPickList(true); ListGridField email = new ListGridField("email", I18N.message("email")); email.setWidth("*"); ListGridField firstName = new ListGridField("firstName", I18N.message("firstname")); firstName.setWidth(90); ListGridField lastName = new ListGridField("lastName", I18N.message("lastname")); lastName.setWidth(90); selector.setPickListFields(email, firstName, lastName); selector.setOptionDataSource(new ContactsDS()); return selector; }
Example #3
Source File: FormGenerator.java From proarc with GNU General Public License v3.0 | 6 votes |
private void setOptionDataSource(FormItem item, Field f, String lang) { Field optionField = f.getOptionDataSource(); DataSource ds = ValueMapDataSource.getInstance().getOptionDataSource(optionField.getName()); item.setValueField(f.getOptionValueField()[0]); item.setOptionDataSource(ds); setPickListValueMapping(item, f); Integer pickListWidth = getWidthAsInteger(optionField.getWidth()); if (item instanceof SelectItem) { SelectItem selectItem = (SelectItem) item; selectItem.setPickListFields(getPickListFields(optionField, lang)); if (pickListWidth != null) { selectItem.setPickListWidth(pickListWidth); } } else if (item instanceof ComboBoxItem) { ComboBoxItem cbi = (ComboBoxItem) item; cbi.setPickListFields(getPickListFields(optionField, lang)); if (pickListWidth != null) { cbi.setPickListWidth(pickListWidth); } } }
Example #4
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 #5
Source File: FormGenerator.java From proarc with GNU General Public License v3.0 | 5 votes |
public ComboBoxItem getComboBoxItem(Field f, String lang) { ComboBoxItem item = new ComboBoxItem(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 #6
Source File: WorkflowTaskFormView.java From proarc with GNU General Public License v3.0 | 5 votes |
private FormItem createFormItem(DisplayType displayType, Record profile) { String name = profile.getAttribute(WorkflowParameterDataSource.FIELD_NAME); switch (displayType) { case SELECT: SelectItem si = new SelectItem(); setOptions(si, profile); si.setWidth("*"); return si; case COMBOBOX: ComboBoxItem cbi = new ComboBoxItem(); setOptions(cbi, profile); cbi.setLength(2000); cbi.setWidth("*"); return cbi; case CHECKBOX: CheckboxItem ci = new CheckboxItem(); // the width must be set otherwise it overflows the form ci.setWidth(150); ci.setAllowEmptyValue(true); return ci; case TEXTAREA: TextAreaItem tai = new TextAreaItem(); tai.setStartRow(true); tai.setEndRow(true); tai.setLength(2000); tai.setColSpan("*"); tai.setWidth("*"); tai.setHeight(30); return tai; case DATETIME: DateTimeItem di = new DateTimeItem(); return di; case TEXT: default: TextItem ti = new TextItem(name); ti.setLength(2000); ti.setWidth("*"); return ti; } }
Example #7
Source File: PageMetadataEditor.java From proarc with GNU General Public License v3.0 | 5 votes |
private void createApplyToUi() { formApply = createForm(); applyTo = new ComboBoxItem("applyTo", i18n.PageMetadataEditor_ApplyTo_Title()); applyTo.setPrompt(i18n.PageMetadataEditor_ApplyTo_Hint()); applyTo.setRequired(true); LinkedHashMap<String, String> vals = new LinkedHashMap<String, String>(); vals.put("1", i18n.PageMetadataEditor_ApplyToEachItem_Title()); for (int i = 2; i <= 20; i++) { String nth = String.valueOf(i); vals.put(nth, i18n.PageMetadataEditor_ApplyToEachNthItem_Title(nth)); } applyTo.setValueMap(vals); applyTo.setDefaultValue(1); applyTo.setValue(1); applyToValidator = new IntegerRangeValidator(); applyToValidator.setMin(1); applyToValidator.setMax(applyToMaxValue); applyTo.setValidators(new IsIntegerValidator(), applyToValidator); applyFromFirst = new CheckboxItem("applyFromFirst", i18n.PageMetadataEditor_ApplyFromFirst_Title()); applyFromFirst.setPrompt(i18n.PageMetadataEditor_ApplyFromFirst_Hint()); formApply.setItems(applyTo, applyFromFirst); applyTo.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { applyFromFirst.setDisabled("1".equals(applyTo.getValueAsString())); } }); }
Example #8
Source File: DigitalObjectAdministrationEditor.java From proarc with GNU General Public License v3.0 | 4 votes |
public PlainEditor(ClientMessages i18n) { widget = new VLayout(); form = new DynamicForm(); form.setDataSource(DigitalObjectAdministrationDataSource.getInstance()); form.setBrowserSpellCheck(false); TextItem pid = new TextItem(DigitalObjectAdministrationDataSource.FIELD_PID, i18n.DigitalObjectEditor_AdministrationEditor_Pid_Title()); pid.setWidth("*"); pid.setCanEdit(Boolean.FALSE); TextItem model = new TextItem(DigitalObjectAdministrationDataSource.FIELD_MODEL, i18n.DigitalObjectEditor_AdministrationEditor_Model_Title()); model.setCanEdit(Boolean.FALSE); TextItem owner = new TextItem(DigitalObjectAdministrationDataSource.FIELD_OWNER, i18n.DigitalObjectEditor_AdministrationEditor_Owner_Title()); owner.setCanEdit(Boolean.FALSE); TextItem creationDate = new TextItem(DigitalObjectAdministrationDataSource.FIELD_CREATED, i18n.DigitalObjectEditor_AdministrationEditor_Created_Title()); creationDate.setCanEdit(Boolean.FALSE); TextItem modificationDate = new TextItem(DigitalObjectAdministrationDataSource.FIELD_MODIFIED, i18n.DigitalObjectEditor_AdministrationEditor_Modified_Title()); modificationDate.setCanEdit(Boolean.FALSE); SelectItem device = new SelectItem(DigitalObjectAdministrationDataSource.FIELD_DEVICE, i18n.DigitalObjectEditor_AdministrationEditor_Device_Title()); device.setWidth(250); DeviceDataSource.setOptionDataSource(device); device.setAllowEmptyValue(true); device.setEmptyDisplayValue(ClientUtils.format("<i><%s></i>", i18n.DigitalObjectEditor_AdministrationEditor_NoDeviceSelection_Title())); TextItem filename = new TextItem(DigitalObjectAdministrationDataSource.FIELD_FILENAME, i18n.DigitalObjectEditor_AdministrationEditor_File_Title()); filename.setWidth("*"); filename.setCanEdit(Boolean.FALSE); TextItem export = new TextItem(DigitalObjectAdministrationDataSource.FIELD_EXPORT, i18n.DigitalObjectEditor_AdministrationEditor_Export_Title()); export.setWidth("*"); export.setCanEdit(Boolean.FALSE); TextItem ndkExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_NDK_EXPORT, i18n.DigitalObjectEditor_AdministrationEditor_Ndk_Export_Title()); ndkExport.setWidth("*"); ndkExport.setCanEdit(Boolean.FALSE); TextItem archiveExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_ARCHIVE_EXPORT, i18n.DigitalObjectEditor_AdministrationEditor_Archive_Export_Title()); archiveExport.setWidth("*"); archiveExport.setCanEdit(Boolean.FALSE); TextItem krameriusExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_KRAMERIUS_EXPORT, i18n.DigitalObjectEditor_AdministrationEditor_Kramerius_Export_Title()); krameriusExport.setWidth("*"); krameriusExport.setCanEdit(Boolean.FALSE); TextItem crossrefExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_CROSSREF_EXPORT, i18n.DigitalObjectEditor_AdministrationEditor_Crossref_Export_Title()); crossrefExport.setWidth("*"); crossrefExport.setCanEdit(Boolean.FALSE); ComboBoxItem organization = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_ORGANIZATION, i18n.UsersView_ListHeader_Organization_Title()); organization.setWidth(250); organization.setValueMap(Organization.getMap()); ComboBoxItem user = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_USER, i18n.UsersView_ListHeader_Proccesor_Title()); user.setWidth(250); user.setOptionDataSource(UserDataSource.getInstance()); user.setValueField(UserDataSource.FIELD_USERNAME); user.setDisplayField(UserDataSource.FIELD_USERNAME); ComboBoxItem status = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_STATUS, i18n.DigitalObjectEditor_AdministrationEditor_Status_Title()); status.setWidth(250); status.setValueMap(DigitalObjectState.getMap(i18n)); form.setItems(pid, model, owner, creationDate, modificationDate, device, filename, export, ndkExport, krameriusExport, archiveExport, crossrefExport, organization, user, status); widget.setMembers(form); }
Example #9
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 #10
Source File: DataControlsTimeSeries.java From SensorWebClient with GNU General Public License v2.0 | 4 votes |
private Canvas createJumpToTimeIntervalForm() { ComboBoxItem jumpToCombo = new ComboBoxItem(); jumpToCombo.setTitle(i18n.jumpTo()); jumpToCombo.setDefaultToFirstOption(true); jumpToCombo.setWrapTitle(false); jumpToCombo.setShowTitle(true); jumpToCombo.setWidth(100); String[] jumpToTypes = i18n.jumpToTypes().split(","); LinkedHashMap<String, String> jumpToValues = new LinkedHashMap<String, String>(); for (int i = 0; i < jumpToTypes.length; i += 2) { jumpToValues.put(jumpToTypes[i], jumpToTypes[i + 1]); } jumpToCombo.setValueMap(jumpToValues); jumpToCombo.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { RecentTimeTerm type = RecentTimeTerm.valueOf((String) event.getValue()); final Date now = new Date(); long interval = 1000 * 60; // FIXME validierung mit overview switch (type) { case TODAY: long dayInMillis = 1000 * 60 * 60 * 24; long lastmidnight = now.getTime() / dayInMillis * dayInMillis; EventBus.getMainEventBus().fireEvent(new DatesChangedEvent(lastmidnight, lastmidnight + (dayInMillis))); return; case LASTHOUR: interval *= 60; break; case LASTFIVEHOURS: interval *= 60 * 5; break; case LASTDAY: interval *= 60 * 24; break; case LASTMONTH: interval *= 60 * 24 * 30; break; case LASTWEEK: interval *= 60 * 24 * 7; break; default: break; } final long start = now.getTime() - interval; final long end = now.getTime(); EventBus.getMainEventBus().fireEvent(new DatesChangedEvent(start,end)); } }); DynamicForm jumpToForm = new DynamicForm(); jumpToForm.setStyleName("n52_sensorweb_client_jumpToTimeIntervalForm"); jumpToForm.setNumCols(2); jumpToForm.setFields(jumpToCombo); jumpToForm.setHeight("*"); return jumpToForm; }