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 the Item class.
See Also:
  • Method Details

    • 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>> comparator)
      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 items
      comparator - the comparator to use when sorting
      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 value
      trueCaption - the string representing the boolean value 'true'
      falseCaption - the string representing the boolean value 'false'
      Returns:
      a Boolean based ItemComboBoxModel