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>>
public final class ItemComboBoxModel<T> extends FilteredComboBoxModel<Item<T>>
A ComboBoxModel implementation based on theItem
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ItemComboBoxModel<Boolean>
booleanItemComboBoxModel()
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
indexOf(T value)
Returns the index of the Item representing the given value, -1 if this model does not contain such an Item.static <T> ItemComboBoxModel<T>
itemComboBoxModel()
static <T> ItemComboBoxModel<T>
itemComboBoxModel(List<Item<T>> items)
static <T> ItemComboBoxModel<T>
sortedItemComboBoxModel()
static <T> ItemComboBoxModel<T>
sortedItemComboBoxModel(Comparator<Item<T>> sortComparator)
static <T> ItemComboBoxModel<T>
sortedItemComboBoxModel(List<Item<T>> items)
static <T> ItemComboBoxModel<T>
sortedItemComboBoxModel(List<Item<T>> items, Comparator<Item<T>> sortComparator)
-
Methods inherited from class is.codion.swing.common.model.component.combobox.FilteredComboBoxModel
addItem, addListDataListener, addSelectionListener, clear, containsItem, createSelectorValue, filteredItemCount, filteredItems, filterItems, getAllowSelectionPredicate, getElementAt, getIncludeCondition, getItemSupplier, getItemValidator, getSelectedItem, getSelectedItemTranslator, getSize, getSortComparator, isCleared, isFiltered, isFilterSelectedItem, isIncludeNull, isNullSelected, isSelectionEmpty, isVisible, items, refresh, refresher, refreshThen, removeItem, removeListDataListener, removeSelectionListener, replaceItem, selectedValue, setAllowSelectionPredicate, setFilterSelectedItem, setIncludeCondition, setIncludeNull, setItems, setItemSupplier, setItemValidator, setNullItem, setSelectedItem, setSelectedItemTranslator, setSortComparator, visibleItemCount, visibleItems
-
-
-
-
Method Detail
-
indexOf
public int indexOf(T value)
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
public static <T> ItemComboBoxModel<T> itemComboBoxModel()
- Type Parameters:
T
- the Item value type- Returns:
- a new combo box model
-
itemComboBoxModel
public static <T> ItemComboBoxModel<T> itemComboBoxModel(List<Item<T>> items)
- Type Parameters:
T
- the Item value type- Parameters:
items
- the items- Returns:
- a new combo box model
-
sortedItemComboBoxModel
public static <T> ItemComboBoxModel<T> sortedItemComboBoxModel()
- Type Parameters:
T
- the Item value type- Returns:
- a new combo box model
-
sortedItemComboBoxModel
public static <T> ItemComboBoxModel<T> sortedItemComboBoxModel(List<Item<T>> items)
- Type Parameters:
T
- the Item value type- Parameters:
items
- the items- Returns:
- a new combo box model
-
sortedItemComboBoxModel
public static <T> ItemComboBoxModel<T> sortedItemComboBoxModel(Comparator<Item<T>> sortComparator)
- Type Parameters:
T
- the Item value type- Parameters:
sortComparator
- the sort comparator to use- Returns:
- a new combo box model
-
sortedItemComboBoxModel
public static <T> ItemComboBoxModel<T> sortedItemComboBoxModel(List<Item<T>> items, Comparator<Item<T>> sortComparator)
- Type Parameters:
T
- the Item value type- Parameters:
items
- the itemssortComparator
- the sort comparator to use- Returns:
- a new combo box model
-
booleanItemComboBoxModel
public static ItemComboBoxModel<Boolean> booleanItemComboBoxModel()
Constructs a new Boolean based ItemComboBoxModel with null as the initially selected value.- Returns:
- a Boolean based ItemComboBoxModel
-
booleanItemComboBoxModel
public static ItemComboBoxModel<Boolean> booleanItemComboBoxModel(String nullCaption)
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
-
-