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 interface
Builds aEntityComboBoxModel
.static interface
Controls the filters for aEntityComboBoxModel
static interface
Controls a foreign key filter for aEntityComboBoxModel
Nested 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.FilterModel
FilterModel.AbstractRefresher<T>, FilterModel.FilteredItems<T>, FilterModel.Items<T>, FilterModel.Refresher<T>, FilterModel.Sorter<T>, FilterModel.VisibleItems<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue
<Boolean> Specifies whether entity combo box models handle entity edit events, by replacing updated entities and removing deleted ones Value type: Boolean Default value: trueFields inherited from interface is.codion.swing.common.model.component.combobox.FilterComboBoxModel
NULL_CAPTION
Fields inherited from interface is.codion.common.model.FilterModel
ASYNC_REFRESH
-
Method Summary
Modifier and TypeMethodDescriptionstatic EntityComboBoxModel.Builder
builder
(EntityType entityType, EntityConnectionProvider connectionProvider) 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 aValue
linked to the selected entity via the value of the given attribute.filter()
find
(Entity.Key primaryKey) void
select
(Entity.Key primaryKey) Selects the entity with the given primary key, whether filtered or visible.Methods inherited from interface javax.swing.ComboBoxModel
setSelectedItem
Methods inherited from interface is.codion.swing.common.model.component.combobox.FilterComboBoxModel
createSelectorValue, getSelectedItem, items
Methods inherited from interface is.codion.common.model.FilterModel
selection, sorter
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
-
Field Details
-
HANDLE_EDIT_EVENTS
Specifies whether entity combo box models handle entity edit events, by replacing updated entities 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 filtered or visible. 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.Filter
instance
-
createSelectorValue
Creates aValue
linked to the selected entity via the value of the given attribute.- Type Parameters:
T
- the attribute type- Parameters:
attribute
- the attribute- Returns:
- a
Value
for selecting items by attribute value
-
builder
static EntityComboBoxModel.Builder builder(EntityType entityType, EntityConnectionProvider connectionProvider) - Parameters:
entityType
- the type of the entity this combo box model should representconnectionProvider
- a EntityConnectionProvider instance- Returns:
- a new
EntityComboBoxModel.Builder
instance
-