|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField<java.lang.Object>
com.vaadin.ui.AbstractSelect
com.vaadin.ui.ComboBox
public class ComboBox
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField |
---|
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent |
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 |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
---|
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector |
---|
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener |
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable |
---|
Sizeable.Unit |
Nested classes/interfaces inherited from interface com.vaadin.ui.Field |
---|
Field.ValueChangeEvent |
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
---|
Buffered.SourceException |
Nested classes/interfaces inherited from interface com.vaadin.data.Property |
---|
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
Field Summary | |
---|---|
protected int |
pageLength
Holds value of property pageLength. |
Fields inherited from class com.vaadin.ui.AbstractSelect |
---|
ITEM_CAPTION_MODE_EXPLICIT, ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID, ITEM_CAPTION_MODE_ICON_ONLY, ITEM_CAPTION_MODE_ID, ITEM_CAPTION_MODE_INDEX, ITEM_CAPTION_MODE_ITEM, ITEM_CAPTION_MODE_PROPERTY, itemIdMapper, items |
Fields inherited from interface com.vaadin.ui.AbstractSelect.Filtering |
---|
FILTERINGMODE_CONTAINS, FILTERINGMODE_OFF, FILTERINGMODE_STARTSWITH |
Fields inherited from interface com.vaadin.server.Sizeable |
---|
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
Constructor Summary | |
---|---|
ComboBox()
|
|
ComboBox(java.lang.String caption)
|
|
ComboBox(java.lang.String caption,
java.util.Collection<?> options)
|
|
ComboBox(java.lang.String caption,
Container dataSource)
|
Method Summary | |
---|---|
void |
addBlurListener(FieldEvents.BlurListener listener)
Adds a BlurListener to the Component which gets fired
when a Field loses keyboard focus. |
void |
addFocusListener(FieldEvents.FocusListener listener)
Adds a FocusListener to the Component which gets fired
when a Field receives keyboard focus. |
void |
addListener(FieldEvents.BlurListener listener)
Deprecated. As of 7.0, replaced by #addBlurListener(BlurListener) |
void |
addListener(FieldEvents.FocusListener listener)
Deprecated. As of 7.0, replaced by #addFocusListener(FocusListener) |
protected Container.Filter |
buildFilter(java.lang.String filterString,
com.vaadin.shared.ui.combobox.FilteringMode filteringMode)
Constructs a filter instance to use when using a Filterable container in the ITEM_CAPTION_MODE_PROPERTY mode. |
void |
changeVariables(java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> variables)
Invoked when the value of a variable has changed. |
void |
containerItemSetChange(Container.ItemSetChangeEvent event)
Lets the listener know a Containers Item set has changed. |
protected java.util.List<?> |
getFilteredOptions()
Filters the options in memory and returns the full filtered list. |
com.vaadin.shared.ui.combobox.FilteringMode |
getFilteringMode()
Gets the current filtering mode. |
java.lang.String |
getInputPrompt()
Gets the current input prompt. |
protected java.util.List<?> |
getOptionsWithFilter(boolean needNullSelectOption)
Returns the filtered options for the current page using a container filter. |
int |
getPageLength()
Returns the page length of the suggestion popup. |
boolean |
isMultiSelect()
Deprecated. As of 7.0, use ListSelect , OptionGroup or
TwinColSelect instead |
boolean |
isScrollToSelectedItem()
Returns true if the select should find the page with the selected item when opening the popup (single select combo box only). |
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 |
removeBlurListener(FieldEvents.BlurListener listener)
Removes a BlurListener from the Component. |
void |
removeFocusListener(FieldEvents.FocusListener listener)
Removes a FocusListener from the Component. |
void |
removeListener(FieldEvents.BlurListener listener)
Deprecated. As of 7.0, replaced by #removeBlurListener(BlurListener) |
void |
removeListener(FieldEvents.FocusListener listener)
Deprecated. As of 7.0, replaced by #removeFocusListener(FocusListener) |
void |
setFilteringMode(com.vaadin.shared.ui.combobox.FilteringMode filteringMode)
Sets the option filtering mode. |
void |
setInputPrompt(java.lang.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)
Deprecated. As of 7.0, use ListSelect , OptionGroup or
TwinColSelect instead |
void |
setPageLength(int pageLength)
Sets the page length for the suggestion popup. |
void |
setScrollToSelectedItem(boolean scrollToSelectedItem)
Sets whether to scroll the selected item visible (directly open the page on which it is) when opening the combo box popup or not. |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.vaadin.ui.LegacyComponent |
---|
markAsDirty |
Methods inherited from interface com.vaadin.server.VariableOwner |
---|
isEnabled, isImmediate |
Methods inherited from interface com.vaadin.ui.Component |
---|
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setPrimaryStyleName, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.vaadin.server.ClientConnector |
---|
addAttachListener, addDetachListener, beforeClientResponse, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setParent |
Methods inherited from interface com.vaadin.shared.Connector |
---|
getConnectorId |
Methods inherited from interface com.vaadin.server.Sizeable |
---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth |
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier |
---|
addShortcutListener, removeShortcutListener |
Field Detail |
---|
protected int pageLength
Constructor Detail |
---|
public ComboBox()
public ComboBox(java.lang.String caption, java.util.Collection<?> options)
public ComboBox(java.lang.String caption, Container dataSource)
public ComboBox(java.lang.String caption)
Method Detail |
---|
public java.lang.String getInputPrompt()
setInputPrompt(String)
public void setInputPrompt(java.lang.String inputPrompt)
inputPrompt
- the desired input prompt, or null to disablepublic void paintContent(PaintTarget target) throws PaintException
AbstractSelect
paintContent
in interface LegacyComponent
paintContent
in class AbstractSelect
target
- the Paint Event.
PaintException
- if the paint operation failed.public void setTextInputAllowed(boolean textInputAllowed)
NativeSelect
textInputAllowed
- true to allow entering text, false to just show the current
selectionisTextInputAllowed()
public boolean isTextInputAllowed()
AbstractSelect.isNewItemsAllowed()
returns true. If text input is disabled, the comboBox will work in the
same way as a NativeSelect
protected java.util.List<?> getOptionsWithFilter(boolean needNullSelectOption)
filteredSize
is set to the total number of
items passing the filter.
The current container must be Filterable
and Indexed
, and
the filtering mode must be suitable for container filtering (tested with
#canUseContainerFilter()
).
Use getFilteredOptions()
and
sanitetizeList(List, boolean)
if this is not the case.
needNullSelectOption
-
protected Container.Filter buildFilter(java.lang.String filterString, com.vaadin.shared.ui.combobox.FilteringMode filteringMode)
ITEM_CAPTION_MODE_PROPERTY
mode.
Note that the client side implementation expects the filter string to
apply to the item caption string it sees, so changing the behavior of
this method can cause problems.
filterString
- filteringMode
-
public void containerItemSetChange(Container.ItemSetChangeEvent event)
AbstractSelect
containerItemSetChange
in interface Container.ItemSetChangeListener
containerItemSetChange
in class AbstractSelect
event
- change event textContainer.ItemSetChangeListener.containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent)
protected java.util.List<?> getFilteredOptions()
getOptionsWithFilter(boolean)
if possible (filterable container
and suitable item caption mode etc.).
public void changeVariables(java.lang.Object source, java.util.Map<java.lang.String,java.lang.Object> variables)
changeVariables
in interface VariableOwner
changeVariables
in class AbstractSelect
source
- the Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables
- the Mapping from variable names to new variable values.com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object,
java.util.Map)
public void setFilteringMode(com.vaadin.shared.ui.combobox.FilteringMode filteringMode)
AbstractSelect.Filtering
setFilteringMode
in interface AbstractSelect.Filtering
filteringMode
- the filtering mode to usepublic com.vaadin.shared.ui.combobox.FilteringMode getFilteringMode()
AbstractSelect.Filtering
getFilteringMode
in interface AbstractSelect.Filtering
public void addBlurListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifier
BlurListener
to the Component which gets fired
when a Field
loses keyboard focus.
addBlurListener
in interface FieldEvents.BlurNotifier
FieldEvents.BlurListener
@Deprecated public void addListener(FieldEvents.BlurListener listener)
#addBlurListener(BlurListener)
addListener
in interface FieldEvents.BlurNotifier
public void removeBlurListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifier
BlurListener
from the Component.
removeBlurListener
in interface FieldEvents.BlurNotifier
FieldEvents.BlurListener
@Deprecated public void removeListener(FieldEvents.BlurListener listener)
#removeBlurListener(BlurListener)
removeListener
in interface FieldEvents.BlurNotifier
public void addFocusListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifier
FocusListener
to the Component which gets fired
when a Field
receives keyboard focus.
addFocusListener
in interface FieldEvents.FocusNotifier
FieldEvents.FocusListener
@Deprecated public void addListener(FieldEvents.FocusListener listener)
#addFocusListener(FocusListener)
addListener
in interface FieldEvents.FocusNotifier
public void removeFocusListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifier
FocusListener
from the Component.
removeFocusListener
in interface FieldEvents.FocusNotifier
FieldEvents.FocusListener
@Deprecated public void removeListener(FieldEvents.FocusListener listener)
#removeFocusListener(FocusListener)
removeListener
in interface FieldEvents.FocusNotifier
@Deprecated public void setMultiSelect(boolean multiSelect)
ListSelect
, OptionGroup
or
TwinColSelect
instead
setMultiSelect
in class AbstractSelect
multiSelect
- the New value of property multiSelect.
java.lang.UnsupportedOperationException
- if trying to activate multiselect modeAbstractSelect.setMultiSelect(boolean)
@Deprecated public boolean isMultiSelect()
ListSelect
, OptionGroup
or
TwinColSelect
instead
isMultiSelect
in class AbstractSelect
AbstractSelect.isMultiSelect()
public int getPageLength()
public void setPageLength(int pageLength)
pageLength
- the pageLength to setpublic void setScrollToSelectedItem(boolean scrollToSelectedItem)
scrollToSelectedItem
- true to find the page with the selected item when opening the
selection popuppublic boolean isScrollToSelectedItem()
setScrollToSelectedItem(boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |