Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityTableModel<E extends EntityEditModel<R>,R extends EntityEditor<R>>
- Type Parameters:
E- theEntityEditModeltypeR- theEntityEditortype
- All Superinterfaces:
FilterModel<Entity>,FilterTableModel<Entity,Attribute<?>>
- All Known Implementing Classes:
AbstractEntityTableModel,SwingEntityTableModel
public interface EntityTableModel<E extends EntityEditModel<R>,R extends EntityEditor<R>>
extends FilterTableModel<Entity,Attribute<?>>
Specifies a table model containing
Entity instances.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceControls table model editingstatic enumDefines the actions a table model can perform when entities are inserted via the associated edit modelNested classes/interfaces inherited from interface is.codion.common.model.filter.FilterModel
FilterModel.FilteredItems<T>, FilterModel.IncludedItems<T>, FilterModel.IncludePredicate<T>, FilterModel.Items<T>, FilterModel.Refresher<T>, FilterModel.Sort<T>Nested classes/interfaces inherited from interface is.codion.common.model.component.table.FilterTableModel
FilterTableModel.Builder<R,C>, FilterTableModel.ColumnValues<C>, FilterTableModel.Export<C>, FilterTableModel.TableColumns<R, C> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<EntityTableModel.OnInsert> Specifies the default action a table model takes when entities are inserted via its edit model.static final PropertyValue<Boolean> Specifies whether theFilterTableModel.sort()model order is used as a basis for theEntityQueryModelorder by clause.Fields inherited from interface is.codion.common.model.filter.FilterModel
ASYNC -
Method Summary
Modifier and TypeMethodDescriptionTypically the single self-managing connection shared by all models of an application, safe to hold on to and use for its lifetime, seeEntityApplicationModel.connection().Returns theEntityEditModelassociated with this table modeleditor()Returns theEntityEditorassociated with this table modelentities()onInsert()Specifies whether the currentFilterTableModel.sort()order is used as a basis for theEntityQueryModelorder by clause.query()voidrefresh(Collection<Entity.Key> keys) Refreshes the entities with the given keys by re-selecting them from the underlying database.voidreplace(Collection<Entity> entities) Replaces the given entities in this table modelvoidrestore(Preferences preferences) Restores the model-owned persistent state of this table model - the query condition settings, filter settings and sort order - from the given preferences node.voidselect(Collection<Entity.Key> keys) Selects entities according to the primary keys inprimaryKeysvoidstore(Preferences preferences) Stores the model-owned persistent state of this table model - the query condition settings, filter settings and sort order - to the given preferences node.Methods inherited from interface is.codion.common.model.filter.FilterModel
items
-
Field Details
-
ON_INSERT
Specifies the default action a table model takes when entities are inserted via its edit model.- Value type:
EntityTableModel.OnInsert - Default value:
EntityTableModel.OnInsert.PREPEND
- Value type:
-
ORDER_QUERY
Specifies whether theFilterTableModel.sort()model order is used as a basis for theEntityQueryModelorder by clause. Note that this only applies toColumnbased attributes.- Value type: Boolean
- Default value: false
-
-
Method Details
-
entityType
EntityType entityType()- Returns:
- the type of the entity this table model is based on
-
connection
EntityConnection connection()Typically the single self-managing connection shared by all models of an application, safe to hold on to and use for its lifetime, see
EntityApplicationModel.connection().- Returns:
- the connection used by this table model
-
entities
Entities entities()- Returns:
- the underlying domain entities
-
entityDefinition
EntityDefinition entityDefinition()- Returns:
- the definition of the underlying entity
-
editModel
E editModel()Returns theEntityEditModelassociated with this table model- Returns:
- the edit model associated with this table model
-
editor
R editor()Returns theEntityEditorassociated with this table model- Returns:
- the editor associated with this table model
-
replace
Replaces the given entities in this table model- Parameters:
entities- the entities to replace
-
refresh
Refreshes the entities with the given keys by re-selecting them from the underlying database.- Parameters:
keys- the keys of the entities to refresh
-
onInsert
Value<EntityTableModel.OnInsert> onInsert()- Returns:
- the
Valuecontrolling the action to perform when entities are inserted via the associated edit model - See Also:
-
removeDeleted
State removeDeleted()- Returns:
- the
Statecontrolling whether entities that are deleted via the associated edit model should be automatically removed from this table model
-
select
Selects entities according to the primary keys inprimaryKeys- Parameters:
keys- the primary keys of the entities to select
-
orderQuery
State orderQuery()Specifies whether the currentFilterTableModel.sort()order is used as a basis for theEntityQueryModelorder by clause. Note that this only applies to column attributes.- Returns:
- the
Statecontrolling whether the current sort order should be used as a basis for the query order by clause
-
query
EntityQueryModel query()- Returns:
- the underlying query model
-
store
Stores the model-owned persistent state of this table model - the query condition settings, filter settings and sort order - to the given preferences node. May be overridden to persist custom state, in which casesuper.store(preferences)should be called in order to retain the default state.- Parameters:
preferences- the preferences node to store to- See Also:
-
restore
Restores the model-owned persistent state of this table model - the query condition settings, filter settings and sort order - from the given preferences node.- Parameters:
preferences- the preferences node to restore from- See Also:
-
rowEditor
EntityTableModel.EntityRowEditor rowEditor()- Returns:
- the
EntityTableModel.EntityRowEditor
-