public abstract class AbstractSelectionListenerAction extends AbstractJrAction implements SelectionListener
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
AbstractSelectionListenerAction(String name,
SelectionManager sm)
Default constructor.
|
AbstractSelectionListenerAction(String name,
SelectionManager sm,
Component parentComp)
Constructor for actions which need a parent component
e.g.
|
Modifier and Type | Method and Description |
---|---|
Selection |
getSelection()
Get the current selection.
|
SelectionManager |
getSelectionManager()
Get the underlying selection manager.
|
boolean |
isEnabled(SelectionEvent e)
Override this method to specify when to disable or enable the action
based on the current selection.
|
void |
selectionChanged(SelectionEvent e)
Override this method to specify what to do when the selection changes.
|
actionPerformed, createMenuItem, createToolboxItem, getIcon, setAcceleratorKey, setIcon, setName, setShortDescription
addPropertyChangeListener, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
public AbstractSelectionListenerAction(String name, SelectionManager sm)
name
- the name of the actionsm
- the underlying selection managerIllegalArgumentException
- if sm is null
public AbstractSelectionListenerAction(String name, SelectionManager sm, Component parentComp)
name
- the name of the actionsm
- the underlying selection managerparentComp
- the parent componentIllegalArgumentException
- if sm is null
public void selectionChanged(SelectionEvent e)
selectionChanged
in interface SelectionListener
e
- the selection eventisEnabled(SelectionEvent)
public boolean isEnabled(SelectionEvent e)
selectionChanged(SelectionEvent)
.e
- the selection eventselectionChanged(SelectionEvent)
public Selection getSelection()
public SelectionManager getSelectionManager()