Interface EntityComboBoxModel
- All Superinterfaces:
ComboBoxModel<Entity>,FilterComboBoxModel<Entity>,FilterModel<Entity>,ListModel<Entity>
A ComboBoxModel based on an Entity, showing by default all the entities in the underlying table.
To filter a EntityComboBoxModel use filter() to set a Predicate or configure ForeignKey based filtering.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilds aEntityComboBoxModel.static interfaceControls the filters for aEntityComboBoxModelstatic interfaceControls a foreign key filter for aEntityComboBoxModelNested classes/interfaces inherited from interface is.codion.swing.common.model.component.combobox.FilterComboBoxModel
FilterComboBoxModel.ComboBoxItems<T>, FilterComboBoxModel.ItemComboBoxModelBuilder<T>, FilterComboBoxModel.ItemFinder<T,V> Nested classes/interfaces inherited from interface is.codion.common.model.filter.FilterModel
FilterModel.AbstractRefresher<T>, FilterModel.FilteredItems<T>, FilterModel.IncludedItems<T>, FilterModel.IncludedPredicate<T>, FilterModel.Items<T>, FilterModel.Refresher<T>, FilterModel.Sort<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<Boolean> Specifies whether entity combo box models handle entity edit events, by adding new entities, replacing updated and removing deleted ones Value type: Boolean Default value: trueFields inherited from interface is.codion.swing.common.model.component.combobox.FilterComboBoxModel
NULL_CAPTIONFields inherited from interface is.codion.common.model.filter.FilterModel
ASYNC -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Controls the condition supplier used when querying data, setting this to null reverts to the condition specifying all underlying entities.<T> Value<T> createSelectorValue(Attribute<T> attribute) Creates aValuelinked to the selected entity via the value of the given attribute.filter()find(Entity.Key primaryKey) voidselect(Entity.Key primaryKey) Selects the entity with the given primary key, whether included or filtered.Methods inherited from interface javax.swing.ComboBoxModel
setSelectedItemMethods inherited from interface is.codion.swing.common.model.component.combobox.FilterComboBoxModel
createSelector, getSelectedItem, itemsMethods inherited from interface is.codion.common.model.filter.FilterModel
selection, sortMethods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
-
Field Details
-
EDIT_EVENTS
Specifies whether entity combo box models handle entity edit events, by adding new entities, replacing updated and removing deleted ones- Value type: Boolean
- Default value: true
- See Also:
-
-
Method Details
-
connectionProvider
EntityConnectionProvider connectionProvider()- Returns:
- the connection provider used by this combo box model
-
entityDefinition
EntityDefinition entityDefinition()- Returns:
- the underlying
EntityDefinition
-
find
- Parameters:
primaryKey- the primary key of the entity to fetch from this model- Returns:
- the entity with the given key if found in the model, an empty Optional otherwise
-
select
Selects the entity with the given primary key, whether included or filtered. If the entity is not available in the model this method returns silently without changing the selection.- Parameters:
primaryKey- the primary key of the entity to select
-
condition
Controls the condition supplier used when querying data, setting this to null reverts to the condition specifying all underlying entities.
The condition supplier may not return null, doing so will cause an exception when refreshing the model items.
- Returns:
- a value controlling the condition supplier
-
filter
EntityComboBoxModel.Filter filter()- Returns:
- the
EntityComboBoxModel.Filterinstance
-
createSelectorValue
Creates aValuelinked to the selected entity via the value of the given attribute.- Type Parameters:
T- the attribute type- Parameters:
attribute- the attribute- Returns:
- a
Valuefor selecting items by attribute value
-
builder
- Returns:
- a
EntityComboBoxModel.Builder.EntityTypeStepinstance
-