Interface IComboBox<T>

All Known Implementing Classes:
MenuActionComboBox

public interface IComboBox<T>
Common interface for components with combobox behaviour.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(int index, T item)
    Adds the new item at the given zero-relative index.
    void
    addItem(T item)
    Adds the new item to the end of this combo.
    void
    Removes all items from this combobox.
    int
    Returns the number of items contained in this combobox.
    void
    Deselects the currently selected item.
    getItem(int index)
    Returns item at the given zero-relative index.
    int
    Returns the index of currently selected item or -1 if there is not any selected item.
    Returns the currently selected item or Optional.empty() if there is not any selected item.
    int
    indexOf(T item)
    Returns the index of the given item or -1 if the given item is not found.
    void
    removeItem(int index)
    Removes the item at the given zero-relative index.
    void
    select(int index)
    Selects the item at the zero-relative index.
  • Method Details

    • select

      void select(int index)
      Selects the item at the zero-relative index.
      Parameters:
      index - the index of the item to select
      Throws:
      IndexOutOfBoundsException - if the index is out of range
    • deselect

      void deselect()
      Deselects the currently selected item. It does nothing if there is not any selected item.

      Note that after deselecting method getSelectionIndex() returns -1 and getSelectionItem() returns empty Optional

      See Also:
    • indexOf

      int indexOf(T item)
      Returns the index of the given item or -1 if the given item is not found.

      It starts to search item in the list and returns the index of the first founded item that equals to the given object.

      Parameters:
      item - element to search for
      Returns:
      the index of the first occurence of then given item or -1 if the given item is not found.
    • addItem

      void addItem(int index, T item)
      Adds the new item at the given zero-relative index.
      Parameters:
      index - the index to add item in range from 0 to count().
      item - the new item to add
      Throws:
      IndexOutOfBoundsException - if the given index is not in range from 0 to count()
    • addItem

      void addItem(T item)
      Adds the new item to the end of this combo.
      Parameters:
      item - the new item to add
    • removeItem

      void removeItem(int index)
      Removes the item at the given zero-relative index.
      Parameters:
      index - the index of item to remove
    • clear

      void clear()
      Removes all items from this combobox.
    • getItem

      T getItem(int index)
      Returns item at the given zero-relative index.
      Parameters:
      index - the index of the item to return
      Returns:
      the item at the given index
      Throws:
      IndexOutOfBoundsException - if the given index is not in range from 0 to count()
    • count

      int count()
      Returns the number of items contained in this combobox.
      Returns:
      the number of items contained in this combobox
    • getSelectionIndex

      int getSelectionIndex()
      Returns the index of currently selected item or -1 if there is not any selected item.
      Returns:
      the index of currently selected item or -1 if there is not any selected item
    • getSelectionItem

      Optional<T> getSelectionItem()
      Returns the currently selected item or Optional.empty() if there is not any selected item.
      Returns:
      the currently selected item or Optional.empty() if there is not any selected item.
      See Also: