|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pentaho.reporting.engine.classic.core.modules.gui.commonswing.KeyedComboBoxModel
public class KeyedComboBoxModel
The KeyedComboBox model allows to define an internal key (the data element) for every entry in the model.
This class is usefull in all cases, where the public text differs from the internal view on the data. A separation between presentation data and processing data is a prequesite for localizing combobox entries. This model does not allow selected elements, which are not in the list of valid elements.
Constructor Summary | |
---|---|
KeyedComboBoxModel()
Creates a new keyed combobox model. |
|
KeyedComboBoxModel(Object[] keys,
Object[] values)
Creates a new keyed combobox model for the given keys and values. |
Method Summary | |
---|---|
void |
add(Object key,
Object cbitem)
Adds a new entry to the model. |
void |
addListDataListener(ListDataListener l)
Adds a listener to the list that's notified each time a change to the data model occurs. |
void |
clear()
Removes all entries from the model. |
int |
findElementIndex(Object anItem)
Tries to find the index of element with the given value. |
Object |
getElementAt(int index)
Returns the value at the specified index. |
Object |
getKeyAt(int index)
Returns the key from the given index. |
Object |
getSelectedItem()
Returns the selected item. |
int |
getSelectedItemIndex()
|
Object |
getSelectedKey()
Returns the selected data element or null if none is set. |
int |
getSize()
Returns the length of the list. |
void |
remove(int index)
|
void |
removeDataElement(Object key)
Removes an entry from the model. |
void |
removeListDataListener(ListDataListener l)
Removes a listener from the list that's notified each time a change to the data model occurs. |
void |
setAllowOtherValue(boolean allowOtherValue)
|
void |
setData(Object[] keys,
Object[] values)
Replaces the data in this combobox model. |
void |
setSelectedItem(Object anItem)
Set the selected item. |
void |
setSelectedKey(Object anItem)
Defines the selected key. |
void |
update(int index,
Object key,
Object cbitem)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyedComboBoxModel()
public KeyedComboBoxModel(Object[] keys, Object[] values)
keys
- the keysvalues
- the valuesMethod Detail |
---|
public void setData(Object[] keys, Object[] values)
keys
- the keysvalues
- the valuespublic Object getSelectedItem()
getSelectedItem
in interface ComboBoxModel
null
if there is no selectionpublic void setSelectedKey(Object anItem)
anItem
- the new selected item.public void setSelectedItem(Object anItem)
ListDataListener
s that the contents have changed.
setSelectedItem
in interface ComboBoxModel
anItem
- the list object to select or null
to clear the selectionpublic void setAllowOtherValue(boolean allowOtherValue)
public void addListDataListener(ListDataListener l)
addListDataListener
in interface ListModel
l
- the ListDataListener
to be addedpublic Object getElementAt(int index)
getElementAt
in interface ListModel
index
- the requested index
index
public Object getKeyAt(int index)
index
- the index of the key.
public Object getSelectedKey()
public int getSize()
getSize
in interface ListModel
public void removeListDataListener(ListDataListener l)
removeListDataListener
in interface ListModel
l
- the ListDataListener
to be removedpublic int findElementIndex(Object anItem)
anItem
- the key for the element to be searched.
public void removeDataElement(Object key)
key
- the keypublic void add(Object key, Object cbitem)
key
- the keycbitem
- the display value.public void update(int index, Object key, Object cbitem)
public void clear()
public int getSelectedItemIndex()
public void remove(int index)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |