Module is.codion.framework.model
Package is.codion.framework.model
Class AbstractEntityComboBoxModelBuilder<B extends EntityComboBoxModel.Builder<B>>
java.lang.Object
is.codion.framework.model.AbstractEntityComboBoxModelBuilder<B>
- Type Parameters:
B- the builder type
- All Implemented Interfaces:
EntityComboBoxModel.Builder<B>
public abstract class AbstractEntityComboBoxModelBuilder<B extends EntityComboBoxModel.Builder<B>>
extends Object
implements EntityComboBoxModel.Builder<B>
A base class for
EntityComboBoxModel.Builder implementations. A toolkit builder extends this class,
adding its own options and overriding build() to wrap the EntityComboBoxModel in its own model.-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EntityComboBoxModel.Builder
EntityComboBoxModel.Builder.ConnectionStep, EntityComboBoxModel.Builder.EntityTypeStep -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractEntityComboBoxModelBuilder(ForeignKey foreignKey, EntityConnection connection) Configures the builder according to the given foreign key, including null if it is nullable and specifying the attributes to include if defined.protectedAbstractEntityComboBoxModelBuilder(EntityType entityType, EntityConnection connection) -
Method Summary
Modifier and TypeMethodDescriptionfinal Battributes(Collection<Attribute<?>> attributes) Specifies the attributes to include when selecting the entities to populate this model with.build()final Bcomparator(@Nullable Comparator<Entity> comparator) Note that this comparator is not used ifEntityComboBoxModel.Builder.orderBy(OrderBy)has been specified.final BIfconditionis null, the default condition, specifying all underlying entities is used.final Bfilter(ForeignKey foreignKey, EntityComboBoxModel filterModel) 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.final BfilterSelected(boolean filterSelected) Specifies whether filtering the model affects the currently selected item.final BincludeNull(boolean includeNull) final BnullCaption(@Nullable String nullCaption) Enables the null item and sets the null item caption.final BonSelectedItem(Consumer<@Nullable Entity> item) final BSpecifies theOrderByto use when selecting entities for this model.final BpersistenceAware(boolean persistenceAware) final Brefresh(boolean refresh) final Bprotected final Bself()
-
Constructor Details
-
AbstractEntityComboBoxModelBuilder
- Parameters:
entityType- the type of the entity the combo box model should representconnection- the connection
-
AbstractEntityComboBoxModelBuilder
Configures the builder according to the given foreign key, including null if it is nullable and specifying the attributes to include if defined.- Parameters:
foreignKey- the foreign key which referenced entity type the combo box model should representconnection- the connection- See Also:
-
-
Method Details
-
orderBy
Description copied from interface:EntityComboBoxModel.BuilderSpecifies theOrderByto use when selecting entities for this model.Note that when
orderByis specified the model is left unsorted and the database order is used. That order is retained across refreshes, but only survives until the first foreign key filter transition, after which re-included items are appended (in an unsorted model) rather than restored to their original position.- Specified by:
orderByin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
orderBy- theOrderByto use when selecting- Returns:
- this builder instance
-
comparator
Description copied from interface:EntityComboBoxModel.BuilderNote that this comparator is not used ifEntityComboBoxModel.Builder.orderBy(OrderBy)has been specified.- Specified by:
comparatorin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
comparator- the comparator to use, null for unsorted- Returns:
- this builder instance
-
condition
Description copied from interface:EntityComboBoxModel.BuilderIf
conditionis null, the default condition, specifying all underlying entities is used.The condition supplier may not return null, doing so will cause an exception when refreshing the model items.
- Specified by:
conditionin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
condition- the condition supplier to use when querying data, may not return null- Returns:
- this builder instance
-
attributes
Description copied from interface:EntityComboBoxModel.BuilderSpecifies 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.- Specified by:
attributesin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
attributes- the attributes to select, an empty Collection for all- Returns:
- this builder instance
-
includeNull
- Specified by:
includeNullin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
includeNull- if true then the null item is enabled using the default null item caption (FilterComboBoxModel.NULL_CAPTION)- Returns:
- this builder instance
- See Also:
-
nullCaption
Description copied from interface:EntityComboBoxModel.BuilderEnables the null item and sets the null item caption.- Specified by:
nullCaptionin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
nullCaption- the null item caption- Returns:
- this builder instance
-
select
- Specified by:
selectin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
entity- the entity to select initially- Returns:
- this builder
-
persistenceAware
- Specified by:
persistenceAwarein interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
persistenceAware- controls whether this combo box model should respond to entity persistence events, by adding inserted items, updating any updated items and removing deleted ones- Returns:
- this builder instance
- See Also:
-
filterSelected
Description copied from interface:EntityComboBoxModel.BuilderSpecifies whether filtering the model affects the currently selected item. If true, the selection is cleared when the selected item is filtered from the model, otherwise the selected item can potentially represent a value which is not currently included in the model This is false by default.- Specified by:
filterSelectedin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
filterSelected- if true then the selected item is cleared when filtered- Returns:
- this builder instance
- See Also:
-
filter
Description copied from interface:EntityComboBoxModel.BuilderLinks 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 thatfilterModelis automatically refreshed each time this combo box model is refreshed.- Specified by:
filterin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
foreignKey- the foreign keyfilterModel- the combo box model filtering this model- Returns:
- this builder instance
- See Also:
-
onSelectedItem
- Specified by:
onSelectedItemin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
item- receives the selected item, note that this item may be null- Returns:
- this builder instance
-
refresh
- Specified by:
refreshin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Parameters:
refresh- true if the model items should be refreshed on initialization, false by default- Returns:
- this builder instance
-
build
- Specified by:
buildin interfaceEntityComboBoxModel.Builder<B extends EntityComboBoxModel.Builder<B>>- Returns:
- a new
EntityComboBoxModelinstance
-
self
- Returns:
- this builder instance
-