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

The following examples show how to use com.smartgwt.client.widgets.form.fields.SelectItem#setName() . 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 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 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 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 3
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 4
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 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 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 6
Source File: DownloadTicketDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void prepareForm() {
	form = new DynamicForm();
	form.setAlign(Alignment.LEFT);
	form.setNumCols(4);

	SelectItem type = ItemFactory.newAliasTypeSelector();
	type.setName("type");
	type.setValue("");
	type.setEndRow(true);
	type.setColSpan(4);
	type.setWrapTitle(false);

	DateItem date = ItemFactory.newDateItem("date", I18N.message("expireson"));
	date.setEndRow(true);
	date.setColSpan(4);
	date.setWrapTitle(false);

	SpinnerItem maxDownloads = ItemFactory.newSpinnerItem("maxDownloads", I18N.message("maxdownloads"),
			(Integer) null);
	maxDownloads.setEndRow(true);
	maxDownloads.setColSpan(4);
	maxDownloads.setWrapTitle(false);
	maxDownloads.setRequired(false);
	maxDownloads.setMin(0);

	SpinnerItem duedateTimeItem = ItemFactory.newSpinnerItem("duedateNumber", I18N.message("expiresin"), 24);
	duedateTimeItem.setWrapTitle(false);
	duedateTimeItem.setDefaultValue(24);
	duedateTimeItem.setMin(0);
	SelectItem duedateTime = ItemFactory.newDueTimeSelector("duedateTime", "");
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("hour", I18N.message("hours"));
	map.put("day", I18N.message("ddays"));
	duedateTime.setValueMap(map);
	duedateTime.setValue("hour");

	form.setItems(type, duedateTimeItem, duedateTime, date, maxDownloads);
}
 
Example 7
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 newRecipientTypeSelector(String name) {
	SelectItem selector = new SelectItem();
	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("to", I18N.message("to").toUpperCase());
	opts.put("cc", I18N.message("cc").toUpperCase());
	opts.put("bcc", I18N.message("bcc").toUpperCase());
	selector.setValueMap(opts);
	selector.setName(filterItemName(name));
	selector.setShowTitle(false);
	selector.setValue("to");
	selector.setRequired(true);
	return selector;
}
 
Example 8
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 9
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 newDashletTypeSelector(String value) {
	SelectItem selector = new SelectItem();
	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("document", I18N.message("dashlet.type.document"));
	opts.put("docevent", I18N.message("dashlet.type.docevent"));
	opts.put("note", I18N.message("dashlet.type.note"));
	opts.put("content", I18N.message("dashlet.type.content"));
	selector.setValueMap(opts);
	selector.setName("type");
	selector.setTitle(I18N.message("type"));
	selector.setValue(value);
	selector.setRequired(true);
	selector.setWidth(120);
	return selector;
}
 
Example 10
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 newSkinSelector() {
	SelectItem skinSelector = new SelectItem();
	skinSelector.setWidth(120);
	skinSelector.setName("skin");
	skinSelector.setTitle(I18N.message("skin"));
	skinSelector.setValueField("name");
	skinSelector.setDisplayField("label");
	skinSelector.setOptionDataSource(new SkinsDS());

	if (Session.get() != null && Session.get().getInfo().getBranding() != null)
		skinSelector.setValue(Session.get().getInfo().getBranding().getSkin());

	return skinSelector;
}
 
Example 11
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 newDateOperator(String name, String title) {
	SelectItem dateOperator = new SelectItem();
	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("before", I18N.message("before"));
	opts.put("after", I18N.message("after"));
	dateOperator.setValueMap(opts);
	dateOperator.setName(filterItemName(name));
	if (title != null)
		dateOperator.setTitle(I18N.message(title));
	else
		dateOperator.setShowTitle(false);
	dateOperator.setWidth(100);
	return dateOperator;
}
 
Example 12
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 newSizeOperator(String name, String title) {
	SelectItem item = new SelectItem();
	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("lessthan", I18N.message("lessthan"));
	opts.put("greaterthan", I18N.message("greaterthan"));
	item.setValueMap(opts);
	item.setName(filterItemName(name));
	if (title != null)
		item.setTitle(I18N.message(title));
	else
		item.setShowTitle(false);
	item.setWidth(100);
	return item;
}
 
Example 13
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 newLanguageSelector(String name, boolean withEmpty, boolean gui) {
	SelectItem item = new SelectItem();
	if (gui)
		item.setValueMap(I18N.getSupportedGuiLanguages(withEmpty));
	else
		item.setValueMap(I18N.getSupportedLanguages(withEmpty));
	item.setName(filterItemName(name));
	item.setTitle(I18N.message("language"));
	item.setWrapTitle(false);
	item.setWidth(120);
	return item;
}
 
Example 14
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 newMultipleSelector(String name, String title) {
	SelectItem selectItemMultipleGrid = new SelectItem();
	selectItemMultipleGrid.setName(filterItemName(name));
	selectItemMultipleGrid.setTitle(I18N.message(title));
	selectItemMultipleGrid.setMultiple(true);
	selectItemMultipleGrid.setValueMap("");
	return selectItemMultipleGrid;
}
 
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 newAliasTypeSelector() {
	SelectItem item = new SelectItem();
	item.setName("aliastype");
	item.setTitle(I18N.message("type"));
	item.setWrapTitle(false);

	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("", I18N.message("document"));
	map.put("conversion.pdf", I18N.message("pdfconversion"));

	item.setValueMap(map);
	return item;
}
 
Example 16
Source File: ImportSourceChooser.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private DynamicForm createOptionsForm() {
    DynamicForm form = new DynamicForm();
    form.setNumCols(10);
    form.setGroupTitle(i18n.ImportSourceChooser_Options_Title());
    form.setIsGroup(true);
    form.setWrapItemTitles(false);

    final CheckboxItem cbiPageIndexes = new CheckboxItem(ImportBatchDataSource.FIELD_INDICES,
            i18n.ImportSourceChooser_OptionPageIndices_Title());
    cbiPageIndexes.setValue(true);

    final SelectItem selectScanner = createScannerSelection();
    final SelectItem selectProfile = ProfileChooser.createProfileSelection(ProfileGroup.IMPORTS, i18n);
    selectProfile.setName(ImportBatchDataSource.FIELD_PROFILE_ID);
    selectProfile.addChangedHandler(new ChangedHandler() {

        @Override
        public void onChanged(ChangedEvent event) {
            String profile = getImportProfile();
            Criteria criteria = new Criteria();
            if (profile != null) {
                criteria.addCriteria(ImportTreeDataSource.FIELD_PROFILE, profile);
            }
            treeGrid.setCriteria(criteria);
            boolean isArchive= BatchRecord.isArchive(profile);
            boolean isKramerius = BatchRecord.isKramerius(profile);
            selectScanner.setRequired(!isArchive);
            if (isKramerius) {
                selectScanner.show();
                cbiPageIndexes.hide();
            } else if (isArchive) {
                selectScanner.hide();
                cbiPageIndexes.hide();
            } else {
                selectScanner.show();
                cbiPageIndexes.show();
            }
        }
    });

    form.setFields(selectProfile, selectScanner, cbiPageIndexes);
    return form;
}