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

The following examples show how to use com.smartgwt.client.widgets.form.fields.SelectItem#setIcons() . 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 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 2
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;
}