com.smartgwt.client.widgets.form.fields.SelectItem Java Examples

The following examples show how to use com.smartgwt.client.widgets.form.fields.SelectItem. 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 vote down vote up
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 #2
Source File: NewIssueEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private SelectItem createDayChooser(String fName) {
        SelectItem issueDays = new SelectItem(fName, i18n.NewIssueEditor_daysIncluded_Title());
        issueDays.setTooltip(i18n.NewIssueEditor_daysIncluded_Hint());
        issueDays.setWidth("*");
        issueDays.setHeight(105);
//        issueDays.setMultiple(true);
        issueDays.setRequired(true);
        issueDays.setMultipleAppearance(MultipleAppearance.GRID);
        LinkedHashMap<Integer, String> weekMap = new LinkedHashMap<>();
        weekMap.put(1, i18nSGwt.date_dayNames_2());
        weekMap.put(2, i18nSGwt.date_dayNames_3());
        weekMap.put(3, i18nSGwt.date_dayNames_4());
        weekMap.put(4, i18nSGwt.date_dayNames_5());
        weekMap.put(5, i18nSGwt.date_dayNames_6());
        weekMap.put(6, i18nSGwt.date_dayNames_7());
        weekMap.put(7, i18nSGwt.date_dayNames_1());
        issueDays.setValueMap(weekMap);
        return issueDays;
    }
 
Example #3
Source File: SensorLossRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createEditConditionCanvas() {
        StaticTextItem label = createLabelItem(i18n.sensorFailure());

        SelectItem unitItem = createUnitsItem();
        unitItem.addChangedHandler(createEntryUnitChangedHandler());
        unitItem.setValueMap(createTimeunitsMap());
        unitItem.setWidth(2 * EDIT_ITEMS_WIDTH);
        
        TextItem valueItem = createValueItem();
        valueItem.addChangedHandler(createValueChangedHandler());
        valueItem.setWidth(EDIT_ITEMS_WIDTH);
        valueItem.setRequired(true);
//        valueItem.setKeyPressFilter("[0-9]+(\\.|,)[0-9]+");
        
        FormItem[] formItems = new FormItem[] { label, unitItem, valueItem };
        conditionForm = assembleEditConditionForm(formItems);
        return alignVerticalCenter(conditionForm);
    }
 
Example #4
Source File: UrnNbnAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
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 #5
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static SelectItem new2AFMethodSelector(String name, String value) {
	SelectItem select = new SelectItem(filterItemName(name), I18N.message("authenticationmethod"));
	select.setWidth(150);
	select.setWrapTitle(false);
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("", I18N.message("disable2fa"));
	if (Session.get().getTenantConfigAsBoolean("2fa." + Constants.TWOFA_GOOGLE_AUTHENTICATOR + ".enabled"))
		map.put(Constants.TWOFA_GOOGLE_AUTHENTICATOR, "Google Authenticator");
	if (Session.get().getTenantConfigAsBoolean("2fa." + Constants.TWOFA_YUBIKEY + ".enabled"))
		map.put(Constants.TWOFA_YUBIKEY, "Yubikey");
	select.setValueMap(map);
	if (value != null && map.get(value) != null)
		select.setValue(value.toString());
	else
		select.setValue("");
	return select;
}
 
Example #6
Source File: ImportSettingsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ImportSettingsPanel(GUIArchive archive, ChangedHandler changedHandler) {
	this.archive = archive;

	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.TOP);

	TextItem description = ItemFactory.newTextItem("description", "description", archive.getDescription());
	description.addChangedHandler(changedHandler);
	description.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED);

	RadioGroupItem importTemplates = ItemFactory.newBooleanSelector("importtemplates", "importtemplates");
	importTemplates.setValue(archive.getImportTemplate() == 1 ? "yes" : "no");
	importTemplates.addChangedHandler(changedHandler);
	importTemplates.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED);

	SelectItem options = ItemFactory.newImportCustomIds();
	options.setWidth(200);
	options.setValue(Integer.toString(archive.getImportCustomId()));
	options.addChangedHandler(changedHandler);
	options.setDisabled(archive.getStatus() != GUIArchive.STATUS_OPENED);

	form.setFields(description, importTemplates, options);

	addMember(form);
}
 
Example #7
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static SelectItem newBarcodeGenerationFormatSelector(String name, String title, String value) {
	SelectItem item = new SelectItem(name, I18N.message(title));
	item.setWrapTitle(false);
	item.setWidth(110);

	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("CODE_128", "CODE_128");
	opts.put("CODE_39", "CODE_39");
	opts.put("EAN_13", "EAN_13");
	opts.put("EAN_8", "EAN_8");
	opts.put("ITF", "ITF");
	opts.put("UPC_A", "UPC_A");
	opts.put("QR_CODE", "QR_CODE");

	item.setValueMap(opts);

	if (value != null)
		item.setValue(value);

	return item;
}
 
