Interface EntityComboBoxModel

    • Method Detail

      • entityType

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

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

        Optional<Entity> 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
      • getForeignKeyFilterKeys

        Collection<Key> getForeignKeyFilterKeys​(ForeignKey foreignKey)
        Parameters:
        foreignKey - the foreign key
        Returns:
        the keys currently used to filter the contents of this model by foreign key, an empty collection for none
      • setForeignKeyFilterKeys

        void setForeignKeyFilterKeys​(ForeignKey foreignKey,
                                     Collection<Key> keys)
        Filters this combo box model so that only items referencing the given keys via the given foreign key are shown.
        Parameters:
        foreignKey - the foreign key
        keys - the keys, null or empty for none
      • setStrictForeignKeyFiltering

        void setStrictForeignKeyFiltering​(boolean strictForeignKeyFiltering)
        Specifies 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.
        Parameters:
        strictForeignKeyFiltering - the value
        See Also:
        setForeignKeyFilterKeys(ForeignKey, Collection)
      • isStrictForeignKeyFiltering

        boolean isStrictForeignKeyFiltering()
        Returns:
        true if strict foreign key filtering is enabled
      • createForeignKeyConditionComboBoxModel

        EntityComboBoxModel createForeignKeyConditionComboBoxModel​(ForeignKey foreignKey)
        Returns a combo box model for selecting a foreign key value for using as a condition this model. Note that each time the selection changes in the created model this model is refreshed.
        Parameters:
        foreignKey - the foreign key
        Returns:
        a combo box model for selecting a filtering value for this combo box model
        See Also:
        linkForeignKeyConditionComboBoxModel(ForeignKey, EntityComboBoxModel)
      • linkForeignKeyFilterComboBoxModel

        void linkForeignKeyFilterComboBoxModel​(ForeignKey foreignKey,
                                               EntityComboBoxModel foreignKeyModel)
        Links the given combo box model representing master entities to this combo box model so that selection in the master model filters this model according to the selected master entity
        Parameters:
        foreignKey - the foreign key attribute
        foreignKeyModel - the combo box model to link
      • linkForeignKeyConditionComboBoxModel

        void linkForeignKeyConditionComboBoxModel​(ForeignKey foreignKey,
                                                  EntityComboBoxModel foreignKeyModel)
        Links the given combo box model representing master entities to this combo box model so that selection in the master model refreshes this model with the selected master entity as condition
        Parameters:
        foreignKey - the foreign key attribute
        foreignKeyModel - the combo box model to link
      • selectByKey

        void selectByKey​(Key primaryKey)
        Selects the entity with the given primary key, 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
      • forceRefresh

        void forceRefresh()
        Forces a refresh of this model, disregarding the staticData directive
        See Also:
        setStaticData(boolean)
      • setStaticData

        void setStaticData​(boolean staticData)
        Specifies whether this models data should be considered static, that is, only fetched once. Note that forceRefresh() disregards this directive.
        Parameters:
        staticData - the value
      • setSelectAttributes

        void setSelectAttributes​(Collection<Attribute<?>> selectAttributes)
        Specifies the attributes to include when selecting the entities to populate this model with. Note that the primary key attribute values are always included. An empty Collection indicates that all attributes should be selected.
        Parameters:
        selectAttributes - the attributes to select
        Throws:
        IllegalArgumentException - in case any of the given attributes is not part of the underlying entity type
      • isStaticData

        boolean isStaticData()
        Returns:
        true if the data for this model should only be fetched once
        See Also:
        forceRefresh()
      • setListenToEditEvents

        void setListenToEditEvents​(boolean listenToEditEvents)
        Set to true if this combo box model should respond to entity edit events, by adding inserted items, updating any updated items and removing deleted ones.
        Parameters:
        listenToEditEvents - if true then this model listens to entity edit events
        See Also:
        EntityEditEvents
      • isListenToEditEvents

        boolean isListenToEditEvents()
        True if this combo box model responds to entity edit events, by adding inserted items, updating any updated items and removing deleted ones.
        Returns:
        true if this combo box model listens edit events
        See Also:
        EntityEditEvents
      • setSelectConditionSupplier

        void setSelectConditionSupplier​(Supplier<Condition> selectConditionSupplier)
        Sets the condition provider to use when querying data
        Parameters:
        selectConditionSupplier - the condition supplier
      • getSelectConditionSupplier

        Supplier<Condition> getSelectConditionSupplier()
        Returns:
        the select condition supplier, null if none is specified
      • createSelectorValue

        <V> Value<V> createSelectorValue​(Attribute<V> attribute)
        Creates a Value linked to the selected entity via the value of the given attribute.
        Type Parameters:
        V - the attribute type
        Parameters:
        attribute - the attribute
        Returns:
        a Value for selecting items by attribute value