org.jhotdraw.app.action
Class AbstractViewAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.jhotdraw.app.action.AbstractViewAction
-
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
- Direct Known Subclasses:
- AbstractFindAction, AbstractSaveUnsavedChangesAction, ExportFileAction, MaximizeWindowAction, MinimizeWindowAction, PrintFileAction, RedoAction, SaveFileAction, ToggleLineNumbersAction, ToggleLineWrapAction, TogglePropertiesPanelAction, ToggleStatusBarAction, ToggleViewPropertyAction, UndoAction, ViewPropertyAction, ViewSourceAction
public abstract class AbstractViewAction extends javax.swing.AbstractActionThis abstract class can be extended to implement anActionthat acts on behalf of aView.If the current View object is disabled or is null, the AbstractViewAction is disabled as well.
A property name can be specified. When the specified property changes or when the current view changes, method updateView is invoked.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringENABLED_PROPERTYstatic java.lang.StringVIEW_PROPERTY
-
Constructor Summary
Constructors Constructor and Description AbstractViewAction(Application app, View view)Creates a new instance which acts on the specified view of the application.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ViewgetActiveView()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
-
-
-
-
Field Detail
-
VIEW_PROPERTY
public static final java.lang.String VIEW_PROPERTY
- See Also:
- Constant Field Values
-
ENABLED_PROPERTY
public static final java.lang.String ENABLED_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractViewAction
public AbstractViewAction(Application app, @Nullable View view)
Creates a new instance which acts on the specified view of the application.
-
-
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(), on the enabled state of the application, on the enabled state of the active view and whether there is an active view.- 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)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG