public abstract class WAbstractComboBox extends WAbstractSelect<Object>
WAbstractSelect.VariantConverter
ComponentWithValue.ValueChangeListenerImpl, ComponentWithValue.ValueProperty<T>
options, PROPERTY_CAPTION, widgetConfigured
refreshing
form, INTERNAL_STATE_RECORD_PROPERTY
Constructor and Description |
---|
WAbstractComboBox(Class<Object> valueType) |
Modifier and Type | Method and Description |
---|---|
protected IVaadinContainerDataSourceAdapter |
createDataSource(RecordHolder dataSource,
RecordHolder captionValueProvider)
Called to obtain a data source which will provide available options (row objects) to the select component.
|
void |
refresh()
Refreshes the content of this component using the provided binding.
|
protected void |
restoreInternalState(Map<String,Object> state)
Restores the UI state of this component which was previously written
by
FormComponent.writeInternalState(Map) . |
void |
setExtendableOptions(CollectionHolder selectItems,
RecordHolder captionValueProvider)
Sets the options given as a collection of
uicommon::SelectItem s. |
void |
setNewItemHandler(ClosureHolder itemProvider)
Enables or disables possibility to add new options by the user.
|
void |
setOptions(CollectionHolder selectItems)
Sets the options given as a collection of
uicommon::SelectItem s. |
protected void |
writeInternalState(Map<String,Object> state)
Writes the UI state of this component to the provided map.
|
configure, createWidget, getWidget, isNullSelectionAllowed, preventGC, setNullSelectionAllowed, setOptions, setOptionsToContainer
addValidator, fireValueChanged, focus, getOnChange, getValidationErrors, inferValidator, isConvertible, isImmediate, isRequired, isValid, removeAllValidators, setImmediate, setOnChange, setRequired
getBinding, getProperty, isFullyInitialized, onPropertyValueSet, refreshBinding, setProperty
addDataErrorMessage, addStyleName, attach, call, clearDataErrorMessages, createEvent, equals, getCaption, getComponentAlignment, getContextClickHandler, getCustomErrorMessage, getDataErrorMessages, getDescription, getExpandRatio, getHasChildrenAdapter, getHeight, getIcon, getModelingId, getNamespace, getStyleName, getTabIndex, getWidth, hashCode, isEnabled, isReadOnly, isVisible, localize, markAsDirty, removeStyleName, restoreState, saveState, setCaption, setComponentAlignment, setContextClickHandler, setContextMenuItems, setCustomErrorMessage, setDescription, setEnabled, setExpandRatio, setHeight, setIcon, setReadOnly, setStyleName, setTabIndex, setVisible, setWidth, toString
public void setNewItemHandler(ClosureHolder itemProvider)
itemProvider
is expected to convert string user wrote into textfield to value. Returned object will
be set to the combo-box and available via getValue
method. It will be selected in combo-box, but wont
appear in the dropdown list. If user de-selects the value, it dissappears from the combo. The label of the new item
is generated by caption provider supplied via setOptions(Collection options*, ValueProvider caption)
method. If none is supplied, result items toString
method is used.
If the itemProvider
parameter is null
, user wont be able to add new options to the drop
down - value written into the field will be treated as filter only.itemProvider
- - converts string into objectprotected IVaadinContainerDataSourceAdapter createDataSource(RecordHolder dataSource, RecordHolder captionValueProvider)
WAbstractSelect
captionValueProvider
to provide captions for particular option row objects.createDataSource
in class WAbstractSelect<Object>
dataSource
- forms::DataSource instance, may be null - in such case just return EmptyVaadinContainerDataSourceAdapter
.captionValueProvider
- provides captions for options from the data source.public void refresh()
refresh
in class WAbstractSelect<Object>
public void setOptions(CollectionHolder selectItems)
WAbstractSelect
uicommon::SelectItem
s.setOptions
in class WAbstractSelect<Object>
selectItems
- select items representing the optionspublic void setExtendableOptions(CollectionHolder selectItems, RecordHolder captionValueProvider)
uicommon::SelectItem
s.selectItems
- - select items representing the optionscaptionValueProvider
- - generates labels for items not contained in selectItems collection. Defaults to ToStringValueProvider.protected void restoreInternalState(Map<String,Object> state)
FormComponent
FormComponent.writeInternalState(Map)
.
Subclasses should override and call super.restoreInternalState(state);
restoreInternalState
in class WAbstractSelect<Object>
state
- a map of attributes and their valuesFormComponent.writeInternalState(Map)
protected void writeInternalState(Map<String,Object> state)
FormComponent
Many UI attributes such as size, caption, etc. are not held in the records but are stored exclusively in the Vaadin components. In the records the getter/setter methods of such attributes directly delegate to the underlying component. For the purposes of the Save Document/Todo use case the state of such attributes has to be preserved.
Subclasses should override this method. The overriding method should call
super.writeInternalState(state)
to store the state form the super
class as well. The attributes should be written to the provided state
parameter. The type of the values written to the state
can only by
Java representation of LSPS types. That is java.util.Date
,
java.lang.String
, Decimal
, RecordHolder
,
ListHolder
, ... The name of the attributes stored in the map
should be unique and should not collide with the names used by any
of the superclass. It is the responsibility of the overridden method to ensure
that.
Subclasses overriding this method should also override
FormComponent.restoreInternalState(Map)
and restore the state written
by this method.
writeInternalState
in class WAbstractSelect<Object>
state
- a map to which this method should write the component's UI state.FormComponent.restoreInternalState(Map)
,
FormComponent.saveState()
Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.