Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityEditor.ComponentModels
- All Known Subinterfaces:
SwingEntityEditor.SwingComponentModels
- Enclosing interface:
EntityEditor<R extends EntityEditor<R>>
public static interface EntityEditor.ComponentModels
Provides models for editor components requiring database access.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> FilterComboBoxModel<T> comboBoxModel(Column<T> column, EntityConnectionProvider connectionProvider) Creates a combo box model containing the current values of the given column.default EntityComboBoxModelcomboBoxModel(ForeignKey foreignKey, EntityConnectionProvider connectionProvider) Creates a newEntityComboBoxModelfor the given foreign key, override to provide a customEntityComboBoxModelimplementation.static <T> @Nullable TcreateNullItem(Column<T> column) Creates a null item for a combo box based on the given column, for use as theFilterComboBoxModelnull item.default EntitySearchModelsearchModel(ForeignKey foreignKey, EntityConnectionProvider connectionProvider) Creates aEntitySearchModelfor looking up entities of the type referenced by the given foreign key, using the search attributes defined for that entity type.
-
Method Details
-
searchModel
default EntitySearchModel searchModel(ForeignKey foreignKey, EntityConnectionProvider connectionProvider) Creates a
EntitySearchModelfor looking up entities of the type referenced by the given foreign key, using the search attributes defined for that entity type.- Parameters:
foreignKey- the foreign key for which to create aEntitySearchModelconnectionProvider- the connection provider- Returns:
- a new
EntitySearchModelfor looking up entities of the type referenced by the given foreign key attribute, - Throws:
IllegalStateException- in case no searchable attributes can be found for the entity type referenced by the given foreign key- See Also:
-
comboBoxModel
default EntityComboBoxModel comboBoxModel(ForeignKey foreignKey, EntityConnectionProvider connectionProvider) 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 aEntityComboBoxModelconnectionProvider- the connection provider- Returns:
- a
EntityComboBoxModelfor the given foreign key - See Also:
-
comboBoxModel
default <T> FilterComboBoxModel<T> comboBoxModel(Column<T> column, EntityConnectionProvider connectionProvider) 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 columnconnectionProvider- the connection provider- Returns:
- a combo box model based on the given column
- See Also:
-
createNullItem
Creates a null item for a combo box based on the given column, for use as theFilterComboBoxModelnull item. For interface-typed columns this is a proxy whosetoString()returnsFilterComboBoxModel.NULL_CAPTION; for other types null is returned, since no toString() override is required.- Type Parameters:
T- the value type- Parameters:
column- the column- Returns:
- a null item for the given column, or null if the column value type is not an interface
- See Also:
-