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

The following examples show how to use com.smartgwt.client.widgets.form.fields.SelectItem#setValue() . 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
/**
 * 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 2
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 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 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 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 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 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 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 6
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();
}
 
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 newWorkspaceSelector(Long value) {
	SelectItem item = new SelectItem("workspace");
	item.setTitle(I18N.message("workspace"));
	item.setRequiredMessage(I18N.message("fieldrequired"));
	item.setValueField("folderId");
	item.setDisplayField("name");
	item.setWrapTitle(false);
	item.setOptionDataSource(new FoldersDS("profile-workspace", true));
	item.setValue(value);
	item.setVisible(Feature.enabled(Feature.MULTI_WORKSPACE));
	item.setWidth(150);
	return item;
}
 
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 newEventsSelector(String name, String title, final ChangedHandler handler, boolean folder,
		boolean workflow, boolean user) {
	final SelectItem select = newMultipleSelector(filterItemName(name), title);
	select.setWidth(350);
	select.setHeight(250);
	select.setMultipleAppearance(MultipleAppearance.GRID);
	select.setMultiple(true);
	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 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 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 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 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 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 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 12
Source File: ImportBatchChooser.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private void askForBatchReload(final BooleanCallback callback, BatchRecord batch) {
    final Dialog dialog = new Dialog(i18n.ImportBatchChooser_ActionResetLoad_Title());
    dialog.getDialogLabelContainer().setContents(i18n.ImportBatchChooser_ActionResetLoad_Ask_MSg());

    final DynamicForm dialogForm = new DynamicForm();
    final SelectItem profileSelect = ProfileChooser.createProfileSelection(ProfileGroup.IMPORTS, i18n);
    profileSelect.setValue(batch.getProfileId());
    dialogForm.setFields(profileSelect);
    dialog.getDialogContentContainer().setMembers(dialogForm);

    dialog.addYesButton(new com.smartgwt.client.widgets.events.ClickHandler() {

        @Override
        public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            if (dialogForm.validate()) {
                lastProfileSelection = profileSelect.getValueAsString();
                dialog.destroy();
                callback.execute(true);
            }
        }
    });
    dialog.addNoButton(new DialogCloseHandler() {

        @Override
        public void onClose() {
            dialog.destroy();
            lastProfileSelection = null;
            callback.execute(false);
        }
    });
    dialog.setWidth(400);
    dialog.show();
}
 
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 newRunlevelSelector() {
	SelectItem item = new SelectItem("runlevel", I18N.message("currentrunlevel"));
	LinkedHashMap<String, String> opts = new LinkedHashMap<String, String>();
	opts.put("default", I18N.message("default"));
	opts.put("bulkload", I18N.message("bulkload"));
	opts.put("slave", I18N.message("slave"));
	opts.put("devel", I18N.message("devel"));
	item.setValueMap(opts);
	item.setWrapTitle(false);
	item.setValue(Session.get().getConfig("runlevel"));
	item.setRequired(true);
	item.setWidth(150);
	item.setDisabled("demo".equals(Session.get().getConfig("runlevel")));
	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 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 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 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 16
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 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 newYesNoSelectItem(String name, String title) {
	SelectItem item = newSelectItem(name, title);
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("true", I18N.message("yes"));
	map.put("false", I18N.message("no"));
	item.setValueMap(map);
	item.setValue("true");
	item.setWidth(50);
	return item;
}
 
Example 18
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 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 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 20
Source File: GDriveCreate.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public GDriveCreate() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createdoc"));
	setWidth(300);
	setHeight(120);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(5);
	setMembersMargin(3);

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

	TextItem fileName = ItemFactory.newTextItem("fileName", "filename", null);
	fileName.setRequired(true);
	fileName.setWidth(200);

	SelectItem type = ItemFactory.newSelectItem("type", I18N.message("type"));
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("doc", "doc");
	map.put("docx", "docx");
	map.put("odt", "odt");
	map.put("txt", "txt");
	map.put("xls", "xls");
	map.put("xlsx", "xlsx");
	map.put("ods", "ods");
	map.put("ppt", "ppt");
	map.put("pptx", "pptx");
	map.put("odp", "odp");
	type.setValueMap(map);
	type.setValue("doc");
	type.setWidth(50);
	type.setEndRow(true);
	type.setRequired(true);

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

	form.setItems(fileName, type, create);

	addItem(form);
}