com.vaadin.ui
Class Select

java.lang.Object
  extended by com.vaadin.terminal.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractField<Object>
              extended by com.vaadin.ui.AbstractSelect
                  extended by com.vaadin.ui.Select
All Implemented Interfaces:
Buffered, BufferedValidatable, Container, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Viewer, Property<Object>, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, Action.ShortcutNotifier, FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, MethodEventSource, Connector, ClientConnector, RpcTarget, Sizeable, Vaadin6Component, VariableOwner, AbstractSelect.Filtering, Component, Component.Focusable, Field<Object>, Serializable, EventListener
Direct Known Subclasses:
ComboBox

public class Select
extends AbstractSelect
implements AbstractSelect.Filtering, FieldEvents.BlurNotifier, FieldEvents.FocusNotifier

A class representing a selection of items the user has selected in a UI. The set of choices is presented as a set of Items in a Container.

A Select component may be in single- or multiselect mode. Multiselect mode means that more than one item can be selected simultaneously.

Since:
3.0
Version:
7.0.0.alpha3
Author:
Vaadin Ltd.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractSelect
AbstractSelect.AbstractSelectTargetDetails, AbstractSelect.AcceptItem, AbstractSelect.CaptionChangeListener, AbstractSelect.DefaultNewItemHandler, AbstractSelect.Filtering, AbstractSelect.ItemCaptionMode, AbstractSelect.ItemDescriptionGenerator, AbstractSelect.MultiSelectMode, AbstractSelect.NewItemHandler, AbstractSelect.TargetItemIs, AbstractSelect.VerticalLocationIs
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler
 
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.terminal.VariableOwner
VariableOwner.ErrorEvent
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.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.terminal.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
Select()
           
Select(String caption)
           
Select(String caption, Collection<?> options)
           
Select(String caption, Container dataSource)
           
 
Method Summary
 void addListener(FieldEvents.BlurListener listener)
          Adds a BlurListener to the Component which gets fired when a Field loses keyboard focus.
 void addListener(FieldEvents.FocusListener listener)
          Adds a FocusListener to the Component which gets fired when a Field receives keyboard focus.
protected  Container.Filter buildFilter(String filterString, int filteringMode)
          Constructs a filter instance to use when using a Filterable container in the ITEM_CAPTION_MODE_PROPERTY mode.
 void changeVariables(Object source, Map<String,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.
 int getColumns()
          Deprecated. see setter function
protected  List<?> getFilteredOptions()
          Filters the options in memory and returns the full filtered list.
 int getFilteringMode()
          Gets the current filtering mode.
protected  List<?> getOptionsWithFilter(boolean needNullSelectOption)
          Returns the filtered options for the current page using a container filter.
 boolean isMultiSelect()
          Deprecated. 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).
 void paintContent(PaintTarget target)
          Paints the content of this component.
 void removeListener(FieldEvents.BlurListener listener)
          Removes a BlurListener from the Component.
 void removeListener(FieldEvents.FocusListener listener)
          Removes a FocusListener from the Component.
 void requestRepaint()
          Requests that the connector should be repainted as soon as possible.
 void setColumns(int columns)
          Deprecated.  
 void setFilteringMode(int filteringMode)
          Sets the option filtering mode.
 void setMultiSelect(boolean multiSelect)
          Deprecated. use ListSelect, OptionGroup or TwinColSelect instead
 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.
 
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, 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, addValidator, commit, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getPropertyDataSource, getRequiredError, getState, getTabIndex, getValidators, isBuffered, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isReadThrough, isRequired, isValid, isValidationVisible, isWriteThrough, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeValidator, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setPropertyDataSource, setReadOnly, setReadThrough, setRequired, setRequiredError, setTabIndex, setValidationVisible, setWriteThrough, shouldHideErrors, toString, updateState, validate, validate, valueChange
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireEvent, getActionManager, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getHeight, getHeightUnits, getIcon, getLocale, getParent, getRoot, getStyle, getStyleName, getWidth, getWidthUnits, handleError, hasListeners, isConnectorEnabled, isEnabled, isImmediate, isVisible, removeListener, removeListener, removeListener, removeListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeight, setIcon, setImmediate, setLocale, setParent, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth
 
Methods inherited from class com.vaadin.terminal.AbstractClientConnector
addExtension, addMethodInvocationToQueue, createState, getAllChildrenIterable, getConnectorId, getExtensions, getRpcManager, getRpcProxy, getStateType, registerRpc, registerRpc, removeExtension, requestRepaintAll, retrievePendingRpcCalls
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vaadin.terminal.VariableOwner
isEnabled, isImmediate
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, getApplication, getCaption, getDebugId, getIcon, getLocale, getParent, getRoot, getState, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setDebugId, setEnabled, setIcon, setReadOnly, setStyleName, setVisible, updateState
 
Methods inherited from interface com.vaadin.terminal.gwt.server.ClientConnector
getExtensions, getStateType, isConnectorEnabled, removeExtension, requestRepaintAll, retrievePendingRpcCalls, setParent
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.terminal.gwt.server.RpcTarget
getRpcManager
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth
 
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier
addShortcutListener, removeShortcutListener
 

Field Detail

pageLength

protected int pageLength
Holds value of property pageLength. 0 disables paging.

Constructor Detail

Select

public Select()

Select

public Select(String caption,
              Collection<?> options)

Select

public Select(String caption,
              Container dataSource)

Select

public Select(String caption)
Method Detail

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Paints the content of this component.

Specified by:
paintContent in interface Vaadin6Component
Overrides:
paintContent in class AbstractSelect
Parameters:
target - the Paint Event.
Throws:
PaintException - if the paint operation failed.

