Class SwingEntityEditModel
- All Implemented Interfaces:
EntityEditModel
EntityEditModel.-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EntityEditModel
EntityEditModel.EditEvents, EntityEditModel.EditorValue<T>, EntityEditModel.EditTask, EntityEditModel.EntityEditor, EntityEditModel.Settings -
Field Summary
Fields inherited from interface is.codion.framework.model.EntityEditModel
EDIT_EVENTS -
Constructor Summary
ConstructorsConstructorDescriptionSwingEntityEditModel(EntityType entityType, EntityConnectionProvider connectionProvider) Instantiates a newSwingEntityEditModelbased on the given entity type. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidClears all combobox modelsfinal <T> FilterComboBoxModel<T> comboBoxModel(Column<T> column) Returns theFilterComboBoxModelassociated with the given column.final EntityComboBoxModelcomboBoxModel(ForeignKey foreignKey) Returns theEntityComboBoxModelassociated with the given foreign key.protected <T> voidconfigure(Column<T> column, FilterComboBoxModel<T> comboBoxModel) Called when aFilterComboBoxModelis created bycomboBoxModel(Column)protected voidconfigure(ForeignKey foreignKey, EntityComboBoxModel comboBoxModel) Called when aEntityComboBoxModelis created bycomboBoxModel(ForeignKey).<T> FilterComboBoxModel<T> createComboBoxModel(Column<T> column) Creates a combo box model containing the current values of the given column.createComboBoxModel(ForeignKey foreignKey) Creates a newEntityComboBoxModelfor the given foreign key, override to provide a customEntityComboBoxModelimplementation.final voidinitializeComboBoxModels(Attribute<?>... attributes) Creates and refreshes combo box models for the given attributes.final voidRefreshes all combobox modelsfinal voidRefreshes all foreign key combobox modelsMethods inherited from class is.codion.framework.model.AbstractEntityEditModel
afterDelete, afterInsert, afterInsertUpdateOrDelete, afterUpdate, applyEdit, beforeDelete, beforeInsert, beforeUpdate, configure, connection, connectionProvider, createSearchModel, delete, delete, delete, deleted, deleteTask, deleteTask, editor, entities, entityDefinition, entityType, insert, insert, insert, inserted, insertTask, insertTask, notifyAfterDelete, notifyAfterInsert, notifyAfterUpdate, notifyBeforeDelete, notifyBeforeInsert, notifyBeforeUpdate, refresh, searchModel, settings, toString, update, update, update, updated, updateTask, updateTask
-
Constructor Details
-
SwingEntityEditModel
Instantiates a newSwingEntityEditModelbased on the given entity type.- Parameters:
entityType- the type of the entity to base thisSwingEntityEditModelonconnectionProvider- theEntityConnectionProviderinstance
-
-
Method Details
-
initializeComboBoxModels
Creates and refreshes combo box models for the given attributes. Doing this in the model constructor avoids the models being refreshed when the combo boxes using them are initialized, which usually happens on the Event Dispatch Thread.- Parameters:
attributes- the attributes for which to initialize combo box models- See Also:
-
refreshForeignKeyComboBoxModels
public final void refreshForeignKeyComboBoxModels()Refreshes all foreign key combobox models -
refreshComboBoxModels
public final void refreshComboBoxModels()Refreshes all combobox models -
clearComboBoxModels
public final void clearComboBoxModels()Clears all combobox models -
comboBoxModel
Returns the
EntityComboBoxModelassociated with the given foreign key. If no such combo box model exists, one is created by callingcreateComboBoxModel(ForeignKey).This method always returns the same
EntityComboBoxModelinstance, once one has been created.- Parameters:
foreignKey- the foreign key- Returns:
- the
EntityComboBoxModelassociated with the given foreign key - See Also:
-
comboBoxModel
Returns the
FilterComboBoxModelassociated with the given column. If no such combo box model exists, one is created by callingcreateComboBoxModel(Column).This method always returns the same
FilterComboBoxModelinstance, once one has been created.- Type Parameters:
T- the value type- Parameters:
column- the column- Returns:
- the
FilterComboBoxModelassociated with the given column - See Also:
-
createComboBoxModel
Creates a new
EntityComboBoxModelfor the given foreign key, override to provide a customEntityComboBoxModelimplementation.This default implementation returns a sorted
EntityComboBoxModelusing the default null item caption if the underlying attribute is nullable.If the foreign key has select attributes defined, those are set in the combo box model.
- Parameters:
foreignKey- the foreign key for which to create aEntityComboBoxModel- Returns:
- a
EntityComboBoxModelfor the given foreign key - See Also:
-
createComboBoxModel
Creates a combo box model containing the current values of the given column. This default implementation returns a sortedFilterComboBoxModelusing the default null item caption if the underlying column is nullable- Type Parameters:
T- the value type- Parameters:
column- the column- Returns:
- a combo box model based on the given column
- See Also:
-
configure
Called when a
EntityComboBoxModelis created bycomboBoxModel(ForeignKey).- Parameters:
foreignKey- the foreign keycomboBoxModel- the combo box model
-
configure
Called when aFilterComboBoxModelis created bycomboBoxModel(Column)- Type Parameters:
T- the column type- Parameters:
column- the columncomboBoxModel- the combo box model
-