Example #8
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static SelectItem newEmailSelector(String name, String title) {
	final SelectItem selector = new SelectItem(filterItemName(name));
	selector.setTitle(I18N.message(title));
	selector.setWrapTitle(false);
	selector.setValueField("email");
	selector.setDisplayField("email");
	selector.setPickListWidth(350);
	selector.setMultiple(true);
	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 #9
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static SelectItem newTenantSelector() {
	SelectItem tenant = new SelectItem("tenant");
	tenant.setTitle(I18N.message("tenant"));
	tenant.setWrapTitle(false);
	ListGridField id = new ListGridField("id", I18N.message("id"));
	id.setHidden(true);
	ListGridField _name = new ListGridField("name", I18N.message("name"));
	ListGridField displayName = new ListGridField("displayName", I18N.message("displayname"));
	tenant.setValueField("id");
	tenant.setDisplayField("displayName");
	tenant.setPickListWidth(300);
	tenant.setWidth(150);
	tenant.setPickListFields(id, _name, displayName);
	tenant.setOptionDataSource(new TenantsDS());
	return tenant;
}
 
Example #10
Source File: StationSelector.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createInformationFieldForSelectedStation() {
        VLayout layout = new VLayout();
        timeseriesInfoHTMLPane = new HTMLPane();
        phenomenonBox = new SelectItem(i18n.phenomenonLabel());
        phenomenonBox.addChangedHandler(new ChangedHandler() {
			@Override
			public void onChanged(ChangedEvent event) {
				String category = (String) event.getItem().getValue();
				controller.loadTimeseriesByCategory(category);
			}
		});
        DynamicForm form = new DynamicForm();
        form.setItems(phenomenonBox);
//        phenomenonInfoLabel = new Label();
//        phenomenonInfoLabel.setAutoHeight();
        stationInfoLabel = new Label();
        stationInfoLabel.setAutoHeight();
//        layout.addMember(phenomenonInfoLabel);
        layout.addMember(form);
        layout.addMember(stationInfoLabel);
        layout.addMember(timeseriesInfoHTMLPane);
        return layout;
    }
 
Example #11
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static SelectItem newEventSelector(String name, String title, final ChangedHandler handler, boolean folder,
		boolean workflow, boolean user) {
	final SelectItem select = newSelectItem(filterItemName(name), title);
	select.setWidth(350);
	select.setMultiple(false);
	select.setOptionDataSource(new EventsDS(folder, workflow, user));
	select.setValueField("code");
	select.setDisplayField("label");
	if (handler != null)
		select.addChangedHandler(handler);

	PickerIcon clear = new PickerIcon(PickerIcon.CLEAR, new FormItemClickHandler() {
		@Override
		public void onFormItemClick(FormItemIconClickEvent event) {
			select.clearValue();
			select.setValue((String) null);
			if (handler != null)
				handler.onChanged(null);
		}
	});
	select.setIcons(clear);
	select.setIconVAlign(VerticalAlignment.TOP);

	return select;
}
 
Example #12
Source File: OverUndershootRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Canvas createEntryConditionEditCanvas() {
    StaticTextItem labelItem = createLabelItem(i18n.enterCondition());
    
    OverUndershootSelectionData data = controller.getOverUndershootEntryConditions();
    SelectItem entryOperatorItem = createOperatorItem(data, GREATER_THAN_INT);
    entryOperatorItem.addChangedHandler(createEntryOperatorChangedHandler());
    entryOperatorItem.setWidth(EDIT_ITEMS_WIDTH);

    TextItem entryValueItem = createValueItem();
    entryValueItem.addChangedHandler(createEntryValueChangedHandler());
    entryValueItem.setWidth(EDIT_ITEMS_WIDTH);
    declareAsRequired(entryValueItem);
    
    StaticTextItem entryUnitItem = createStaticUnitItem(data);
    entryUnitItem.setWidth(EDIT_ITEMS_WIDTH);
    
    FormItem[] items = new FormItem[] { labelItem, entryOperatorItem, entryValueItem, entryUnitItem };
    entryConditionForm = assembleEditConditionForm(items);
    return alignVerticalCenter(entryConditionForm);
}
 
Example #13
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Simple boolean selector for Extended Attribute
 * 
 * @param name name of the item
 * @param title title of the item(optional)
 * @param allowEmpty flag to indicate id the item must accept empty value
 * 
 * @return the new item
 */
public static SelectItem newBooleanSelectorForAttribute(String name, String title, boolean allowEmpty) {
	String itemName = "_" + name.replaceAll(" ", Constants.BLANK_PLACEHOLDER);
	SelectItem select = new SelectItem();
	select.setName(itemName);
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	if (allowEmpty)
		map.put("", " ");

	map.put("1", I18N.message("yes"));
	map.put("0", I18N.message("no"));
	select.setValueMap(map);
	select.setTitle(I18N.message(title));
	select.setWidth(80);
	select.setValue("");

	return select;
}
 
Example #14
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #15
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 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 #16
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #17
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #18
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static SelectItem newWelcomeScreenSelector(Integer value) {
	SelectItem select = new SelectItem("welcomescreen", I18N.message("welcomescreen"));
	select.setWidth(150);
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("1500", I18N.message("documents"));
	map.put("1510", I18N.message("search"));
	map.put("1520", I18N.message("dashboard"));
	select.setValueMap(map);
	if (value != null)
		select.setValue(value.toString());
	else
		select.setValue("1500");
	return select;
}
 
Example #19
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static SelectItem newPrioritySelector(String name, String title) {
	SelectItem select = new SelectItem(filterItemName(name), title);
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("0", I18N.message("low"));
	map.put("1", I18N.message("medium"));
	map.put("2", I18N.message("high"));
	select.setValueMap(map);
	select.setValue("0");
	return select;
}
 
Example #20
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static SelectItem newCalendarEventStatusSelector(String name, String title) {
	SelectItem select = new SelectItem(filterItemName(name), I18N.message(title));

	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("0", "");
	map.put("1", I18N.message("working"));
	map.put("2", I18N.message("completed"));
	map.put("3", I18N.message("canceled"));

	select.setValueMap(map);
	select.setWidth(90);
	return select;
}
 
Example #21
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static SelectItem newAutomationRoutineSelector(String name, Long value, final ChangedHandler handler,
		boolean showEmpty) {
	final SelectItem select = newSelectItem(filterItemName(name), "routine");
	select.setValueField("id");
	select.setDisplayField("name");
	select.setEmptyDisplayValue(I18N.message("customcode"));

	ListGridField id = new ListGridField("id", I18N.message("id"));
	id.setHidden(true);
	ListGridField _name = new ListGridField("name", I18N.message("name"));
	ListGridField description = new ListGridField("description", I18N.message("description"));
	select.setPickListFields(id, _name, description);
	select.setPickListWidth(250);
	select.setOptionDataSource(new AutomationRoutinesDS(showEmpty));
	select.setValue(value);

	ChangedHandler setNullOnEmpty = new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			if (event != null && event.getValue().equals("")) {
				select.setValue((String) null);
				select.clearValue();
			}
		}
	};
	select.addChangedHandler(setNullOnEmpty);
	if (handler != null)
		select.addChangedHandler(handler);

	return select;
}
 
