Module is.codion.swing.common.model
Class ItemComboBoxModel<T>
java.lang.Object
is.codion.swing.common.model.component.combobox.FilteredComboBoxModel<Item<T>>
is.codion.swing.common.model.component.combobox.ItemComboBoxModel<T>
- Type Parameters:
T
- the type of value wrapped by this combo box models items
- All Implemented Interfaces:
FilteredModel<Item<T>>
,ComboBoxModel<Item<T>>
,ListModel<Item<T>>
A ComboBoxModel implementation based on the
Item
class.-
Nested Class Summary
Nested classes/interfaces inherited from class is.codion.swing.common.model.component.combobox.FilteredComboBoxModel
FilteredComboBoxModel.ItemFinder<T,
V> Nested classes/interfaces inherited from interface is.codion.common.model.FilteredModel
FilteredModel.AbstractRefresher<T>, FilteredModel.Refresher<T>
-
Field Summary
Fields inherited from class is.codion.swing.common.model.component.combobox.FilteredComboBoxModel
COMBO_BOX_NULL_CAPTION
Fields inherited from interface is.codion.common.model.FilteredModel
ASYNC_REFRESH
-
Method Summary
Modifier and TypeMethodDescriptionstatic ItemComboBoxModel<Boolean>
Constructs a new Boolean based ItemComboBoxModel with null as the initially selected value.static ItemComboBoxModel<Boolean>
booleanItemComboBoxModel
(String nullCaption) Constructs a new Boolean based ItemComboBoxModel with null as the initially selected value.static ItemComboBoxModel<Boolean>
booleanItemComboBoxModel
(String nullCaption, String trueCaption, String falseCaption) Constructs a new Boolean based ItemComboBoxModel with null as the initially selected value.int
Returns the index of the Item representing the given value, -1 if this model does not contain such an Item.static <T> ItemComboBoxModel<T>
static <T> ItemComboBoxModel<T>
itemComboBoxModel
(List<Item<T>> items) static <T> ItemComboBoxModel<T>
static <T> ItemComboBoxModel<T>
sortedItemComboBoxModel
(Comparator<Item<T>> comparator) static <T> ItemComboBoxModel<T>
sortedItemComboBoxModel
(List<Item<T>> items) static <T> ItemComboBoxModel<T>
sortedItemComboBoxModel
(List<Item<T>> items, Comparator<Item<T>> comparator) Methods inherited from class is.codion.swing.common.model.component.combobox.FilteredComboBoxModel
add, addListDataListener, clear, cleared, comparator, containsItem, createSelectorValue, filtered, filteredCount, filteredItems, filterItems, filterSelectedItem, getElementAt, getSelectedItem, getSize, includeCondition, includeNull, items, itemValidator, nullItem, nullSelected, refresh, refresher, refreshThen, remove, removeListDataListener, replace, selectedItemTranslator, selectedValue, selectionEmpty, selectionEvent, setItems, setSelectedItem, validSelectionPredicate, visible, visibleCount, visibleItems
-
Method Details
-
indexOf
Returns the index of the Item representing the given value, -1 if this model does not contain such an Item.- Parameters:
value
- the value- Returns:
- the index of the Item representing the given value, -1 if not found
-
itemComboBoxModel
- Type Parameters:
T
- the Item value type- Returns:
- a new combo box model
-
itemComboBoxModel
- Type Parameters:
T
- the Item value type- Parameters:
items
- the items- Returns:
- a new combo box model
-
sortedItemComboBoxModel
- Type Parameters:
T
- the Item value type- Returns:
- a new combo box model
-
sortedItemComboBoxModel
- Type Parameters:
T
- the Item value type- Parameters:
items
- the items- Returns:
- a new combo box model
-
sortedItemComboBoxModel
- Type Parameters:
T
- the Item value type- Parameters:
comparator
- the comparator to use when sorting- Returns:
- a new combo box model
-
sortedItemComboBoxModel
public static <T> ItemComboBoxModel<T> sortedItemComboBoxModel(List<Item<T>> items, Comparator<Item<T>> comparator) - Type Parameters:
T
- the Item value type- Parameters:
items
- the itemscomparator
- the comparator to use when sorting- Returns:
- a new combo box model
-
booleanItemComboBoxModel
Constructs a new Boolean based ItemComboBoxModel with null as the initially selected value.- Returns:
- a Boolean based ItemComboBoxModel
-
booleanItemComboBoxModel
Constructs a new Boolean based ItemComboBoxModel with null as the initially selected value.- Parameters:
nullCaption
- the string representing a null value- Returns:
- a Boolean based ItemComboBoxModel
-
booleanItemComboBoxModel
public static ItemComboBoxModel<Boolean> booleanItemComboBoxModel(String nullCaption, String trueCaption, String falseCaption) Constructs a new Boolean based ItemComboBoxModel with null as the initially selected value.- Parameters:
nullCaption
- the string representing a null valuetrueCaption
- the string representing the boolean value 'true'falseCaption
- the string representing the boolean value 'false'- Returns:
- a Boolean based ItemComboBoxModel
-