com.vaadin.ui.
Class TwinColSelect<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.TwinColSelect<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 TwinColSelect<T> extends AbstractMultiSelect<T> implements HasDataProvider<T>
Multiselect component with two lists: left side for available items and right side for selected items.
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 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 TwinColSelect()
Constructs a new TwinColSelect.
TwinColSelect(String caption)
Constructs a new TwinColSelect with the given caption.
TwinColSelect(String caption, DataProvider<T,?> dataProvider)
Constructs a new TwinColSelect with caption and data provider for options.
TwinColSelect(String caption, Collection<T> options)
Constructs a new TwinColSelect 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.
String
getLeftColumnCaption()
Returns the text shown above the left column.
String
getRightColumnCaption()
Returns the text shown above the right column.
int
getRows()
Returns the number of rows in the selects.
protected TwinColSelectState
getState()
Returns the shared state bean with information to be sent from the server to the client.
protected TwinColSelectState
getState(boolean markAsDirty)
Returns the shared state for this connector.
void
setDataProvider(DataProvider<T,?> dataProvider)
Sets the data provider for this listing.
void
setLeftColumnCaption(String leftColumnCaption)
Sets the text shown above the left column.
void
setRightColumnCaption(String rightColumnCaption)
Sets the text shown above the right column.
void
setRows(int rows)
Sets the number of rows in the selects.
-
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
-
TwinColSelect
public TwinColSelect()
Constructs a new TwinColSelect.
-
TwinColSelect
public TwinColSelect(String caption)
Constructs a new TwinColSelect with the given caption.
Parameters:
caption
- the caption to set, can benull
-
TwinColSelect
public TwinColSelect(String caption, DataProvider<T,?> dataProvider)
Constructs a new TwinColSelect with caption and data provider for options.
Parameters:
caption
- the caption to set, can benull
dataProvider
- the data provider, notnull
Since:
8.0
-
TwinColSelect
public TwinColSelect(String caption, Collection<T> options)
Constructs a new TwinColSelect 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 selects.
Returns:
the number of rows visible
-
setRows
public void setRows(int rows)
Sets the number of rows in the selects. If the number of rows is set to 0 or less, the actual number of displayed rows is determined implicitly by the selects.
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.Parameters:
rows
- the number of rows to set.
-
setRightColumnCaption
public void setRightColumnCaption(String rightColumnCaption)
Sets the text shown above the right column.
null
clears the caption.Parameters:
rightColumnCaption
- The text to show,null
to clear
-
getRightColumnCaption
public String getRightColumnCaption()
Returns the text shown above the right column.
Returns:
The text shown or
null
if not set.
-
setLeftColumnCaption
public void setLeftColumnCaption(String leftColumnCaption)
Sets the text shown above the left column.
null
clears the caption.Parameters:
leftColumnCaption
- The text to show,null
to clear
-
getLeftColumnCaption
public String getLeftColumnCaption()
Returns the text shown above the left column.
Returns:
The text shown or
null
if not set.
-
getState
protected TwinColSelectState 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 TwinColSelectState 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
-
-