Example #22
Source File: FormCreate.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public FormCreate(FormsPanel grid) {
	this.grid = grid;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createform"));
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);

	DynamicForm form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);

	TextItem name = ItemFactory.newSimpleTextItem("name", "name", null);
	name.setRequired(true);
	name.setWidth(200);

	SelectItem template = ItemFactory.newTemplateSelector(true, null);

	create = new SubmitItem();
	create.setTitle(I18N.message("create"));
	create.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onCreate();
		}
	});

	form.setItems(name, template, create);

	addItem(form);
}
 
Example #23
Source File: NewDigObject.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
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>&lt;%s&gt;</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 #24
Source File: OverUndershootRuleTemplate.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
protected SelectItem createUnitsItem() {
    SelectItem unitSelectItem = new SelectItem();
    unitSelectItem.setTitle(i18n.unit());
    unitSelectItem.setTitleOrientation(TOP);
    unitSelectItem.addChangedHandler(createUnitSelectionChangedHandler());
    return unitSelectItem;
}
 
Example #25
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
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 #26
Source File: WorkflowTaskFormView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
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 #27
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 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 #28
Source File: CreateSimpleRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void setEntryTimeUnitItem() {
    this.entryTimeUnitItem = new SelectItem();
    this.entryTimeUnitItem.setWidth(this.entryItemWidth);
    this.entryTimeUnitItem.setTitle(i18n.timeUnit());
    this.entryTimeUnitItem.setTitleOrientation(TitleOrientation.TOP);
    this.entryTimeUnitItem.setTooltip("<nobr>" + i18n.unitsTime() + "</nobr>");
    this.entryTimeUnitItem.setValueMap(this.timeUnitHashMap);
    this.entryTimeUnitItem.setDefaultValue("H");
    this.entryTimeUnitItem.setTextAlign(Alignment.CENTER);
}
 
Example #29
Source File: PageMetadataEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @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 #30
Source File: MediaEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private void updateStreamMenu(ResultSet data, SelectItem view) {
    ListGridRecord lastViewSelection = view.getSelectedRecord();
    Boolean contains = lastViewSelection == null ? false : data.contains(lastViewSelection);
    if (!contains) {
        String dsId = data.isEmpty() ? null : data.get(0).getAttribute(StreamProfileDataSource.FIELD_ID);
        view.setValue(dsId);
    }
    showStream();
}