public class RuntimePropsDatasourceImpl extends AbstractDatasource<DynamicAttributesEntity> implements RuntimePropsDatasource<DynamicAttributesEntity>
AbstractDatasource.ItemListener
Datasource.CommitMode, Datasource.ItemChangeEvent<T extends Entity>, Datasource.ItemChangeListener<T extends Entity>, Datasource.ItemPropertyChangeEvent<T extends Entity>, Datasource.ItemPropertyChangeListener<T extends Entity>, Datasource.State, Datasource.StateChangeEvent<T extends Entity>, Datasource.StateChangeListener<T extends Entity>
Modifier and Type | Field and Description |
---|---|
protected java.util.Collection<CategoryAttribute> |
attributes |
protected com.haulmont.chile.core.model.MetaClass |
categorizedEntityClass |
protected Category |
category |
protected boolean |
categoryChanged |
protected DataSupplier |
dataSupplier |
protected DsContext |
dsContext |
protected DynamicAttributesGuiTools |
dynamicAttributesGuiTools |
protected boolean |
initializedBefore |
protected DynamicAttributesEntity |
item |
protected Datasource |
mainDs |
protected DynamicAttributesMetaClass |
metaClass |
protected Datasource.State |
state |
protected View |
view |
allowCommit, backgroundWorker, commitMode, id, itemsToCreate, itemsToDelete, itemsToUpdate, listener, listenersEnabled, loadDynamicAttributes, metadata, modified, parentDs
Constructor and Description |
---|
RuntimePropsDatasourceImpl(DsContext dsContext,
DataSupplier dataSupplier,
java.lang.String id,
java.lang.String mainDsId,
com.haulmont.chile.core.model.MetaClass categorizedEntityClass) |
Modifier and Type | Method and Description |
---|---|
void |
commit()
Performs commit
|
void |
committed(java.util.Set<Entity> entities)
Invoked after commit.
|
DataSupplier |
getDataSupplier() |
Category |
getDefaultCategory() |
DsContext |
getDsContext() |
DynamicAttributesEntity |
getItem() |
DynamicAttributesEntity |
getItemIfValid() |
Datasource |
getMainDs() |
com.haulmont.chile.core.model.MetaClass |
getMetaClass() |
java.util.Collection<DynamicAttributesMetaProperty> |
getPropertiesFilteredByCategory() |
Datasource.State |
getState() |
View |
getView() |
void |
initialized()
Moves the datasource to
State#INVALID . |
protected void |
initMetaClass(Entity entity) |
void |
invalidate()
Clears internal data and sets the datasource in
Datasource.State.INVALID state. |
void |
refresh()
Refreshes the datasource moving it to the
Datasource.State.VALID state |
com.haulmont.chile.core.model.MetaClass |
resolveCategorizedEntityClass() |
void |
setItem(DynamicAttributesEntity item)
Set current entity in the datasource.
|
protected void |
setMainDs(java.lang.String name) |
void |
setup(DsContext dsContext,
DataSupplier dataSupplier,
java.lang.String id,
com.haulmont.chile.core.model.MetaClass metaClass,
View view)
Setup the datasource right after creation.
|
void |
valid()
Moves the datasource to
State#VALID . |
addItemChangeListener, addItemPropertyChangeListener, addParentsToNested, addStateChangeListener, attachListener, clearCommitLists, deleted, detachListener, enableListeners, fireItemChanged, fireStateChanged, getCommitMode, getEventRouter, getId, getItemsToCreate, getItemsToDelete, getItemsToUpdate, getLoadDynamicAttributes, getParent, isAllowCommit, isModified, modified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setCommitMode, setLoadDynamicAttributes, setModified, setParent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addItemChangeListener, addItemPropertyChangeListener, addStateChangeListener, getCommitMode, getId, getLoadDynamicAttributes, isAllowCommit, isModified, removeItemChangeListener, removeItemPropertyChangeListener, removeStateChangeListener, setAllowCommit, setLoadDynamicAttributes
protected DsContext dsContext
protected DataSupplier dataSupplier
protected DynamicAttributesGuiTools dynamicAttributesGuiTools
protected DynamicAttributesMetaClass metaClass
protected View view
protected Datasource mainDs
protected com.haulmont.chile.core.model.MetaClass categorizedEntityClass
protected boolean initializedBefore
protected boolean categoryChanged
protected Datasource.State state
protected DynamicAttributesEntity item
protected Category category
protected final java.util.Collection<CategoryAttribute> attributes
public RuntimePropsDatasourceImpl(DsContext dsContext, DataSupplier dataSupplier, java.lang.String id, java.lang.String mainDsId, @Nullable com.haulmont.chile.core.model.MetaClass categorizedEntityClass)
public void setup(DsContext dsContext, DataSupplier dataSupplier, java.lang.String id, com.haulmont.chile.core.model.MetaClass metaClass, @Nullable View view) throws java.lang.UnsupportedOperationException
Datasource
setup
in interface Datasource<DynamicAttributesEntity>
setup
in class AbstractDatasource<DynamicAttributesEntity>
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.public com.haulmont.chile.core.model.MetaClass resolveCategorizedEntityClass()
resolveCategorizedEntityClass
in interface RuntimePropsDatasource<DynamicAttributesEntity>
public DsContext getDsContext()
getDsContext
in interface Datasource<DynamicAttributesEntity>
public DataSupplier getDataSupplier()
getDataSupplier
in interface Datasource<DynamicAttributesEntity>
public void commit()
Datasource
commit
in interface Datasource<DynamicAttributesEntity>
public Datasource.State getState()
getState
in interface Datasource<DynamicAttributesEntity>
public DynamicAttributesEntity getItem()
getItem
in interface Datasource<DynamicAttributesEntity>
@Nullable public DynamicAttributesEntity getItemIfValid()
getItemIfValid
in interface Datasource<DynamicAttributesEntity>
public void setItem(DynamicAttributesEntity item)
Datasource
setItem
in interface Datasource<DynamicAttributesEntity>
item
- entity instancepublic void invalidate()
Datasource
Datasource.State.INVALID
state.
In Datasource.State.NOT_INITIALIZED
does nothing.invalidate
in interface Datasource<DynamicAttributesEntity>
public void refresh()
Datasource
Datasource.State.VALID
staterefresh
in interface Datasource<DynamicAttributesEntity>
public com.haulmont.chile.core.model.MetaClass getMetaClass()
getMetaClass
in interface Datasource<DynamicAttributesEntity>
public View getView()
getView
in interface Datasource<DynamicAttributesEntity>
public void initialized()
DatasourceImplementation
State#INVALID
.initialized
in interface DatasourceImplementation<DynamicAttributesEntity>
public void valid()
DatasourceImplementation
State#VALID
.valid
in interface DatasourceImplementation<DynamicAttributesEntity>
public void committed(java.util.Set<Entity> entities)
DatasourceImplementation
committed
in interface DatasourceImplementation<DynamicAttributesEntity>
entities
- committed entities returned from middlewarepublic Datasource getMainDs()
getMainDs
in interface RuntimePropsDatasource<DynamicAttributesEntity>
public java.util.Collection<DynamicAttributesMetaProperty> getPropertiesFilteredByCategory()
getPropertiesFilteredByCategory
in interface RuntimePropsDatasource<DynamicAttributesEntity>
@Nullable public Category getDefaultCategory()
protected void setMainDs(java.lang.String name)
protected void initMetaClass(Entity entity)