getOptionsWithFilter

protected List<?> getOptionsWithFilter(boolean needNullSelectOption)
Returns the filtered options for the current page using a container filter. As a size effect, 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.

Parameters:
needNullSelectOption -
Returns:
filtered list of options (may be empty) or null if cannot use container filters

buildFilter

protected Container.Filter buildFilter(String filterString,
                                       int filteringMode)
Constructs a filter instance to use when using a Filterable container in the 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.

Parameters:
filterString -
filteringMode -
Returns:

containerItemSetChange

public void containerItemSetChange(Container.ItemSetChangeEvent event)
Description copied from class: AbstractSelect
Lets the listener know a Containers Item set has changed.

Specified by:
containerItemSetChange in interface Container.ItemSetChangeListener
Overrides:
containerItemSetChange in class AbstractSelect
Parameters:
event - change event text
See Also:
Container.ItemSetChangeListener.containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent)

getFilteredOptions

protected List<?> getFilteredOptions()
Filters the options in memory and returns the full filtered list. This can be less efficient than using container filters, so use getOptionsWithFilter(boolean) if possible (filterable container and suitable item caption mode etc.).

Returns:

changeVariables

public void changeVariables(Object source,
                            Map<String,Object> variables)
Invoked when the value of a variable has changed.

Specified by:
changeVariables in interface VariableOwner
Overrides:
changeVariables in class AbstractSelect
Parameters:
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.
See Also:
com.vaadin.ui.AbstractComponent#changeVariables(java.lang.Object, java.util.Map)

requestRepaint

public void requestRepaint()
Description copied from interface: ClientConnector
Requests that the connector should be repainted as soon as possible.

Specified by:
requestRepaint in interface ClientConnector
Overrides:
requestRepaint in class AbstractComponent

setFilteringMode

public void setFilteringMode(int filteringMode)
Description copied from interface: AbstractSelect.Filtering
Sets the option filtering mode.

Specified by:
setFilteringMode in interface AbstractSelect.Filtering
Parameters:
filteringMode - the filtering mode to use

getFilteringMode

public int getFilteringMode()
Description copied from interface: AbstractSelect.Filtering
Gets the current filtering mode.

Specified by:
getFilteringMode in interface AbstractSelect.Filtering
Returns:
the filtering mode in use

setColumns

@Deprecated
public void setColumns(int columns)
Deprecated. 

Note, one should use more generic setWidth(String) method instead of this. This now days actually converts columns to width with em css unit. Sets the number of columns in the editor. If the number of columns is set 0, the actual number of displayed columns is determined implicitly by the adapter.

Parameters:
columns - the number of columns to set.

getColumns

@Deprecated
public int getColumns()
Deprecated. see setter function

Returns:

addListener

public void addListener(FieldEvents.BlurListener listener)
Description copied from interface: FieldEvents.BlurNotifier
Adds a BlurListener to the Component which gets fired when a Field loses keyboard focus.

Specified by:
addListener in interface FieldEvents.BlurNotifier
See Also:
FieldEvents.BlurListener

removeListener

public void removeListener(FieldEvents.BlurListener listener)
Description copied from interface: FieldEvents.BlurNotifier
Removes a BlurListener from the Component.

Specified by:
removeListener in interface FieldEvents.BlurNotifier
See Also:
FieldEvents.BlurListener

addListener

public void addListener(FieldEvents.FocusListener listener)
Description copied from interface: FieldEvents.FocusNotifier
Adds a FocusListener to the Component which gets fired when a Field receives keyboard focus.

Specified by:
addListener in interface FieldEvents.FocusNotifier
See Also:
FieldEvents.FocusListener

removeListener

public void removeListener(FieldEvents.FocusListener listener)
Description copied from interface: FieldEvents.FocusNotifier
Removes a FocusListener from the Component.

Specified by:
removeListener in interface FieldEvents.FocusNotifier
See Also:
FieldEvents.FocusListener

setMultiSelect

@Deprecated
public void setMultiSelect(boolean multiSelect)
Deprecated. use ListSelect, OptionGroup or TwinColSelect instead

Description copied from class: AbstractSelect
Sets the multiselect mode. Setting multiselect mode false may lose selection information: if selected items set contains one or more selected items, only one of the selected items is kept as selected. Subclasses of AbstractSelect can choose not to support changing the multiselect mode, and may throw UnsupportedOperationException.

Overrides:
setMultiSelect in class AbstractSelect
Parameters:
multiSelect - the New value of property multiSelect.
Throws:
UnsupportedOperationException - if trying to activate multiselect mode
See Also:
AbstractSelect.setMultiSelect(boolean)

isMultiSelect

@Deprecated
public boolean isMultiSelect()
Deprecated. use ListSelect, OptionGroup or TwinColSelect instead

Description copied from class: AbstractSelect
Is the select in multiselect mode? In multiselect mode

Overrides:
isMultiSelect in class AbstractSelect
Returns:
the Value of property multiSelect.
See Also:
AbstractSelect.isMultiSelect()

setScrollToSelectedItem

public 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. Only applies to single select mode. This requires finding the index of the item, which can be expensive in many large lazy loading containers.

Parameters:
scrollToSelectedItem - true to find the page with the selected item when opening the selection popup

isScrollToSelectedItem

public boolean isScrollToSelectedItem()
Returns true if the select should find the page with the selected item when opening the popup (single select combo box only).

Returns:
true if the page with the selected item will be shown when opening the popup
See Also:
setScrollToSelectedItem(boolean)


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.