T
- type of entity this datasource is working withpublic interface Datasource<T extends Entity>
Modifier and Type | Interface and Description |
---|---|
static class |
Datasource.CommitMode
Where to commit changes
|
static class |
Datasource.ItemChangeEvent<T extends Entity> |
static interface |
Datasource.ItemChangeListener<T extends Entity>
Listener to datasource item change events.
|
static class |
Datasource.ItemPropertyChangeEvent<T extends Entity> |
static interface |
Datasource.ItemPropertyChangeListener<T extends Entity>
Listener to datasource item property value change events.
|
static class |
Datasource.State
Possible states of datasource:
Datasource.State.NOT_INITIALIZED , Datasource.State.INVALID , Datasource.State.VALID |
static class |
Datasource.StateChangeEvent<T extends Entity> |
static interface |
Datasource.StateChangeListener<T extends Entity>
Listener to datasource state change events.
|
void setup(DsContext dsContext, DataSupplier dataSupplier, java.lang.String id, MetaClass metaClass, @Nullable View view) throws java.lang.UnsupportedOperationException
dsContext
- DsContext instancedataSupplier
- DataSupplier instanceid
- datasource IDmetaClass
- MetaClass of an entity that will be stored in this datasourceview
- a view that will be used to load entities form DB, can be nulljava.lang.UnsupportedOperationException
- if an implementation doesn't support this method. This is the case
for example for NestedDatasource
implementors, that have their own setup method.java.lang.String getId()
DsContext getDsContext()
DataSupplier getDataSupplier()
boolean isModified()
boolean isAllowCommit()
void setAllowCommit(boolean allowCommit)
isModified()
always returns false and commit()
has no effect.Datasource.CommitMode getCommitMode()
void commit()
Datasource.State getState()
T getItem()
@Nullable T getItemIfValid()
void setItem(@Nullable T item)
item
- entity instancevoid invalidate()
Datasource.State.INVALID
state.
In Datasource.State.NOT_INITIALIZED
does nothing.void refresh()
Datasource.State.VALID
stateMetaClass getMetaClass()
@Nullable View getView()
@Deprecated void addListener(DatasourceListener<T> listener)
addItemChangeListener(ItemChangeListener)
addItemPropertyChangeListener(ItemPropertyChangeListener)
addStateChangeListener(StateChangeListener)
CollectionDatasource.addCollectionChangeListener(CollectionDatasource.CollectionChangeListener)
@Deprecated void removeListener(DatasourceListener<T> listener)
void addItemChangeListener(Datasource.ItemChangeListener<T> listener)
void removeItemChangeListener(Datasource.ItemChangeListener<T> listener)
void addStateChangeListener(Datasource.StateChangeListener<T> listener)
void removeStateChangeListener(Datasource.StateChangeListener<T> listener)
void addItemPropertyChangeListener(Datasource.ItemPropertyChangeListener<T> listener)
void removeItemPropertyChangeListener(Datasource.ItemPropertyChangeListener<T> listener)
boolean getLoadDynamicAttributes()
void setLoadDynamicAttributes(boolean value)
value
- whether to load dynamic attributes