Interface EntityComboBoxModel

All Superinterfaces:
ComboBoxModel<Entity>, FilterComboBoxModel<Entity>, FilterModel<Entity>, ListModel<Entity>

public interface EntityComboBoxModel extends FilterComboBoxModel<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:
  • Field Details

  • Method Details

    • connectionProvider

      EntityConnectionProvider connectionProvider()
      Returns:
      the connection provider used by this combo box model
    • entityType

      EntityType entityType()
      Returns:
      the type of the entity this combo box model is based on
    • find

      Optional<Entity> find(Entity.Key primaryKey)
      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

      void select(Entity.Key primaryKey)
      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

      Value<Supplier<Condition>> condition()
      Controls the condition supplier to use when querying data, setting this to null reverts back to the original condition, set via EntityComboBoxModel.Builder.condition(Supplier) or the default one, fetching all underlying entities, if none was specified.
      Returns:
      a value controlling the condition supplier
    • filter

      Returns:
      the EntityComboBoxModel.Filter instance
    • createSelectorValue

      <T> Value<T> createSelectorValue(Attribute<T> attribute)
      Creates a Value 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 represent
      connectionProvider - a EntityConnectionProvider instance
      Returns:
      a new EntityComboBoxModel.Builder instance