Interface SwingEntityComboBoxModel.Builder
- Enclosing interface:
SwingEntityComboBoxModel
public static interface SwingEntityComboBoxModel.Builder
Builds a
SwingEntityComboBoxModel — the same options as EntityComboBoxModel.Builder, but the
chain stays Swing-typed so build() yields a ComboBoxModel.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides aSwingEntityComboBoxModel.Builderstatic interfaceSpecifies the entity type, either directly or derived from aForeignKey. -
Method Summary
Modifier and TypeMethodDescriptionattributes(Collection<Attribute<?>> attributes) Specifies the attributes to include when selecting the entities to populate this model with.build()comparator(@Nullable Comparator<Entity> comparator) Note that this comparator is not used iforderBy(OrderBy)has been specified.Ifconditionis null, the default condition, specifying all underlying entities is used.filter(ForeignKey foreignKey, SwingEntityComboBoxModel 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.filterSelected(boolean filterSelected) Specifies whether filtering the model affects the currently selected item.includeNull(boolean includeNull) nullCaption(@Nullable String nullCaption) Enables the null item and sets the null item caption.onItemSelected(Consumer<@Nullable Entity> item) Specifies theOrderByto use when selecting entities for this model.persistenceAware(boolean persistenceAware) refresh(boolean refresh) Default false.
-
Method Details
-
orderBy
Specifies theOrderByto use when selecting entities for this model.- Parameters:
orderBy- theOrderByto use when selecting- Returns:
- this builder instance
-
comparator
Note that this comparator is not used iforderBy(OrderBy)has been specified.- Parameters:
comparator- the comparator to use, null for unsorted- Returns:
- this builder instance
-
condition
If
conditionis null, the default condition, specifying all underlying entities is used.- Parameters:
condition- the condition supplier to use when querying data, may not return null- Returns:
- this builder instance
-
attributes
Specifies the attributes to include when selecting the entities to populate this model with.- Parameters:
attributes- the attributes to select, an empty Collection for all- Returns:
- this builder instance
-
includeNull
- Parameters:
includeNull- if true then the null item is enabled using the default null item caption- Returns:
- this builder instance
-
nullCaption
Enables the null item and sets the null item caption.- Parameters:
nullCaption- the null item caption- Returns:
- this builder instance
-
select
- Parameters:
entity- the entity to select initially- Returns:
- this builder
-
persistenceAware
- Parameters:
persistenceAware- controls whether this combo box model should respond to entity persistence events- Returns:
- this builder instance
- See Also:
-
filterSelected
Specifies whether filtering the model affects the currently selected item.- Parameters:
filterSelected- if true then the selected item is cleared when filtered- Returns:
- this builder instance
-
filter
SwingEntityComboBoxModel.Builder filter(ForeignKey foreignKey, SwingEntityComboBoxModel 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.- Parameters:
foreignKey- the foreign keyfilterModel- the combo box model filtering this model- See Also:
-
onItemSelected
- Parameters:
item- receives the selected item, note that this item may be null- Returns:
- this builder instance
-
refresh
Default false.- Parameters:
refresh- true if the model items should be refreshed on initialization- Returns:
- this builder instance
-
build
SwingEntityComboBoxModel build()- Returns:
- a new
SwingEntityComboBoxModelinstance
-