Java Code Examples for com.smartgwt.client.widgets.form.fields.SelectItem#setWidth()

The following examples show how to use com.smartgwt.client.widgets.form.fields.SelectItem#setWidth() . 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 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 2
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 3
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 4
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 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 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 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 6
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 newEmailFromSelector(String name, String title) {
	final SelectItem selector = new SelectItem(filterItemName(name));
	if (title != null)
		selector.setTitle(I18N.message(title));
	else
		selector.setTitle(I18N.message("from"));
	selector.setWidth(300);
	selector.setWrapTitle(false);
	selector.setValueField("email");
	selector.setDisplayField("email");
	selector.setHideEmptyPickList(true);

	if (Session.get().getUser().getEmail2() != null && !Session.get().getUser().getEmail2().isEmpty())
		selector.setValueMap(Session.get().getUser().getEmail(), Session.get().getUser().getEmail2());
	else
		selector.setValueMap(Session.get().getUser().getEmail());

	selector.setValue(Session.get().getUser().getEmail());

	return selector;
}
 
Example 7
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 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 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 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 newDensitySelector() {
	SelectItem densitySelector = new SelectItem();
	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("dense", I18N.message("dense"));
	opts.put("compact", I18N.message("compact"));
	opts.put("medium", I18N.message("mmedium"));
	opts.put("expanded", I18N.message("expanded"));
	opts.put("spacious", I18N.message("spacious"));

	densitySelector.setValueMap(opts);
	densitySelector.setName("density");
	densitySelector.setTitle(I18N.message("density"));
	densitySelector.setWidth(100);

	densitySelector.setValue(Session.get().getConfig("gui.density"));

	return densitySelector;
}
 
Example 10
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 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 11
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 12
Source File: DigitalObjectAdministrationEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
public BatchEditor(ClientMessages i18n) {
    widget = new VLayout();
    form = new DynamicForm();
    form.setBrowserSpellCheck(false);

    TextItem owner = new TextItem(DigitalObjectAdministrationDataSource.FIELD_OWNER);
    owner.setCanEdit(Boolean.FALSE);

    SelectItem device = new SelectItem(DigitalObjectAdministrationDataSource.FIELD_DEVICE,
            i18n.ImportSourceChooser_OptionScanner_Title());
    DeviceDataSource.setOptionDataSource(device);
    device.setWidth(250);
    device.setAllowEmptyValue(true);
    device.setEmptyDisplayValue(ClientUtils.format("<i>&lt;%s&gt;</i>",
            i18n.DigitalObjectEditor_AdministrationEditor_NoDeviceSelection_Title()));

    form.setItems(device);
    widget.setMembers(form);
}
 
Example 13
Source File: DigitalObjectSearchView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private SelectItem createModelItem(String title, FormItemIfFunction showIf) {
        SelectItem item = new SelectItem(DigitalObjectResourceApi.SEARCH_QUERY_MODEL_PARAM, title);
        item.setWidth(300);
        item.setAllowEmptyValue(true);
        item.setEmptyDisplayValue("<i>" + i18nSmartGwt.filterBuilder_matchAllTitle() + "</i>");
        // see setFilterModel
//        item.setValue("model:periodical");
//        item.setDefaultToFirstOption(true);
        if (showIf != null) {
            item.setShowIfCondition(showIf);
        }
        return item;
    }
 
Example 14
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 15
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 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 16
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 newUserTypeSelector(String name, int userType) {
	SelectItem selector = new SelectItem();
	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("" + GUIUser.TYPE_DEFAULT, I18N.message("default"));
	opts.put("" + GUIUser.TYPE_READONLY, I18N.message("readonly"));
	selector.setValueMap(opts);
	selector.setName(filterItemName(name));
	selector.setTitle(I18N.message("usertype"));
	selector.setValue("" + userType);
	selector.setRequired(true);
	selector.setWidth(120);
	return selector;
}
 
Example 17
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 newOCRStatusSelector(Integer value) {
	SelectItem select = new SelectItem("ocrstatus", I18N.message("processedbyzonalocr"));
	select.setWidth(150);
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("0", I18N.message("no"));
	map.put("1", I18N.message("yes"));
	map.put("2", I18N.message("skip"));
	select.setValueMap(map);
	if (value != null)
		select.setValue(value.toString());
	else
		select.setValue("2");
	return select;
}
 
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 newSplittingPolicySelector() {
	SelectItem select = new SelectItem("splittingpolicy", I18N.message("splittingpolicy"));
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("0", I18N.message("allpages"));
	map.put("1", I18N.message("selectionofpages"));
	map.put("2", I18N.message("blankpageasseparator"));
	map.put("3", I18N.message("barcodeasseparator"));
	map.put("4", I18N.message("textasseparator"));
	select.setValueMap(map);
	select.setValue("0");
	select.setWidth(200);
	return select;
}
 
Example 19
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static SelectItem newEmailProtocolSelector(String name, String title) {
	SelectItem select = new SelectItem(filterItemName(name), I18N.message(title));
	select.setWidth(110);
	select.setValueMap("pop3", "imap");
	return select;
}
 
Example 20
Source File: PageForm.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
/**
     * 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);
    }