Interface EntityComboBoxModel.ForeignKeyFilter
- Enclosing interface:
- EntityComboBoxModel
public static interface EntityComboBoxModel.ForeignKeyFilter
Controls the foreign key filter for a
EntityComboBoxModel
-
Method Summary
Modifier and TypeMethodDescriptionbuilder
(ForeignKey foreignKey) Returns aEntityComboBoxModel.Builder
for aEntityComboBoxModel
filtering this model using the givenForeignKey
get
(ForeignKey foreignKey) void
link
(ForeignKey foreignKey, EntityComboBoxModel foreignKeyModel) Links the given combo box model representing foreign key entities to this combo box model so that selection in the foreign key model filters this model.Use this method to retrieve the default foreign key filter visible predicate if you want to add a customPredicate
to this model viaFilterModel.VisibleItems.predicate()
.void
set
(ForeignKey foreignKey, Collection<Entity.Key> keys) Filters the combo box model so that only items referencing the given keys via the given foreign key are visible.strict()
Controls whether foreign key filtering should be strict or not.
-
Method Details
-
set
Filters the combo box model so that only items referencing the given keys via the given foreign key are visible. Note that this uses theFilterModel.VisibleItems.predicate()
and replaces any previously set prediate.- Parameters:
foreignKey
- the foreign keykeys
- the keys, an empty Collection to clear the filter- See Also:
-
get
- Parameters:
foreignKey
- the foreign key- Returns:
- the keys currently used to filter the items of this model by foreign key, an empty collection for none
- See Also:
-
strict
State strict()Controls whether foreign key filtering should be strict or not. When the filtering is strict only entities with the correct reference are included, that is, entities with null values for the given foreign key are filtered. Non-strict simply means that entities with null references are not filtered.- Returns:
- the
State
controlling whether foreign key filtering should be strict - See Also:
-
predicate
Use this method to retrieve the default foreign key filter visible predicate if you want to add a customPredicate
to this model viaFilterModel.VisibleItems.predicate()
.Predicate fkPredicate = model.foreignKeyFilter().predicate(); model.items().visible().predicate().set(item -> fkPredicate.test(item) && ...);
- Returns:
- the
Predicate
based on the foreign key filter entities - See Also:
-
builder
Returns aEntityComboBoxModel.Builder
for aEntityComboBoxModel
filtering this model using the givenForeignKey
- Parameters:
foreignKey
- the foreign key to filter by- Returns:
- a
EntityComboBoxModel.Builder
for a foreign key filter model
-
link
Links the given combo box model representing foreign key entities to this combo box model so that selection in the foreign key model filters this model. Note that the foreign key model is refreshed each time this combo box model is refreshed.- Parameters:
foreignKey
- the foreign keyforeignKeyModel
- the combo box model containing the foreign key values
-