Package evo.search.view.model
Class ConfigComboModel
- java.lang.Object
-
- javax.swing.AbstractListModel<E>
-
- javax.swing.DefaultComboBoxModel<Object>
-
- evo.search.view.model.ConfigComboModel
-
- All Implemented Interfaces:
Serializable
,ComboBoxModel<Object>
,ListModel<Object>
,MutableComboBoxModel<Object>
public class ConfigComboModel extends DefaultComboBoxModel<Object>
Combo box with edit button as first static element.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
EDIT_TEXT
Translated "Edit Configuration" text.-
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description ConfigComboModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSelectionListener(IntConsumer selectionListener)
Add a index listener to the event of a change of the selected index.Object
getElementAt(int index)
Returns the item at the specified index.int
getSize()
Get the amount of items in the combo box.void
setSelectedItem(Object anObject)
Set the selected item.-
Methods inherited from class javax.swing.DefaultComboBoxModel
addAll, addAll, addElement, getIndexOf, getSelectedItem, insertElementAt, removeAllElements, removeElement, removeElementAt
-
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
-
-
-
-
Field Detail
-
EDIT_TEXT
public static final String EDIT_TEXT
Translated "Edit Configuration" text.
-
-
Method Detail
-
getElementAt
public Object getElementAt(int index)
Returns the item at the specified index.Notice: The index is shifted upwards by one, because the first element is the "Edit configurations" button.
- Specified by:
getElementAt
in interfaceListModel<Object>
- Overrides:
getElementAt
in classDefaultComboBoxModel<Object>
- Returns:
- item at the specified index
-
getSize
public int getSize()
Get the amount of items in the combo box. The size is increased by one due to the "Edit Configuration" button.
-
setSelectedItem
public void setSelectedItem(Object anObject)
Set the selected item. If the first item is selected (the "Edit Configuration" button), theEventService.OPEN_CONFIG
event is triggered.- Specified by:
setSelectedItem
in interfaceComboBoxModel<Object>
- Overrides:
setSelectedItem
in classDefaultComboBoxModel<Object>
- Parameters:
anObject
- item to select
-
addSelectionListener
public void addSelectionListener(IntConsumer selectionListener)
Add a index listener to the event of a change of the selected index.- Parameters:
selectionListener
- selected index change listener
-
-