org.grinvin.list.actions
Class AbstractListAction<E>
SimpleAction
org.grinvin.list.actions.AbstractListAction<E>
- ListSelectionListener
public abstract class AbstractListAction<E>
extends SimpleAction
implements ListSelectionListener
Abstract implementation for list actions. These actions work on a TypedListModel
and use a ListSelectionModel
to know on which elements to apply the action. The
TypedListModel
has to contain elements of type E
. This action will
listen to the ListSelectionModel
to know if it's enabled.
protected TypedListModel | list
|
protected ListSelectionModel | selection
|
AbstractListAction(TypedListModel list, ListSelectionModel selection, ResourceBundle bundle, String resourceID)
|
protected List | getSelectedElements() - Returns the selected elements in the
TypedListModel based on the ListSelectionModel .
|
void | setEnabled() - Decides the enabled status of this action, based on the selection.
|
void | valueChanged(ListSelectionEvent e)
|
list
protected TypedListModel list
selection
protected ListSelectionModel selection
AbstractListAction
public AbstractListAction(TypedListModel list,
ListSelectionModel selection,
ResourceBundle bundle,
String resourceID)
getSelectedElements
protected List getSelectedElements()
Returns the selected elements in the TypedListModel
based on the ListSelectionModel
.
setEnabled
public void setEnabled()
Decides the enabled status of this action, based on the selection. This method is called every
time the selection changes. By default the action will be disabled when there are no elements
selected and enabled in all other cases. This method can be overridden to alter this behaviour.
valueChanged
public void valueChanged(ListSelectionEvent e)