org.jhotdraw.app.action
Class AbstractApplicationAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.jhotdraw.app.action.AbstractApplicationAction
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, Disposable
- Direct Known Subclasses:
- AboutAction, AbstractPreferencesAction, ClearRecentFilesMenuAction, ExitAction, NewFileAction, OpenApplicationAction, OpenApplicationFileAction, OpenFileAction, OpenRecentFileAction, ReOpenApplicationAction
public abstract class AbstractApplicationAction extends javax.swing.AbstractAction implements Disposable
This abstract class can be extended to implement anActionthat acts on anApplication.If the
Applicationobject is disabled, theAbstractApplicationActionis disabled as well.AbstractApplicationActionlistens using aWeakPropertyChangeListeneron theApplicationand 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 itsViews, so that they can be linked to components of a view.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AbstractApplicationAction(Application app)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddispose()Disposes of all resources held by this object so that they can be garbage collected.ApplicationgetApplication()booleanisEnabled()Returns true if the action is enabled.voidsetEnabled(boolean newValue)Enables or disables the action.-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener
-
-
-
-
Constructor Detail
-
AbstractApplicationAction
public AbstractApplicationAction(Application app)
Creates a new instance.
-
-
Method Detail
-
getApplication
public Application getApplication()
-
isEnabled
public boolean isEnabled()
Returns true if the action is enabled. The enabled state of the action depends on the state that has been set using setEnabled() and on the enabled state of the application.- Specified by:
isEnabledin interfacejavax.swing.Action- Overrides:
isEnabledin classjavax.swing.AbstractAction- Returns:
- true if the action is enabled, false otherwise
- See Also:
Action.isEnabled()
-
setEnabled
public void setEnabled(boolean newValue)
Enables or disables the action. The enabled state of the action depends on the value that is set here and on the enabled state of the application.- Specified by:
setEnabledin interfacejavax.swing.Action- Overrides:
setEnabledin classjavax.swing.AbstractAction- Parameters:
newValue- true to enable the action, false to disable it- See Also:
Action.setEnabled(boolean)
-
dispose
public final void dispose()
Description copied from interface:DisposableDisposes of all resources held by this object so that they can be garbage collected.- Specified by:
disposein interfaceDisposable
-
-
DataMelt 3.0 © DataMelt by jWork.ORG