public abstract class AbstractApplicationAction extends javax.swing.AbstractAction implements Disposable
Action
that acts
on an Application
.
If the Application
object is disabled, the
AbstractApplicationAction
is disabled as well.
AbstractApplicationAction
listens using a
WeakPropertyChangeListener
on the Application
and thus may
become garbage collected if it is not referenced by any other object.
Application actions are typically created by an ApplicationModel
,
and can be retrieved using getAction(String) from the application model.
Application model typically links the actions to menu items and toolbars that
it creates. Applicaton model may also put actions into its View
s,
so that they can be linked to components of a view.
Constructor and Description |
---|
AbstractApplicationAction(Application app)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of all resources held by this object so that they can be
garbage collected.
|
Application |
getApplication() |
protected void |
installApplicationListeners(Application app) |
boolean |
isEnabled()
Returns true if the action is enabled.
|
void |
setEnabled(boolean newValue)
Enables or disables the action.
|
protected void |
uninstallApplicationListeners(Application app)
Installs listeners on the application object.
|
protected void |
updateApplicationEnabled()
Updates the enabled state of this action depending on the new enabled
state of the application.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener
public AbstractApplicationAction(Application app)
protected void installApplicationListeners(Application app)
protected void uninstallApplicationListeners(Application app)
public Application getApplication()
protected void updateApplicationEnabled()
public boolean isEnabled()
isEnabled
in interface javax.swing.Action
isEnabled
in class javax.swing.AbstractAction
Action.isEnabled()
public void setEnabled(boolean newValue)
setEnabled
in interface javax.swing.Action
setEnabled
in class javax.swing.AbstractAction
newValue
- true to enable the action, false to
disable itAction.setEnabled(boolean)
public final void dispose()
Disposable
dispose
in interface Disposable