Module is.codion.framework.model
Package is.codion.framework.model
Class AbstractEntityTableModel<E extends EntityEditModel>
java.lang.Object
is.codion.framework.model.AbstractEntityTableModel<E>
- Type Parameters:
E- theEntityEditModeltype
- All Implemented Interfaces:
FilterModel<Entity>,EntityTableModel<E>
- Direct Known Subclasses:
SwingEntityTableModel
public abstract class AbstractEntityTableModel<E extends EntityEditModel>
extends Object
implements EntityTableModel<E>
An abstract
EntityTableModel implementation-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EntityTableModel
EntityTableModel.OnInsertNested classes/interfaces inherited from interface is.codion.common.model.filter.FilterModel
FilterModel.AbstractRefresher<T>, FilterModel.FilteredItems<T>, FilterModel.IncludedItems<T>, FilterModel.IncludedPredicate<T>, FilterModel.Items<T>, FilterModel.Refresher<T>, FilterModel.Sort<T> -
Field Summary
Fields inherited from interface is.codion.framework.model.EntityTableModel
ON_INSERT, ORDER_QUERYFields inherited from interface is.codion.common.model.filter.FilterModel
ASYNC -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractEntityTableModel(E editModel, FilterModel<Entity> filterModel) protectedAbstractEntityTableModel(E editModel, FilterModel<Entity> filterModel, EntityQueryModel queryModel) -
Method Summary
Modifier and TypeMethodDescriptionfinal EntityConnectionDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.final EntityConnectionProviderfinal Collection<Entity> Deletes the selected entitiesfinal Stateeditable()final EReturns theEntityEditModelassociated with this table modelfinal Entitiesentities()final EntityDefinitionfinal EntityTypeprotected FilterModel<Entity> final Value<EntityTableModel.OnInsert> onInsert()protected abstract voidonRowsUpdated(int fromIndex, int toIndex) Notifies all listeners that the given rows have changedorderBy()final StateSpecifies whether the currentFilterModel.sort()order is used as a basis for theEntityQueryModelorder by clause.final EntityQueryModelfinal voidrefresh(Collection<Entity.Key> keys) Refreshes the entities with the given keys by re-selecting them from the underlying database.final Statefinal voidreplace(Collection<Entity> entities) Replaces the given entities in this table modelfinal voidselect(Collection<Entity.Key> keys) Selects entities according to the primary keys inprimaryKeysfinal StringtoString()protected voidupdated(ForeignKey foreignKey, Map<Entity.Key, Entity> entities) Called when entities of the type referenced by the given foreign key are updatedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface is.codion.framework.model.EntityTableModel
selectionMethods inherited from interface is.codion.common.model.filter.FilterModel
items, sort
-
Constructor Details
-
AbstractEntityTableModel
- Parameters:
editModel- the edit modelfilterModel- the list model
-
AbstractEntityTableModel
protected AbstractEntityTableModel(E editModel, FilterModel<Entity> filterModel, EntityQueryModel queryModel) - Parameters:
editModel- the edit modelfilterModel- the list modelqueryModel- the table query model- Throws:
IllegalArgumentException- in case the edit and query model entity types do not match
-
-
Method Details
-
entities
- Specified by:
entitiesin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the underlying domain entities
-
entityDefinition
- Specified by:
entityDefinitionin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the definition of the underlying entity
-
toString
-
onInsert
- Specified by:
onInsertin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the
Valuecontrolling the action to perform when entities are inserted via the associated edit model - See Also:
-
removeDeleted
- Specified by:
removeDeletedin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the
Statecontrolling whether entities that are deleted via the associated edit model should be automatically removed from this table model
-
entityType
- Specified by:
entityTypein interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the type of the entity this table model is based on
-
editModel
Description copied from interface:EntityTableModelReturns theEntityEditModelassociated with this table model- Specified by:
editModelin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the edit model associated with this table model
-
connectionProvider
- Specified by:
connectionProviderin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the connection provider used by this table model
-
connection
Description copied from interface:EntityTableModelDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.- Specified by:
connectionin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the connection used by this table model
-
orderQuery
Description copied from interface:EntityTableModelSpecifies whether the currentFilterModel.sort()order is used as a basis for theEntityQueryModelorder by clause. Note that this only applies to column attributes.- Specified by:
orderQueryin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the
Statecontrolling whether the current sort order should be used as a basis for the query order by clause
-
queryModel
- Specified by:
queryModelin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the underlying query model
-
editable
- Specified by:
editablein interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the
Statecontrolling whether this table model is editable
-
replace
Description copied from interface:EntityTableModelReplaces the given entities in this table model- Specified by:
replacein interfaceEntityTableModel<E extends EntityEditModel>- Parameters:
entities- the entities to replace
-
refresh
Description copied from interface:EntityTableModelRefreshes the entities with the given keys by re-selecting them from the underlying database.- Specified by:
refreshin interfaceEntityTableModel<E extends EntityEditModel>- Parameters:
keys- the keys of the entities to refresh
-
select
Description copied from interface:EntityTableModelSelects entities according to the primary keys inprimaryKeys- Specified by:
selectin interfaceEntityTableModel<E extends EntityEditModel>- Parameters:
keys- the primary keys of the entities to select
-
deleteSelected
Description copied from interface:EntityTableModelDeletes the selected entities- Specified by:
deleteSelectedin interfaceEntityTableModel<E extends EntityEditModel>- Returns:
- the deleted entities
-
filterModel
- Returns:
- the underlying model
-
onRowsUpdated
protected abstract void onRowsUpdated(int fromIndex, int toIndex) Notifies all listeners that the given rows have changed- Parameters:
fromIndex- the from indextoIndex- the to index
-
orderBy
- Returns:
- a
OrderByinstance based on the sort order according to theFilterModel.sort()model, an emptyOptionalif unsorted
-
updated
Called when entities of the type referenced by the given foreign key are updated- Parameters:
foreignKey- the foreign keyentities- the updated entities, mapped to their original primary key
-