Package com.e1c.langtool.ui.common.combo
Interface IComboBox<T>
- All Known Implementing Classes:
MenuActionComboBox
public interface IComboBox<T>
Common interface for components with combobox behaviour.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the new item at the given zero-relative index.voidAdds the new item to the end of this combo.voidclear()Removes all items from this combobox.intcount()Returns the number of items contained in this combobox.voiddeselect()Deselects the currently selected item.getItem(int index) Returns item at the given zero-relative index.intReturns the index of currently selected item or-1if there is not any selected item.Returns the currently selected item orOptional.empty()if there is not any selected item.intReturns the index of the given item or-1if the given item is not found.voidremoveItem(int index) Removes the item at the given zero-relative index.voidselect(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-1andgetSelectionItem()returns emptyOptional- See Also:
-
indexOf
Returns the index of the given item or-1if 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
-1if the given item is not found.
-
addItem
Adds the new item at the given zero-relative index.- Parameters:
index- the index to add item in range from0to.count()item- the new item to add- Throws:
IndexOutOfBoundsException- if the given index is not in range from0tocount()
-
addItem
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
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 from0tocount()
-
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-1if there is not any selected item.- Returns:
- the index of currently selected item or
-1if there is not any selected item
-
getSelectionItem
Returns the currently selected item orOptional.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:
-