Module is.codion.framework.model
Package is.codion.framework.model
Interface ModelLink<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
- Type Parameters:
M
- theEntityModel
typeE
- theEntityEditModel
typeT
- theEntityTableModel
type
- All Known Subinterfaces:
ForeignKeyModelLink<M,
E, T>
public interface ModelLink<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
Represents a link between two entity models.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
ModelLink.Builder<M extends EntityModel<M,
E, T>, E extends EntityEditModel, T extends EntityTableModel<E>, B extends ModelLink.Builder<M, E, T, B>> Builds aModelLink
-
Method Summary
Modifier and TypeMethodDescriptionactive()
Controls the active status of this link.static <M extends EntityModel<M,
E, T>, E extends EntityEditModel, T extends EntityTableModel<E>, B extends ModelLink.Builder<M, E, T, B>>
ModelLink.Builder<M, E, T, B> builder
(M model) Returns a newModelLink.Builder
instance.model()
void
onDelete
(Collection<Entity> deletedEntities) Called when delete is performed in the parent model, regardless of entity type.void
onInsert
(Collection<Entity> insertedEntities) Called when a insert is performed in the parent model, regardless of entity type.void
onSelection
(Collection<Entity> selectedEntities) Called when the selection changes in the parent model or when this link is activated.void
Called when an update is performed in the parent model, regardless of entity type.
-
Method Details
-
model
M model()- Returns:
- the linked model
-
active
State active()Controls the active status of this link.
Active model links respond to the parent model selection via
onSelection(Collection)
.- Returns:
- the
State
controlling the active status of this model link - See Also:
-
onSelection
Called when the selection changes in the parent model or when this link is activated.
Note that only active links are required to handle parent model selection.
- Parameters:
selectedEntities
- the selected entities- See Also:
-
onInsert
Called when a insert is performed in the parent model, regardless of entity type.- Parameters:
insertedEntities
- the inserted entities
-
onUpdate
Called when an update is performed in the parent model, regardless of entity type.- Parameters:
updatedEntities
- the updated entities, mapped to their state before the update
-
onDelete
Called when delete is performed in the parent model, regardless of entity type.- Parameters:
deletedEntities
- the deleted entities
-
builder
static <M extends EntityModel<M,E, ModelLink.Builder<M,T>, E extends EntityEditModel, T extends EntityTableModel<E>, B extends ModelLink.Builder<M, E, T, B>> E, builderT, B> (M model) Returns a new
ModelLink.Builder
instance.Note that if the linked model contains a table model it is configured so that a query condition is required for it to show any data, via
EntityQueryModel.conditionRequired()
- Type Parameters:
M
- theEntityModel
typeE
- theEntityEditModel
typeT
- theEntityTableModel
typeB
- the builder type- Parameters:
model
- the model to link- Returns:
- a
ModelLink.Builder
instance
-