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

The following examples show how to use com.smartgwt.client.widgets.form.fields.SelectItem#setPickListWidth() . 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 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 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 newUserSelector(String name, String title, String groupIdOrName, boolean required) {
	SelectItem user = new SelectItem(filterItemName(name));
	user.setTitle(I18N.message(title));
	user.setWrapTitle(false);
	ListGridField id = new ListGridField("id", I18N.message("id"));
	id.setHidden(true);
	ListGridField username = new ListGridField("username", I18N.message("username"));
	ListGridField label = new ListGridField("label", I18N.message("name"));
	user.setValueField("id");
	user.setDisplayField("username");
	user.setPickListWidth(300);
	user.setPickListFields(id, username, label);
	user.setOptionDataSource(new UsersDS(groupIdOrName, required));
	user.setPickListProperties(new UserPickListProperties());
	return user;
}
 
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 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 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 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 5
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
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 6
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 newGroupSelector(String name, String title) {
	SelectItem group = new SelectItem(filterItemName(name));
	group.setTitle(I18N.message(title));
	group.setWrapTitle(false);
	group.setValueField("id");
	group.setDisplayField("name");
	group.setPickListWidth(300);
	ListGridField n = new ListGridField("name", I18N.message("name"));
	ListGridField description = new ListGridField("description", I18N.message("description"));
	group.setPickListFields(n, description);
	group.setOptionDataSource(new GroupsDS());
	return group;
}
 
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 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 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 newDashletSelector(String name, String title) {
	SelectItem select = new SelectItem(filterItemName(name), title);
	select.setAllowEmptyValue(false);
	select.setOptionDataSource(new DashletsDS());
	select.setPickListWidth(200);
	select.setDisplayField("title");
	select.setValueField("name");

	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 newAttributesSelector() {
	final SelectItem selectItem = new SelectItem("attributes", I18N.message("attributes"));
	selectItem.setMultiple(true);
	selectItem.setMultipleAppearance(MultipleAppearance.PICKLIST);
	selectItem.setDisplayField("label");
	selectItem.setValueField("name");
	selectItem.setPickListWidth(150);
	selectItem.setOptionDataSource(new AttributesDS());
	selectItem.setWrapTitle(false);
	return selectItem;
}
 
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 newArchiveSelector(int mode, Integer status) {
	SelectItem item = new SelectItem("archive");
	item.setTitle("");
	item.setRequiredMessage(I18N.message("fieldrequired"));
	ListGridField name = new ListGridField("name", I18N.message("name"));
	ListGridField description = new ListGridField("description", I18N.message("description"));
	item.setValueField("id");
	item.setDisplayField("name");
	item.setPickListWidth(300);
	item.setPickListFields(name, description);
	item.setOptionDataSource(new ArchivesDS(mode, null, status, null));
	if (!Feature.enabled(Feature.IMPEX))
		item.setDisabled(true);
	return item;
}
 
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 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;
}