public class LOVAdapter extends Object implements ListSelectionModel, ComboBoxModel, ActionListener
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION| Constructor and Description |
|---|
LOVAdapter(ButtonGroup pButtonGroup,
List<?> pDisplayedItems,
List<?> pKeys,
ValueModel<?> pSelectedKeyVM,
Object pUnselectedKey)
Create a new adapter between the buttong group, the keys and the selected key.
|
LOVAdapter(ButtonGroup pButtonGroup,
ValueModel<List<?>> pDisplayedItemsVM,
ValueModel<List<?>> pKeysVM,
ValueModel<?> pSelectedKeyVM,
Object pUnselectedKey)
Create a new adapter between the buttong group, the keys and the selected key.
|
LOVAdapter(JComboBox pComboBox,
List<?> pDisplayedItems,
List<?> pKeys,
ValueModel<?> pSelectedKeyVM)
Create a new adapter between the displayed itams and the keys.
|
LOVAdapter(JComboBox pComboBox,
List<?> pDisplayedItems,
List<?> pKeys,
ValueModel<?> pSelectedKeyVM,
Object pUnselectedKey)
Create a new adapter between the displayed itams, the keys and a magic "null"
key value.
|
LOVAdapter(JComboBox pComboBox,
ValueModel<List<?>> pDisplayedItemsVM,
ValueModel<List<?>> pKeysVM,
ValueModel<?> pSelectedKeyVM)
Create a new adapter between the displayed itams and the keys.
|
LOVAdapter(JComboBox pComboBox,
ValueModel<List<?>> pDisplayedItemsVM,
ValueModel<List<?>> pKeysVM,
ValueModel<?> pSelectedKeyVM,
Object pUnselectedKey)
Create a new adapter between the displayed itams, the keys and a magic "null"
key value.
|
LOVAdapter(JList pList,
List<?> pDisplayedItems,
List<?> pKeys,
ValueModel<?> pSelectedKeyVM)
Create a new adapter between the displayed itams and the keys.
|
LOVAdapter(JList pList,
List<?> pDisplayedItems,
List<?> pKeys,
ValueModel<?> pSelectedKeyVM,
Object pUnselectedKey)
Create a new adapter between the displayed itams, the keys and a magic "null"
key value.
|
LOVAdapter(JList pList,
ValueModel<List<?>> pDisplayedItemsVM,
ValueModel<List<?>> pKeysVM,
ValueModel<?> pSelectedKeyVM)
Create a new adapter between the displayed itams and the keys.
|
LOVAdapter(JList pList,
ValueModel<List<?>> pDisplayedItemsVM,
ValueModel<List<?>> pKeysVM,
ValueModel<?> pSelectedKeyVM,
Object pUnselectedKey)
Create a new adapter between the displayed itams, the keys and a magic "null"
key value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(ActionEvent pEvent) |
void |
addListDataListener(ListDataListener pListDataListener) |
void |
addListSelectionListener(ListSelectionListener pListener) |
void |
addSelectionInterval(int pIndex0,
int pIndex1) |
void |
clearSelection() |
protected void |
fireListChanged(ListDataEvent pListDataEvent)
Helper method to notify all listeners that something changed in our list model.
|
int |
getAnchorSelectionIndex() |
Object |
getElementAt(int pIndex) |
int |
getIndexByKey(Object pKey)
Small helper to find the index for a key in the key list.
|
int |
getLeadSelectionIndex() |
int |
getMaxSelectionIndex() |
int |
getMinSelectionIndex() |
int |
getSelectedIndex()
Return the selected index or -1 if there is no valid selection.
|
Object |
getSelectedItem() |
int |
getSelectionMode() |
int |
getSize() |
boolean |
getValueIsAdjusting() |
void |
insertIndexInterval(int pIndex,
int pLength,
boolean pBefore) |
boolean |
isSelectedIndex(int pIndex) |
boolean |
isSelectionEmpty() |
void |
removeIndexInterval(int pIndex0,
int pIndex1) |
void |
removeListDataListener(ListDataListener pListDataListener) |
void |
removeListSelectionListener(ListSelectionListener pListener) |
void |
removeSelectionInterval(int pIndex0,
int pIndex1) |
void |
setAnchorSelectionIndex(int pIndex) |
void |
setLeadSelectionIndex(int pIndex) |
void |
setSelectedItem(Object pItem) |
void |
setSelectionInterval(int pIndex0,
int pIndex1) |
void |
setSelectionMode(int pSelectionMode) |
void |
setValueIsAdjusting(boolean pValueIsAdjusting) |
void |
vmItemsChanged(ChangeEvent pEvent)
Callback from our ValueModel holding the displayed items.
|
void |
vmKeysChanged(ChangeEvent pEvent)
Callback from our ValueModel holding the possible keys.
|
void |
vmSelectedKeyChanged(ChangeEvent pEvent)
Callback from our ValueModel holding the selected key.
|
public LOVAdapter(JComboBox pComboBox, ValueModel<List<?>> pDisplayedItemsVM, ValueModel<List<?>> pKeysVM, ValueModel<?> pSelectedKeyVM)
pComboBox - the combobox widget, must not be nullpDisplayedItemsVM - the value model holding the displayed items, must not be nullpKeysVM - the value model holding the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpublic LOVAdapter(JComboBox pComboBox, ValueModel<List<?>> pDisplayedItemsVM, ValueModel<List<?>> pKeysVM, ValueModel<?> pSelectedKeyVM, Object pUnselectedKey)
pComboBox - the combobox widget, must not be nullpDisplayedItemsVM - the value model holding the displayed items, must not be nullpKeysVM - the value model holding the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpUnselectedKey - the magic key, may be nulllpublic LOVAdapter(JComboBox pComboBox, List<?> pDisplayedItems, List<?> pKeys, ValueModel<?> pSelectedKeyVM)
pComboBox - the combobox widget, must not be nullpDisplayedItems - the list containing the displayed items, must not be nullpKeys - the list containing the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpublic LOVAdapter(JComboBox pComboBox, List<?> pDisplayedItems, List<?> pKeys, ValueModel<?> pSelectedKeyVM, Object pUnselectedKey)
pComboBox - the combobox widget, must not be nullpDisplayedItems - the list containing the displayed items, must not be nullpKeys - the list containing the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpUnselectedKey - the magic key, may be nulllpublic LOVAdapter(JList pList, ValueModel<List<?>> pDisplayedItemsVM, ValueModel<List<?>> pKeysVM, ValueModel<?> pSelectedKeyVM)
pList - the list widget, must not be nullpDisplayedItemsVM - the value model holding the displayed items, must not be nullpKeysVM - the value model holding the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpublic LOVAdapter(JList pList, ValueModel<List<?>> pDisplayedItemsVM, ValueModel<List<?>> pKeysVM, ValueModel<?> pSelectedKeyVM, Object pUnselectedKey)
pList - the list widget, must not be nullpDisplayedItemsVM - the value model holding the displayed items, must not be nullpKeysVM - the value model holding the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpUnselectedKey - the magic key, may be nulllpublic LOVAdapter(JList pList, List<?> pDisplayedItems, List<?> pKeys, ValueModel<?> pSelectedKeyVM)
pList - the list widget, must not be nullpDisplayedItems - the list containing the displayed items, must not be nullpKeys - the list containing the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpublic LOVAdapter(JList pList, List<?> pDisplayedItems, List<?> pKeys, ValueModel<?> pSelectedKeyVM, Object pUnselectedKey)
pList - the list widget, must not be nullpDisplayedItems - the list containing the displayed items, must not be nullpKeys - the list containing the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpUnselectedKey - the magic key, may be nulllpublic LOVAdapter(ButtonGroup pButtonGroup, ValueModel<List<?>> pDisplayedItemsVM, ValueModel<List<?>> pKeysVM, ValueModel<?> pSelectedKeyVM, Object pUnselectedKey)
pButtonGroup - the list widget, must not be nullpDisplayedItemsVM - the value model holding the displayed items, must not be nullpKeysVM - the value model holding the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpUnselectedKey - the magic key, may be nulllpublic LOVAdapter(ButtonGroup pButtonGroup, List<?> pDisplayedItems, List<?> pKeys, ValueModel<?> pSelectedKeyVM, Object pUnselectedKey)
pButtonGroup - the button group, must not be nullpDisplayedItems - the list containing the displayed items, must not be null, but not really usedpKeys - the list containing the matching keys, must not be nullpSelectedKeyVM - the value model holding the key matching the selection keys, must not be nullpUnselectedKey - the magic key, may be nulllprotected void fireListChanged(ListDataEvent pListDataEvent)
pListDataEvent - the list data event to dispatchpublic int getSelectedIndex()
public int getIndexByKey(Object pKey)
pKey - the key we are searching the index forpublic void vmItemsChanged(ChangeEvent pEvent)
pEvent - not usedpublic void vmSelectedKeyChanged(ChangeEvent pEvent)
pEvent - not usedpublic void vmKeysChanged(ChangeEvent pEvent)
pEvent - not usedpublic void setSelectionInterval(int pIndex0,
int pIndex1)
setSelectionInterval in interface ListSelectionModelpublic void addSelectionInterval(int pIndex0,
int pIndex1)
addSelectionInterval in interface ListSelectionModelpublic void removeSelectionInterval(int pIndex0,
int pIndex1)
removeSelectionInterval in interface ListSelectionModelpublic void insertIndexInterval(int pIndex,
int pLength,
boolean pBefore)
insertIndexInterval in interface ListSelectionModelpublic void removeIndexInterval(int pIndex0,
int pIndex1)
removeIndexInterval in interface ListSelectionModelpublic void clearSelection()
clearSelection in interface ListSelectionModelpublic int getMinSelectionIndex()
getMinSelectionIndex in interface ListSelectionModelpublic int getMaxSelectionIndex()
getMaxSelectionIndex in interface ListSelectionModelpublic boolean isSelectedIndex(int pIndex)
isSelectedIndex in interface ListSelectionModelpublic int getAnchorSelectionIndex()
getAnchorSelectionIndex in interface ListSelectionModelpublic void setAnchorSelectionIndex(int pIndex)
setAnchorSelectionIndex in interface ListSelectionModelpublic int getLeadSelectionIndex()
getLeadSelectionIndex in interface ListSelectionModelpublic void setLeadSelectionIndex(int pIndex)
setLeadSelectionIndex in interface ListSelectionModelpublic boolean isSelectionEmpty()
isSelectionEmpty in interface ListSelectionModelpublic void setValueIsAdjusting(boolean pValueIsAdjusting)
setValueIsAdjusting in interface ListSelectionModelpublic boolean getValueIsAdjusting()
getValueIsAdjusting in interface ListSelectionModelpublic void setSelectionMode(int pSelectionMode)
setSelectionMode in interface ListSelectionModelpublic int getSelectionMode()
getSelectionMode in interface ListSelectionModelpublic void addListSelectionListener(ListSelectionListener pListener)
addListSelectionListener in interface ListSelectionModelpublic void removeListSelectionListener(ListSelectionListener pListener)
removeListSelectionListener in interface ListSelectionModelpublic Object getSelectedItem()
getSelectedItem in interface ComboBoxModelpublic void setSelectedItem(Object pItem)
setSelectedItem in interface ComboBoxModelpublic Object getElementAt(int pIndex)
getElementAt in interface ListModelpublic void addListDataListener(ListDataListener pListDataListener)
addListDataListener in interface ListModelpublic void removeListDataListener(ListDataListener pListDataListener)
removeListDataListener in interface ListModelpublic void actionPerformed(ActionEvent pEvent)
actionPerformed in interface ActionListenerCopyright © 2017 Jürgen Zeller (privat). All rights reserved.