com.vaadin.ui.
Class ListSelect<T>
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.AbstractListing<T>
-
- com.vaadin.ui.AbstractMultiSelect<T>
-
- com.vaadin.ui.ListSelect<T>
-
Type Parameters:
T
- item typeAll Implemented Interfaces:
HasDataProvider<T>
,HasItems<T>
,HasValue<Set<T>>
,ContextClickEvent.ContextClickNotifier
,MethodEventSource
,ClientConnector
,Sizeable
,Connector
,Component
,Component.Focusable
,MultiSelect<T>
,Serializable
public class ListSelect<T> extends AbstractMultiSelect<T> implements HasDataProvider<T>
This is a simple list select without, for instance, support for new items, lazyloading, and other advanced features.
Author:
Vaadin Ltd
See Also:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractListing
AbstractListing.AbstractListingExtension<T>
-
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.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.data.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<V>
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_ROWS
Default number of rows visible for select.
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
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
Constructors Constructor Description ListSelect()
Constructs a new ListSelect.
ListSelect(String caption)
Constructs a new ListSelect with the given caption.
ListSelect(String caption, DataProvider<T,?> dataProvider)
Constructs a new ListSelect with caption and data provider for options.
ListSelect(String caption, Collection<T> options)
Constructs a new ListSelect with caption and the given options.
-
Method Summary
All Methods Modifier and Type Method Description DataProvider<T,?>
getDataProvider()
Returns the source of data items used by this listing.
int
getRows()
Returns the number of rows in the select.
protected ListSelectState
getState()
Returns the shared state bean with information to be sent from the server to the client.
protected ListSelectState
getState(boolean markAsDirty)
Returns the shared state for this connector.
void
setDataProvider(DataProvider<T,?> dataProvider)
Sets the data provider for this listing.
void
setRows(int rows)
Sets the number of rows in the select.
-
Methods inherited from class com.vaadin.ui.AbstractMultiSelect
addSelectionListener, addValueChangeListener, deselect, deselect, deselectAll, getCustomAttributes, getItemCaptionGenerator, getItemEnabledProvider, getSelectedItems, getValue, isReadOnly, isRequiredIndicatorVisible, isSelected, readItem, readItems, select, setItemCaptionGenerator, setItemEnabledProvider, setReadOnly, setRequiredIndicatorVisible, setValue, updateSelection, updateSelection, writeItem
-
Methods inherited from class com.vaadin.ui.AbstractListing
addDataGenerator, deserializeDeclarativeRepresentation, doReadDesign, doWriteDesign, focus, getDataCommunicator, getItemIconGenerator, getTabIndex, internalGetDataProvider, internalSetDataProvider, internalSetDataProvider, readDesign, readItem, removeDataGenerator, serializeDeclarativeRepresentation, setItemIconGenerator, setTabIndex, writeDesign, writeItems
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthFull, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesign
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.data.HasDataProvider
setItems
-
Methods inherited from interface com.vaadin.data.HasValue
clear, getDefaultValidator, getOptionalValue, isEmpty
-
Methods inherited from interface com.vaadin.ui.MultiSelect
deselect, getEmptyValue, select
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
-
-
-
-
Constructor Detail
-
ListSelect
public ListSelect()
Constructs a new ListSelect.
-
ListSelect
public ListSelect(String caption)
Constructs a new ListSelect with the given caption.
Parameters:
caption
- the caption to set, can benull
-
ListSelect
public ListSelect(String caption, DataProvider<T,?> dataProvider)
Constructs a new ListSelect with caption and data provider for options.
Parameters:
caption
- the caption to set, can benull
dataProvider
- the data provider, notnull
Since:
8.0
-
ListSelect
public ListSelect(String caption, Collection<T> options)
Constructs a new ListSelect with caption and the given options.
Parameters:
caption
- the caption to set, can benull
options
- the options, cannot benull
-
-
Method Detail
-
getRows
public int getRows()
Returns the number of rows in the select.
Default value is
DEFAULT_ROWS
Returns:
the number of rows visible
-
setRows
public void setRows(int rows)
Sets the number of rows in the select. If the number of rows is set to 0, the actual number of displayed rows is determined implicitly by the select.
If a height if set (using
AbstractComponent.setHeight(String)
orAbstractComponent.setHeight(float, Unit)
) it overrides the number of rows. Leave the height undefined to use this method.Default value is
DEFAULT_ROWS
Parameters:
rows
- the number of rows to set.
-
getState
protected ListSelectState getState()
Description copied from class:
AbstractComponent
Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().
Overrides:
getState
in classAbstractMultiSelect<T>
Returns:
updated component shared state
-
getState
protected ListSelectState getState(boolean markAsDirty)
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector.
Overrides:
getState
in classAbstractMultiSelect<T>
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
getDataProvider
public DataProvider<T,?> getDataProvider()
Description copied from interface:
HasItems
Returns the source of data items used by this listing.
Specified by:
getDataProvider
in interfaceHasItems<T>
Returns:
the data provider, not null
-
setDataProvider
public void setDataProvider(DataProvider<T,?> dataProvider)
Description copied from interface:
HasDataProvider
Sets the data provider for this listing. The data provider is queried for displayed items as needed.
Specified by:
setDataProvider
in interfaceHasDataProvider<T>
Parameters:
dataProvider
- the data provider, not null
-
-