Interface EntityComboBoxModel.ForeignKeyFilter

Enclosing interface:
EntityComboBoxModel

public static interface EntityComboBoxModel.ForeignKeyFilter
Controls the foreign key filter for a EntityComboBoxModel
  • Method Details

    • set

      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. Note that this uses the FilterModel.VisibleItems.predicate() and replaces any previously set prediate.
      Parameters:
      foreignKey - the foreign key
      keys - the keys, an empty Collection to clear the filter
      See Also:
    • get

      Collection<Entity.Key> get(ForeignKey foreignKey)
      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

      Predicate<Entity> predicate()
      Use this method to retrieve the default foreign key filter visible predicate if you want to add a custom Predicate to this model via FilterModel.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 a EntityComboBoxModel.Builder for a EntityComboBoxModel filtering this model using the given ForeignKey
      Parameters:
      foreignKey - the foreign key to filter by
      Returns:
      a EntityComboBoxModel.Builder for a foreign key filter model
    • link

      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. Note that the foreign key model is refreshed each time this combo box model is refreshed.
      Parameters:
      foreignKey - the foreign key
      foreignKeyModel - the combo box model containing the foreign key values