public abstract class ContextMenuAction extends Object implements ActionListener, Runnable
TableContextMenu.
This implementation delays the execution of the context menu action with SwingUtilities.invokeLater(Runnable)
in order to avoid redraw problems when the popup menu is closed.
| Modifier and Type | Field and Description |
|---|---|
protected ContextMenuAdapter |
mAdapter
With this reference we can get information about the table we work on.
|
| Constructor and Description |
|---|
ContextMenuAction() |
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(ActionEvent pEvent)
Implementation of the
ActionListener interface. |
abstract String |
getKennung()
An identifier for this context menu action.
|
void |
initialize(ContextMenuAdapter pAdapter)
This gets call by the
TableContextMenu to give us access to information about the table we work on. |
abstract boolean |
isEnabled()
The
TableContextMenu will call this method just before poping up the menu
in order to enable/disable the menu entries. |
abstract void |
performAction()
Here the processing takes place when the user selects this context menu entry.
|
void |
run()
Implementation of the
Runnable interface. |
protected ContextMenuAdapter mAdapter
TableContextMenu.public void initialize(ContextMenuAdapter pAdapter)
TableContextMenu to give us access to information about the table we work on.pAdapter - table information sourcepublic void actionPerformed(ActionEvent pEvent)
ActionListener interface.
We do not react on this event immediately. Instead we use SwingUtilities.invokeLater(Runnable)
to complete the event processing before we take further steps in run().
This eliminates redraw problems in Swing.actionPerformed in interface ActionListenerpEvent - action eventpublic void run()
Runnable interface.
This will get called by SwingUtilities.invokeLater(Runnable) when everything is ready to
for us to do our processing. This method will call performAction().public abstract String getKennung()
TableContextMenu
to get resource information from the SwingDecorator. The returned identifier
should be prefixed with ContextMenuAdapter.getContextMenuKennung() to ensure uniqueness.
This method must be implemented by child classes.
public abstract boolean isEnabled()
TableContextMenu will call this method just before poping up the menu
in order to enable/disable the menu entries.
All the necessary information is available via mAdapter.
This method must be implemented by child classes.
true if this action is able to executepublic abstract void performAction()
mAdapter.
This method must be implemented by child classes.
Copyright © 2017 Jürgen Zeller (privat). All rights reserved.