public class DatasourceOptions<E extends Entity<K>,K> extends java.lang.Object implements Options<E>, EntityOptions<E>
EntityOptions.ValueChangeEvent<T>
Options.OptionsChangeEvent<T>
DataUnit.StateChangeEvent
Modifier and Type | Field and Description |
---|---|
protected CollectionDatasource<E,K> |
datasource |
protected com.haulmont.bali.events.EventHub |
events |
protected BindingState |
state |
Constructor and Description |
---|
DatasourceOptions(CollectionDatasource<E,K> datasource) |
Modifier and Type | Method and Description |
---|---|
com.haulmont.bali.events.Subscription |
addOptionsChangeListener(java.util.function.Consumer<Options.OptionsChangeEvent<E>> listener) |
com.haulmont.bali.events.Subscription |
addStateChangeListener(java.util.function.Consumer<DataUnit.StateChangeEvent> listener)
Registers a new state change listener.
|
com.haulmont.bali.events.Subscription |
addValueChangeListener(java.util.function.Consumer<EntityOptions.ValueChangeEvent<E>> listener) |
boolean |
containsItem(E item) |
protected void |
datasourceCollectionChanged(CollectionDatasource.CollectionChangeEvent<E,K> e) |
protected void |
datasourceItemPropertyChanged(Datasource.ItemPropertyChangeEvent<E> e) |
protected void |
datasourceStateChanged(Datasource.StateChangeEvent<E> e) |
CollectionDatasource<E,K> |
getDatasource() |
com.haulmont.chile.core.model.MetaClass |
getEntityMetaClass() |
java.util.stream.Stream<E> |
getOptions() |
BindingState |
getState() |
void |
refresh()
Refreshes the source moving it to the
BindingState.ACTIVE state |
void |
setSelectedItem(E item)
Set current item in the source.
|
protected void |
setState(BindingState state) |
void |
updateItem(E item)
Update an item in the collection if it is already there.
|
protected CollectionDatasource<E extends Entity<K>,K> datasource
protected com.haulmont.bali.events.EventHub events
protected BindingState state
public DatasourceOptions(CollectionDatasource<E,K> datasource)
protected void datasourceCollectionChanged(CollectionDatasource.CollectionChangeEvent<E,K> e)
protected void datasourceItemPropertyChanged(Datasource.ItemPropertyChangeEvent<E> e)
protected void datasourceStateChanged(Datasource.StateChangeEvent<E> e)
public CollectionDatasource<E,K> getDatasource()
public java.util.stream.Stream<E> getOptions()
getOptions
in interface Options<E extends Entity<K>>
public BindingState getState()
protected void setState(BindingState state)
public boolean containsItem(E item)
containsItem
in interface EntityOptions<E extends Entity<K>>
public void updateItem(E item)
EntityOptions
updateItem
in interface EntityOptions<E extends Entity<K>>
public void refresh()
EntityOptions
BindingState.ACTIVE
staterefresh
in interface EntityOptions<E extends Entity<K>>
public com.haulmont.bali.events.Subscription addStateChangeListener(java.util.function.Consumer<DataUnit.StateChangeEvent> listener)
DataUnit
addStateChangeListener
in interface DataUnit
listener
- the listener to be addedpublic com.haulmont.bali.events.Subscription addValueChangeListener(java.util.function.Consumer<EntityOptions.ValueChangeEvent<E>> listener)
addValueChangeListener
in interface EntityOptions<E extends Entity<K>>
public com.haulmont.bali.events.Subscription addOptionsChangeListener(java.util.function.Consumer<Options.OptionsChangeEvent<E>> listener)
addOptionsChangeListener
in interface Options<E extends Entity<K>>
public com.haulmont.chile.core.model.MetaClass getEntityMetaClass()
getEntityMetaClass
in interface EntityDataUnit
MetaClass
of an entity contained in the sourcepublic void setSelectedItem(E item)
EntityOptions
setSelectedItem
in interface EntityOptions<E extends Entity<K>>
item
- the item to set