public class ConfigComboboxModel extends javax.swing.DefaultComboBoxModel<ComboboxStringOption>
This class represents the data model of configuration comboboxes.
It also stores each instance of such a model and guarantees that there will be only one instance of each configuration type.
Modifier and Type | Field and Description |
---|---|
private static java.util.HashMap<java.lang.String,ConfigComboboxModel> |
models |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
ConfigComboboxModel()
The constructor is private to prevent the creation of more than one instance of the same configuration type.
|
Modifier and Type | Method and Description |
---|---|
private void |
fill(java.util.ArrayList<ComboboxStringOption> options,
java.lang.String type)
Adds each of the given options to the combobox model referred to by the given type.
|
static ConfigComboboxModel |
getModel(java.lang.String type)
Returns the combobox model according to the given configuration type.
|
static ConfigComboboxModel |
initModel(java.util.ArrayList<ComboboxStringOption> options,
java.lang.String type)
Creates the
ConfigComboboxModel associated with the given type, if not yet done, and returns it. |
static void |
refill(java.lang.String type)
Resets all language-dependent display texts of the
ConfigComboboxModel with the given configuration type. |
addElement, getElementAt, getIndexOf, getSelectedItem, getSize, insertElementAt, removeAllElements, removeElement, removeElementAt, setSelectedItem
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
private static final long serialVersionUID
private static java.util.HashMap<java.lang.String,ConfigComboboxModel> models
private ConfigComboboxModel()
The constructor is private to prevent the creation of more than one instance of the same configuration type. It can be called only indirectly via initModel(ArrayList, String)
.
private void fill(java.util.ArrayList<ComboboxStringOption> options, java.lang.String type)
Adds each of the given options to the combobox model referred to by the given type.
options
- List of all options to be added.type
- Configuration type.public static ConfigComboboxModel getModel(java.lang.String type)
Returns the combobox model according to the given configuration type.
type
- Configuration type.public static ConfigComboboxModel initModel(java.util.ArrayList<ComboboxStringOption> options, java.lang.String type)
Creates the ConfigComboboxModel
associated with the given type, if not yet done, and returns it.
options
- List of combobox options for the model to be filled with.type
- Configuration type of the combobox.public static void refill(java.lang.String type)
Resets all language-dependent display texts of the ConfigComboboxModel
with the given configuration type.
This is called if the language has been changed.
type
- Configuration type of the combobox model to be refilled.