Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityEditModel<R extends EntityEditor<R>>
- Type Parameters:
R- theEntityEditortype
- All Known Implementing Classes:
AbstractEntityEditModel,SwingEntityEditModel
public interface EntityEditModel<R extends EntityEditor<R>>
Represents the context for editing an
Entity instance.
The underlying attribute values are available via EntityEditor.value(Attribute).- See Also:
-
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().editor()Returns aEntityEditorwrapping the entity being edited.entities()default voidrestore(Preferences preferences) Restores any custom persistent state from the given preferences node.default voidstore(Preferences preferences) Stores any custom persistent state to the given preferences node.
-
Method Details
-
entityType
EntityType entityType()- Returns:
- the type of the entity this edit 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 edit model
-
editor
R editor()Returns aEntityEditorwrapping the entity being edited.EntityEditor.EditorEntity.get()returns an immutable copy of theEntityinstance being edited, whileEntityEditor.EditorEntity.set(Entity)copies the values from the givenEntityinto the underlyingEntity. Note that value changes must go through theEntityEditor.EditorValueaccessible viaEntityEditor.value(Attribute).- Returns:
- the
EntityEditorwrapping theEntityinstance being edited - See Also:
-
entities
Entities entities()- Returns:
- the underlying domain entities
-
entityDefinition
EntityDefinition entityDefinition()- Returns:
- the definition of the underlying entity
-
store
Stores any custom persistent state to the given preferences node. Does nothing by default, override to persist edit model state along with the rest of the model tree.The given node is reserved for the edit model, nothing else is stored in it.
- Parameters:
preferences- the preferences node to store to- See Also:
-
restore
Restores any custom persistent state from the given preferences node. Does nothing by default, override to restore edit model state along with the rest of the model tree.- Parameters:
preferences- the preferences node to restore from- See Also:
-