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, EntityConnection connection) Creates a combo box model containing the current values of the given column.default EntityComboBoxModelcomboBoxModel(ForeignKey foreignKey, EntityConnection connection) 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, EntityConnection connection) 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
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 aEntitySearchModelconnection- the connection- 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
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 aEntityComboBoxModelconnection- the connection- Returns:
- a
EntityComboBoxModelfor the given foreign key - See Also:
-
comboBoxModel
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 columnconnection- the connection- 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:
-