Module is.codion.framework.model
Package is.codion.framework.model
Class AbstractEntityTableModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<M,E,T,R>,T extends EntityTableModel<M,E,T,R>,R extends EntityEditor<M,E,T,R>>
java.lang.Object
is.codion.framework.model.AbstractEntityTableModel<M,E,T,R>
- Type Parameters:
M- theEntityModeltypeE- theEntityEditModeltypeT- theEntityTableModeltypeR- theEntityEditortype
- All Implemented Interfaces:
FilterModel<Entity>,EntityTableModel<M,E, T, R>
- Direct Known Subclasses:
SwingEntityTableModel
public abstract class AbstractEntityTableModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<M,E,T,R>,T extends EntityTableModel<M,E,T,R>,R extends EntityEditor<M,E,T,R>>
extends Object
implements EntityTableModel<M,E,T,R>
An abstract
EntityTableModel implementation-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAn abstractEntityTableModel.EntityTableEditorimplementation.Nested classes/interfaces inherited from interface is.codion.framework.model.EntityTableModel
EntityTableModel.EntityTableEditor, EntityTableModel.OnInsert, EntityTableModel.RefreshTaskNested classes/interfaces inherited from interface is.codion.common.model.filter.FilterModel
FilterModel.AbstractRefresher<T>, FilterModel.FilteredItems<T>, FilterModel.IncludedItems<T>, FilterModel.IncludePredicate<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, EntityQueryModel queryModel, FilterModel<Entity> filterModel) -
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 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 EntityQueryModelquery()refreshTask(Collection<Entity.Key> keys) 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
editor, refresh, selectionMethods inherited from interface is.codion.common.model.filter.FilterModel
items, sort
-
Constructor Details
-
AbstractEntityTableModel
- Parameters:
editModel- the edit modelfilterModel- the filter model
-
AbstractEntityTableModel
protected AbstractEntityTableModel(E editModel, EntityQueryModel queryModel, FilterModel<Entity> filterModel) - Parameters:
editModel- the edit modelqueryModel- the table query modelfilterModel- the filter model- Throws:
IllegalArgumentException- in case the edit and query model entity types do not match
-
-
Method Details
-
entities
-
entityDefinition
- Specified by:
entityDefinitionin interfaceEntityTableModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the definition of the underlying entity
-
toString
-
onInsert
- Specified by:
onInsertin interfaceEntityTableModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the
Valuecontrolling the action to perform when entities are inserted via the associated edit model - See Also:
-
removeDeleted
- Specified by:
removeDeletedin interfaceEntityTableModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the type of the entity this table model is based on
-
editModel
Description copied from interface:EntityTableModelReturns theEntityEditModelassociated with this table model -
connectionProvider
- Specified by:
connectionProviderin interfaceEntityTableModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the
Statecontrolling whether the current sort order should be used as a basis for the query order by clause
-
query
-
replace
Description copied from interface:EntityTableModelReplaces the given entities in this table model -
select
Description copied from interface:EntityTableModelSelects entities according to the primary keys inprimaryKeys -
deleteSelected
Description copied from interface:EntityTableModelDeletes the selected entities- Specified by:
deleteSelectedin interfaceEntityTableModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the deleted entities
-
refreshTask
- Specified by:
refreshTaskin interfaceEntityTableModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Parameters:
keys- the keys of the entities to refresh- Returns:
- a task for refreshing the given 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
-