public abstract class AbstractSelect extends AbstractField<Object> implements Container, Container.Viewer, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.ItemSetChangeNotifier, Container.ItemSetChangeListener, LegacyComponent
A class representing a selection of items the user has selected in a UI. The
set of choices is presented as a set of Item
s 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.
Modifier and Type | Class and Description |
---|---|
class |
AbstractSelect.AbstractSelectTargetDetails
TargetDetails implementation for subclasses of
AbstractSelect
that implement DropTarget . |
static class |
AbstractSelect.AcceptItem
This criterion accepts a only a
Transferable that contains given
Item (practically its identifier) from a specific AbstractSelect. |
protected class |
AbstractSelect.CaptionChangeListener
This is a listener helper for Item and Property changes that should cause
a repaint.
|
class |
AbstractSelect.DefaultNewItemHandler
TODO refine doc
This is a default class that handles adding new items that are typed by
user to selects container.
|
static interface |
AbstractSelect.Filtering
Interface for option filtering, used to filter options based on user
entered value.
|
static class |
AbstractSelect.ItemCaptionMode |
static interface |
AbstractSelect.ItemDescriptionGenerator
Implement this interface and pass it to Tree.setItemDescriptionGenerator
or Table.setItemDescriptionGenerator to generate mouse over descriptions
("tooltips") for the rows and cells in Table or for the items in Tree.
|
static interface |
AbstractSelect.NewItemHandler |
static class |
AbstractSelect.TargetItemIs
Criterion which accepts a drop only if the drop target is (one of) the
given Item identifier(s).
|
static class |
AbstractSelect.VerticalLocationIs
An accept criterion to accept drops only on a specific vertical location
of an item.
|
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent
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
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Sizeable.Unit
Field.ValueChangeEvent
Buffered.SourceException
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer
DESIGN_ATTR_PLAIN_TEXT
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
Constructor and Description |
---|
AbstractSelect()
Creates an empty Select.
|
AbstractSelect(String caption)
Creates an empty Select with caption.
|
AbstractSelect(String caption,
Collection<?> options)
Creates a new select that is filled from a collection of option values.
|
AbstractSelect(String caption,
Container dataSource)
Creates a new select that is connected to a data-source.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
Adds the new property to all items.
|
Object |
addItem()
Creates a new item into container with container managed id.
|
Item |
addItem(Object itemId)
Create a new item into container.
|
void |
addItems(Collection<?> itemIds)
Adds given items with given item ids to container.
|
void |
addItems(Object... itemId)
Adds given items with given item ids to container.
|
void |
addItemSetChangeListener(Container.ItemSetChangeListener listener)
Adds an Item set change listener for the object.
|
void |
addListener(Container.ItemSetChangeListener listener)
Deprecated.
As of 7.0, replaced by
addItemSetChangeListener(Container.ItemSetChangeListener) |
void |
addListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
addPropertySetChangeListener(Container.PropertySetChangeListener) |
void |
addPropertySetChangeListener(Container.PropertySetChangeListener listener)
Adds a new Property set change listener for this Container.
|
void |
attach()
Notifies the component that it is connected to an application.
|
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.
|
void |
containerPropertySetChange(Container.PropertySetChangeEvent event)
Notifies this listener that the Containers contents has changed.
|
boolean |
containsId(Object itemId)
Tests, if the collection contains an item with given id.
|
void |
detach()
Detaches the component from application.
|
protected void |
fireItemSetChange()
Fires the item set change event.
|
protected void |
firePropertySetChange()
Fires the property set change event.
|
protected AbstractSelect.CaptionChangeListener |
getCaptionChangeListener() |
Container |
getContainerDataSource()
Gets the viewing data-source container.
|
Property |
getContainerProperty(Object itemId,
Object propertyId)
Gets the Property identified by the given itemId and propertyId from the
Container
|
Collection<?> |
getContainerPropertyIds()
Gets the property Id collection from the container.
|
Item |
getItem(Object itemId)
Gets the item from the container with given id.
|
String |
getItemCaption(Object itemId)
Gets the caption of an item.
|
AbstractSelect.ItemCaptionMode |
getItemCaptionMode()
Gets the item caption mode.
|
Object |
getItemCaptionPropertyId()
Gets the item caption property.
|
Resource |
getItemIcon(Object itemId)
Gets the item icon.
|
Object |
getItemIconPropertyId()
Gets the item icon property.
|
Collection<?> |
getItemIds()
Gets the item Id collection from the container.
|
Collection<?> |
getListeners(Class<?> eventType)
Returns all listeners that are registered for the given event type or one
of its subclasses.
|
AbstractSelect.NewItemHandler |
getNewItemHandler()
TODO refine doc
|
Object |
getNullSelectionItemId()
Returns the item id that represents null value of this select in single
select mode.
|
protected AbstractSelectState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
Class<?> |
getType()
Returns the type of the property.
|
Class<?> |
getType(Object propertyId)
Gets the property type.
|
Object |
getValue()
Gets the selected item id or in multiselect mode a set of selected ids.
|
Collection<?> |
getVisibleItemIds()
Gets the visible item ids.
|
boolean |
isEmpty()
For multi-selectable fields, also an empty collection of values is
considered to be an empty field.
|
boolean |
isMultiSelect()
Is the select in multiselect mode? In multiselect mode
|
boolean |
isNewItemsAllowed()
Does the select allow adding new options by the user.
|
boolean |
isNullSelectionAllowed()
Checks if null empty selection is allowed by the user.
|
boolean |
isSelected(Object itemId)
Tests if an item is selected.
|
void |
paintContent(PaintTarget target)
Paints the content of this component.
|
protected void |
paintItem(PaintTarget target,
Object itemId) |
void |
readDesign(org.jsoup.nodes.Element design,
DesignContext context)
Reads the component state from the given design.
|
protected Object |
readItem(org.jsoup.nodes.Element child,
Set<String> selected,
DesignContext context)
Reads an Item from a design and inserts it into the data source.
|
protected void |
readItems(org.jsoup.nodes.Element design,
DesignContext context) |
boolean |
removeAllItems()
Removes all items from the container.
|
boolean |
removeContainerProperty(Object propertyId)
Removes the property from all items.
|
boolean |
removeItem(Object itemId)
Removes the Item identified by
ItemId from the Container. |
void |
removeItemSetChangeListener(Container.ItemSetChangeListener listener)
Removes the Item set change listener from the object.
|
void |
removeListener(Container.ItemSetChangeListener listener)
Deprecated.
As of 7.0, replaced by
removeItemSetChangeListener(Container.ItemSetChangeListener) |
void |
removeListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
removePropertySetChangeListener(Container.PropertySetChangeListener) |
void |
removePropertySetChangeListener(Container.PropertySetChangeListener listener)
Removes a previously registered Property set change listener.
|
void |
sanitizeSelection()
Checks that the current selection is valid, i.e.
|
void |
select(Object itemId)
Selects an item.
|
void |
setContainerDataSource(Container newDataSource)
Sets the Container that serves as the data source of the viewer.
|
void |
setItemCaption(Object itemId,
String caption)
Override the caption of an item.
|
void |
setItemCaptionMode(AbstractSelect.ItemCaptionMode mode)
Sets the item caption mode.
|
void |
setItemCaptionPropertyId(Object propertyId)
Sets the item caption property.
|
void |
setItemIcon(Object itemId,
Resource icon)
Sets the icon for an item.
|
void |
setItemIconPropertyId(Object propertyId)
Sets the item icon property.
|
void |
setMultiSelect(boolean multiSelect)
Sets the multiselect mode.
|
void |
setNewItemHandler(AbstractSelect.NewItemHandler newItemHandler)
TODO refine doc Setter for new item handler that is called when user adds
new item in newItemAllowed mode.
|
void |
setNewItemsAllowed(boolean allowNewOptions)
Enables or disables possibility to add new options by the user.
|
void |
setNullSelectionAllowed(boolean nullSelectionAllowed)
Allow or disallow empty selection by the user.
|
void |
setNullSelectionItemId(Object nullSelectionItemId)
Sets the item id that represents null value of this select.
|
void |
setValue(Object newValue)
Sets the visible value of the property.
|
protected void |
setValue(Object newFieldValue,
boolean repaintIsNotNeeded,
boolean ignoreReadOnly)
Sets the visible value of the property.
|
int |
size()
Gets the number of items in the container.
|
void |
unselect(Object itemId)
Unselects an item.
|
void |
writeDesign(org.jsoup.nodes.Element design,
DesignContext context)
Writes the component state to the given design.
|
protected org.jsoup.nodes.Element |
writeItem(org.jsoup.nodes.Element design,
Object itemId,
DesignContext context)
Writes a data source Item to a design.
|
protected void |
writeItems(org.jsoup.nodes.Element design,
DesignContext context)
Writes the data source items to a design.
|
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, beforeClientResponse, clear, commit, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getCustomAttributes, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getTabIndex, getValidators, isBuffered, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, shouldHideErrors, toString, validate, validate, valueChange
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, 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, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidth, setWidthUndefined
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
markAsDirty
isEnabled, isImmediate
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible
addAttachListener, addDetachListener, beforeClientResponse, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
addShortcutListener, removeShortcutListener
@Deprecated public static final AbstractSelect.ItemCaptionMode ITEM_CAPTION_MODE_ID
AbstractSelect.ItemCaptionMode.ID
instead@Deprecated public static final AbstractSelect.ItemCaptionMode ITEM_CAPTION_MODE_ITEM
AbstractSelect.ItemCaptionMode.ITEM
instead@Deprecated public static final AbstractSelect.ItemCaptionMode ITEM_CAPTION_MODE_INDEX
AbstractSelect.ItemCaptionMode.INDEX
instead@Deprecated public static final AbstractSelect.ItemCaptionMode ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID
AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID
instead@Deprecated public static final AbstractSelect.ItemCaptionMode ITEM_CAPTION_MODE_EXPLICIT
AbstractSelect.ItemCaptionMode.EXPLICIT
instead@Deprecated public static final AbstractSelect.ItemCaptionMode ITEM_CAPTION_MODE_ICON_ONLY
AbstractSelect.ItemCaptionMode.ICON_ONLY
instead@Deprecated public static final AbstractSelect.ItemCaptionMode ITEM_CAPTION_MODE_PROPERTY
AbstractSelect.ItemCaptionMode.PROPERTY
insteadprotected Container items
public AbstractSelect()
public AbstractSelect(String caption)
public AbstractSelect(String caption, Container dataSource)
caption
- the Caption of the component.dataSource
- the Container datasource to be selected from by this select.public AbstractSelect(String caption, Collection<?> options)
caption
- the Caption of this field.options
- the Collection containing the options.public void paintContent(PaintTarget target) throws PaintException
paintContent
in interface LegacyComponent
target
- the Paint Event.PaintException
- if the paint operation failed.protected void paintItem(PaintTarget target, Object itemId) throws PaintException
PaintException
public void changeVariables(Object source, Map<String,Object> variables)
changeVariables
in interface VariableOwner
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.AbstractComponent#changeVariables(java.lang.Object, java.util.Map)
public void setNewItemHandler(AbstractSelect.NewItemHandler newItemHandler)
newItemHandler
- public AbstractSelect.NewItemHandler getNewItemHandler()
public Collection<?> getVisibleItemIds()
public Class<?> getType()
getValue
and
setValue
methods must be compatible with this type: one can
safely cast getValue
to given type and pass any variable
assignable to this type as a parameter to setValue
.public Object getValue()
getValue
in interface Property<Object>
getValue
in class AbstractField<Object>
AbstractField.getValue()
public void setValue(Object newValue) throws Property.ReadOnlyException
The value of the select is the selected item id. If the select is in multiselect-mode, the value is a set of selected item keys. In multiselect mode all collections of id:s can be assigned.
setValue
in interface Property<Object>
setValue
in class AbstractField<Object>
newValue
- the New selected item or collection of selected items.Property.ReadOnlyException
- if the object is in read-only modeAbstractField.setValue(java.lang.Object)
protected void setValue(Object newFieldValue, boolean repaintIsNotNeeded, boolean ignoreReadOnly) throws Property.ReadOnlyException, Converter.ConversionException, Validator.InvalidValueException
The value of the select is the selected item id. If the select is in multiselect-mode, the value is a set of selected item keys. In multiselect mode all collections of id:s can be assigned.
setValue
in class AbstractField<Object>
newValue
- the New selected item or collection of selected items.repaintIsNotNeeded
- True if caller is sure that repaint is not needed.ignoreReadOnly
- True if read-only check should be omitted.Property.ReadOnlyException
Converter.ConversionException
Validator.InvalidValueException
AbstractField#setValue(java.lang.Object, java.lang.Boolean)
public Item getItem(Object itemId)
public Collection<?> getItemIds()
getItemIds
in interface Container
public Collection<?> getContainerPropertyIds()
getContainerPropertyIds
in interface Container
public Class<?> getType(Object propertyId)
getType
in interface Container
propertyId
- the Id identifying the property.Container.getType(java.lang.Object)
public int size()
size
in interface Container
Container.size()
public boolean containsId(Object itemId)
containsId
in interface Container
itemId
- the Id the of item to be tested.public Property getContainerProperty(Object itemId, Object propertyId)
getContainerProperty
in interface Container
itemId
- ID of the visible Item which contains the PropertypropertyId
- ID of the Property to retrievenull
Container.getContainerProperty(Object, Object)
public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException
addContainerProperty
in interface Container
propertyId
- ID of the Propertytype
- Data type of the new PropertydefaultValue
- The value all created Properties are initialized toUnsupportedOperationException
- if the container does not support explicitly adding container
propertiesContainer.addContainerProperty(java.lang.Object, java.lang.Class,
java.lang.Object)
public boolean removeAllItems() throws UnsupportedOperationException
removeAllItems
in interface Container
UnsupportedOperationException
- if the container does not support removing all itemsContainer.removeAllItems()
public Object addItem() throws UnsupportedOperationException
addItem
in interface Container
UnsupportedOperationException
- if adding an item without an explicit item ID is not
supported by the containerContainer.addItem()
public Item addItem(Object itemId) throws UnsupportedOperationException
addItem
in interface Container
itemId
- the Identification of the item to be created.UnsupportedOperationException
- if adding an item with an explicit item ID is not supported
by the containerContainer.addItem(java.lang.Object)
public void addItems(Object... itemId) throws UnsupportedOperationException
itemId
- item identifiers to be added to underlying containerUnsupportedOperationException
- if the underlying container don't support adding items with
identifierspublic void addItems(Collection<?> itemIds) throws UnsupportedOperationException
itemIds
- item identifiers to be added to underlying containerUnsupportedOperationException
- if the underlying container don't support adding items with
identifierspublic boolean removeItem(Object itemId) throws UnsupportedOperationException
Container
ItemId
from the Container.
Containers that support filtering should also allow removing an item that is currently filtered out.
This functionality is optional.
removeItem
in interface Container
itemId
- ID of the Item to removetrue
if the operation succeeded, false
if notUnsupportedOperationException
- if the container does not support removing individual itemspublic void sanitizeSelection()
public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException
removeContainerProperty
in interface Container
propertyId
- ID of the Property to removeUnsupportedOperationException
- if the container does not support removing container
propertiesContainer.removeContainerProperty(java.lang.Object)
public void setContainerDataSource(Container newDataSource)
setContainerDataSource
in interface Container.Viewer
newDataSource
- the new data source.Container.Viewer#setContainerDataSource(Container)
public Container getContainerDataSource()
getContainerDataSource
in interface Container.Viewer
Container.Viewer#getContainerDataSource()
public boolean isMultiSelect()
public void setMultiSelect(boolean multiSelect)
UnsupportedOperationException
.multiSelect
- the New value of property multiSelect.public boolean isNewItemsAllowed()
public void setNewItemsAllowed(boolean allowNewOptions)
allowNewOptions
- the New value of property allowNewOptions.public void setItemCaption(Object itemId, String caption)
itemId
- the id of the item to be recaptioned.caption
- the New caption.public String getItemCaption(Object itemId)
setItemCaptionMode()
for more
details.itemId
- the id of the item to be queried.public void setItemIcon(Object itemId, Resource icon)
itemId
- the id of the item to be assigned an icon.icon
- the icon to use or null.public Resource getItemIcon(Object itemId)
itemId
- the id of the item to be assigned an icon.public void setItemCaptionMode(AbstractSelect.ItemCaptionMode mode)
AbstractSelect.ItemCaptionMode
for a description of the modes.
AbstractSelect.ItemCaptionMode.EXPLICIT_DEFAULTS_ID
is the default mode.
mode
- the One of the modes listed above.public AbstractSelect.ItemCaptionMode getItemCaptionMode()
The mode can be one of the following ones:
ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID
: Items
Id-objects toString
is used as item caption. If caption is
explicitly specified, it overrides the id-caption.
ITEM_CAPTION_MODE_ID
: Items Id-objects
toString
is used as item caption.ITEM_CAPTION_MODE_ITEM
: Item-objects
toString
is used as item caption.ITEM_CAPTION_MODE_INDEX
: The index of the item is used
as item caption. The index mode can only be used with the containers
implementing Container.Indexed
interface.ITEM_CAPTION_MODE_EXPLICIT
: The item captions must be
explicitly specified.ITEM_CAPTION_MODE_PROPERTY
: The item captions are read
from property, that must be specified with
setItemCaptionPropertyId
.ITEM_CAPTION_MODE_EXPLICIT_DEFAULTS_ID
is the default
mode.
public void setItemCaptionPropertyId(Object propertyId)
Setting the id to a existing property implicitly sets the item caption
mode to ITEM_CAPTION_MODE_PROPERTY
. If the object is in
ITEM_CAPTION_MODE_PROPERTY
mode, setting caption property id
null resets the item caption mode to
ITEM_CAPTION_EXPLICIT_DEFAULTS_ID
.
Note that the type of the property used for caption must be String
Setting the property id to null disables this feature. The id is null by default
.propertyId
- the id of the property.public Object getItemCaptionPropertyId()
public void setItemIconPropertyId(Object propertyId) throws IllegalArgumentException
If the property id is set to a valid value, each item is given an icon got from the given property of the items. The type of the property must be assignable to Resource.
Note : The icons set with setItemIcon
function override the
icons from the property.
Setting the property id to null disables this feature. The id is null by default
.propertyId
- the id of the property that specifies icons for items or nullIllegalArgumentException
- If the propertyId is not in the container or is not of a
valid typepublic Object getItemIconPropertyId()
If the property id is set to a valid value, each item is given an icon got from the given property of the items. The type of the property must be assignable to Icon.
Note : The icons set with setItemIcon
function override the
icons from the property.
Setting the property id to null disables this feature. The id is null by default
.public boolean isSelected(Object itemId)
In single select mode testing selection status of the item identified by
getNullSelectionItemId()
returns true if the value of the
property is null.
itemId
- the Id the of the item to be tested.getNullSelectionItemId()
,
setNullSelectionItemId(Object)
public void select(Object itemId)
In single select mode selecting item identified by
getNullSelectionItemId()
sets the value of the property to null.
itemId
- the identifier of Item to be selected.getNullSelectionItemId()
,
setNullSelectionItemId(Object)
public void unselect(Object itemId)
itemId
- the identifier of the Item to be unselected.getNullSelectionItemId()
,
setNullSelectionItemId(Object)
public void containerPropertySetChange(Container.PropertySetChangeEvent event)
containerPropertySetChange
in interface Container.PropertySetChangeListener
event
- Change event.Container.PropertySetChangeListener#containerPropertySetChange(Container.PropertySetChangeEvent)
public void addPropertySetChangeListener(Container.PropertySetChangeListener listener)
addPropertySetChangeListener
in interface Container.PropertySetChangeNotifier
listener
- The new Listener to be registeredContainer.PropertySetChangeNotifier#addListener(Container.PropertySetChangeListener)
@Deprecated public void addListener(Container.PropertySetChangeListener listener)
addPropertySetChangeListener(Container.PropertySetChangeListener)
addListener
in interface Container.PropertySetChangeNotifier
public void removePropertySetChangeListener(Container.PropertySetChangeListener listener)
removePropertySetChangeListener
in interface Container.PropertySetChangeNotifier
listener
- Listener to be removedContainer.PropertySetChangeNotifier#removeListener(Container.PropertySetChangeListener)
@Deprecated public void removeListener(Container.PropertySetChangeListener listener)
removePropertySetChangeListener(Container.PropertySetChangeListener)
removeListener
in interface Container.PropertySetChangeNotifier
public void addItemSetChangeListener(Container.ItemSetChangeListener listener)
addItemSetChangeListener
in interface Container.ItemSetChangeNotifier
listener
- listener to be addedContainer.ItemSetChangeNotifier#addListener(Container.ItemSetChangeListener)
@Deprecated public void addListener(Container.ItemSetChangeListener listener)
addItemSetChangeListener(Container.ItemSetChangeListener)
addListener
in interface Container.ItemSetChangeNotifier
public void removeItemSetChangeListener(Container.ItemSetChangeListener listener)
removeItemSetChangeListener
in interface Container.ItemSetChangeNotifier
listener
- listener to be removedContainer.ItemSetChangeNotifier#removeListener(Container.ItemSetChangeListener)
@Deprecated public void removeListener(Container.ItemSetChangeListener listener)
removeItemSetChangeListener(Container.ItemSetChangeListener)
removeListener
in interface Container.ItemSetChangeNotifier
public Collection<?> getListeners(Class<?> eventType)
AbstractClientConnector
getListeners
in class AbstractClientConnector
eventType
- The type of event to return listeners for.public void containerItemSetChange(Container.ItemSetChangeEvent event)
containerItemSetChange
in interface Container.ItemSetChangeListener
event
- change event textContainer.ItemSetChangeListener#containerItemSetChange(Container.ItemSetChangeEvent)
protected void firePropertySetChange()
protected void fireItemSetChange()
public boolean isEmpty()
isEmpty
in interface Field<Object>
isEmpty
in class AbstractField<Object>
AbstractField.isEmpty().
public void setNullSelectionAllowed(boolean nullSelectionAllowed)
setNullSelectionItemId()
. This way you can for
instance set an icon and caption for the null selection item.nullSelectionAllowed
- whether or not to allow empty selectionsetNullSelectionItemId(Object)
,
isNullSelectionAllowed()
public boolean isNullSelectionAllowed()
setNullSelectionAllowed(boolean)
public Object getNullSelectionItemId()
Data interface does not support nulls as item ids. Selecting the item identified by this id is the same as selecting no items at all. This setting only affects the single select mode.
setNullSelectionItemId(Object)
,
isSelected(Object)
,
select(Object)
public void setNullSelectionItemId(Object nullSelectionItemId)
Data interface does not support nulls as item ids. Selecting the item identified by this id is the same as selecting no items at all. This setting only affects the single select mode.
nullSelectionItemId
- the nullSelectionItemId to set.getNullSelectionItemId()
,
isSelected(Object)
,
select(Object)
public void attach()
attach
in interface ClientConnector
attach
in interface Component
attach
in class AbstractField<Object>
AbstractField.attach()
public void detach()
detach
in interface ClientConnector
detach
in class AbstractField<Object>
AbstractComponent.detach()
protected AbstractSelect.CaptionChangeListener getCaptionChangeListener()
public void readDesign(org.jsoup.nodes.Element design, DesignContext context)
Component
The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
readDesign
in interface Component
readDesign
in class AbstractField<Object>
design
- The element to obtain the state fromcontext
- The DesignContext instance used for parsing the designprotected void readItems(org.jsoup.nodes.Element design, DesignContext context)
protected Object readItem(org.jsoup.nodes.Element child, Set<String> selected, DesignContext context)
child
- a child element representing the itemselected
- A set accumulating selected items. If the item that is read is
marked as selected, its item id should be added to this set.context
- the DesignContext instance used in parsingDesignException
- if the tag name of the child
element is not
option
.public void writeDesign(org.jsoup.nodes.Element design, DesignContext context)
Component
The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
writeDesign
in interface Component
writeDesign
in class AbstractField<Object>
design
- The element to write the component state to. Any previous
attributes or child nodes are not cleared.context
- The DesignContext instance used for writing the designprotected void writeItems(org.jsoup.nodes.Element design, DesignContext context)
design
- the element into which to insert the itemscontext
- the DesignContext instance used in writingprotected org.jsoup.nodes.Element writeItem(org.jsoup.nodes.Element design, Object itemId, DesignContext context)
design
- the element into which to insert the itemitemId
- the id of the item to writecontext
- the DesignContext instance used in writingprotected AbstractSelectState getState()
AbstractComponent
getState
in class AbstractField<Object>
Copyright © 2019 Vaadin Ltd. All rights reserved.