Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityTableModel<E extends EntityEditModel>
- Type Parameters:
E
- the type ofEntityEditModel
used by thisEntityTableModel
- All Superinterfaces:
FilterModel<Entity>
- All Known Implementing Classes:
AbstractEntityTableModel
,SwingEntityTableModel
Specifies a table model containing
Entity
instances.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Defines 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.FilterModel
FilterModel.AbstractRefresher<T>, FilterModel.FilteredItems<T>, FilterModel.Items<T>, FilterModel.Refresher<T>, FilterModel.Sorter<T>, FilterModel.VisibleItems<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue
<Boolean> Specifies whether table models handle entity edit events, by replacing updated entities Value type: Boolean Default value: truestatic 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 theFilterModel.sorter()
model order is used as a basis for theEntityQueryModel
order by clause.Fields inherited from interface is.codion.common.model.FilterModel
ASYNC_REFRESH
-
Method Summary
Modifier and TypeMethodDescriptionDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.Deletes the selected entitieseditable()
Returns theEntityEditModel
associated with this table modelentities()
onInsert()
Specifies whether the currentFilterModel.sorter()
order is used as a basis for theEntityQueryModel
order by clause.void
refresh
(Collection<Entity.Key> keys) Refreshes the entities with the given keys by re-selecting them from the underlying database.void
replace
(Collection<Entity> entities) Replaces the given entities in this table modelvoid
select
(Collection<Entity.Key> keys) Selects entities according to the primary keys inprimaryKeys
Methods inherited from interface is.codion.common.model.FilterModel
items, sorter
-
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:
-
HANDLE_EDIT_EVENTS
Specifies whether table models handle entity edit events, by replacing updated entities- Value type: Boolean
- Default value: true
- See Also:
-
ORDER_QUERY_BY_SORT_ORDER
Specifies whether theFilterModel.sorter()
model order is used as a basis for theEntityQueryModel
order by clause. Note that this only applies toColumn
based attributes.- Value type: Boolean
- Default value: false
-
-
Method Details
-
entityType
EntityType entityType()- Returns:
- the type of the entity this table model is based on
-
connectionProvider
EntityConnectionProvider connectionProvider()- Returns:
- the connection provider used by this table model
-
connection
EntityConnection connection()Do not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.- 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 theEntityEditModel
associated with this table model- Returns:
- the edit model 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
-
editable
State editable()- Returns:
- the
State
controlling whether this table model is editable
-
deleteSelected
Collection<Entity> deleteSelected()Deletes the selected entities- Returns:
- the deleted entities
- Throws:
DatabaseException
- in case of a database exceptionCancelException
- in case the user cancels the operationIllegalStateException
- in case this table model has no edit model or if the edit model does not allow deleting
-
onInsert
Value<EntityTableModel.OnInsert> onInsert()- Returns:
- the
Value
controlling the action to perform when entities are inserted via the associated edit model - See Also:
-
removeDeleted
State removeDeleted()- Returns:
- the
State
controlling 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
-
orderQueryBySortOrder
State orderQueryBySortOrder()Specifies whether the currentFilterModel.sorter()
order is used as a basis for theEntityQueryModel
order by clause. Note that this only applies to column attributes.- Returns:
- the
State
controlling whether the current sort order should be used as a basis for the query order by clause
-
selection
MultiSelection<Entity> selection()- Specified by:
selection
in interfaceFilterModel<E extends EntityEditModel>
- Returns:
- the
MultiSelection
instance
-
queryModel
EntityQueryModel queryModel()- Returns:
- the underlying query model
-