com.vaadin.ui
Class ComboBox
java.lang.Object
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField
com.vaadin.ui.AbstractSelect
com.vaadin.ui.Select
com.vaadin.ui.ComboBox
- All Implemented Interfaces:
- Buffered, BufferedValidatable, Container, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Viewer, Property, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, Action.ShortcutNotifier, FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, MethodEventSource, Paintable, Sizeable, VariableOwner, AbstractSelect.Filtering, Component, Component.Focusable, Field, Serializable, EventListener
public class ComboBox
- extends Select
A filtering dropdown single-select. Suitable for newItemsAllowed, but it's
turned of by default to avoid mistakes. Items are filtered based on user
input, and loaded dynamically ("lazy-loading") from the server. You can turn
on newItemsAllowed and change filtering mode (and also turn it off), but you
can not turn on multi-select mode.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer |
Method Summary |
String |
getInputPrompt()
Gets the current input prompt. |
boolean |
isTextInputAllowed()
Returns true if the user can enter text into the field to either filter
the selections or enter a new value if AbstractSelect.isNewItemsAllowed()
returns true. |
void |
paintContent(PaintTarget target)
Paints the content of this component. |
void |
setInputPrompt(String inputPrompt)
Sets the input prompt - a textual prompt that is displayed when the
select would otherwise be empty, to prompt the user for input. |
void |
setMultiSelect(boolean multiSelect)
Sets the multiselect mode. |
void |
setTextInputAllowed(boolean textInputAllowed)
Sets whether it is possible to input text into the field or whether the
field area of the component is just used to show what is selected. |
Methods inherited from class com.vaadin.ui.Select |
addListener, addListener, buildFilter, changeVariables, containerItemSetChange, getColumns, getFilteredOptions, getFilteringMode, getOptionsWithFilter, isMultiSelect, isScrollToSelectedItem, removeListener, removeListener, setColumns, setFilteringMode, setScrollToSelectedItem |
Methods inherited from class com.vaadin.ui.AbstractSelect |
addContainerProperty, addItem, addItem, addListener, addListener, attach, containerPropertySetChange, containsId, detach, fireItemSetChange, firePropertySetChange, getCaptionChangeListener, getContainerDataSource, getContainerProperty, getContainerPropertyIds, getItem, getItemCaption, getItemCaptionMode, getItemCaptionPropertyId, getItemIcon, getItemIconPropertyId, getItemIds, getListeners, getNewItemHandler, getNullSelectionItemId, getType, getType, getValue, getVisibleItemIds, isEmpty, isNewItemsAllowed, isNullSelectionAllowed, isSelected, paintItem, removeAllItems, removeContainerProperty, removeItem, removeListener, removeListener, sanitizeSelection, select, setContainerDataSource, setItemCaption, setItemCaptionMode, setItemCaptionPropertyId, setItemIcon, setItemIconPropertyId, setNewItemHandler, setNewItemsAllowed, setNullSelectionAllowed, setNullSelectionItemId, setValue, setValue, size, unselect |
Methods inherited from class com.vaadin.ui.AbstractField |
addListener, addListener, addShortcutListener, addValidator, commit, constructField, discard, fireReadOnlyStatusChange, fireValueChange, focus, getActionManager, getErrorMessage, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isReadThrough, isRequired, isValid, isValidationVisible, isWriteThrough, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeShortcutListener, removeValidator, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setReadOnly, setReadThrough, setRequired, setRequiredError, setTabIndex, setValidationVisible, setWriteThrough, shouldHideErrors, toString, validate, valueChange |
Methods inherited from class com.vaadin.ui.AbstractComponent |
addListener, addListener, addListener, addListener, addListener, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getHeight, getHeightUnits, getIcon, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, hasListeners, isEnabled, isImmediate, isVisible, paint, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeight, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth, setWidth, setWidthUnits |
ComboBox
public ComboBox()
ComboBox
public ComboBox(String caption,
Collection<?> options)
ComboBox
public ComboBox(String caption,
Container dataSource)
ComboBox
public ComboBox(String caption)
setMultiSelect
public void setMultiSelect(boolean multiSelect)
- Description copied from class:
AbstractSelect
- Sets the multiselect mode. Setting multiselect mode false may loose
selection information: if selected items set contains one or more
selected items, only one of the selected items is kept as selected.
- Overrides:
setMultiSelect
in class Select
- Parameters:
multiSelect
- the New value of property multiSelect.- See Also:
AbstractSelect.setMultiSelect(boolean)
getInputPrompt
public String getInputPrompt()
- Gets the current input prompt.
- Returns:
- the current input prompt, or null if not enabled
- See Also:
setInputPrompt(String)
setInputPrompt
public void setInputPrompt(String inputPrompt)
- Sets the input prompt - a textual prompt that is displayed when the
select would otherwise be empty, to prompt the user for input.
- Parameters:
inputPrompt
- the desired input prompt, or null to disable
paintContent
public void paintContent(PaintTarget target)
throws PaintException
- Description copied from class:
Select
- Paints the content of this component.
- Overrides:
paintContent
in class Select
- Parameters:
target
- the Paint Event.
- Throws:
PaintException
- if the paint operation failed.
setTextInputAllowed
public void setTextInputAllowed(boolean textInputAllowed)
- Sets whether it is possible to input text into the field or whether the
field area of the component is just used to show what is selected. By
disabling text input, the comboBox will work in the same way as a
NativeSelect
- Parameters:
textInputAllowed
- true to allow entering text, false to just show the current
selection- See Also:
isTextInputAllowed()
isTextInputAllowed
public boolean isTextInputAllowed()
- Returns true if the user can enter text into the field to either filter
the selections or enter a new value if
AbstractSelect.isNewItemsAllowed()
returns true. If text input is disabled, the comboBox will work in the
same way as a NativeSelect
- Returns:
Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.