|
JHotDraw 7.5.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.AbstractAction
org.jhotdraw.app.action.AbstractViewAction
public abstract class AbstractViewAction
This abstract class can be extended to implement an Action
that acts
on behalf of a View
.
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.
Field Summary | |
---|---|
static java.lang.String |
ENABLED_PROPERTY
|
static java.lang.String |
VIEW_PROPERTY
|
Fields inherited from class javax.swing.AbstractAction |
---|
changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
---|
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 Summary | |
---|---|
AbstractViewAction(Application app,
View view)
Creates a new instance which acts on the specified view of the application. |
Method Summary | |
---|---|
View |
getActiveView()
|
Application |
getApplication()
|
protected java.lang.String |
getPropertyName()
Gets the property name. |
protected void |
installViewListeners(View p)
Installs listeners on the view object. |
boolean |
isEnabled()
Returns true if the action is enabled. |
void |
setEnabled(boolean newValue)
Enables or disables the action. |
protected void |
setPropertyName(java.lang.String name)
Sets the property name. |
protected void |
uninstallViewListeners(View p)
Uninstalls listeners on the view object. |
protected void |
updateEnabled(boolean oldValue,
boolean newValue)
Updates the enabled state of this action depending on the new enabled state of the view. |
protected void |
updateView()
This method is invoked, when the property changed and when the view changed. |
protected void |
updateView(View oldValue,
View newValue)
Updates the listeners of this action depending on the current view of the application. |
Methods inherited from class javax.swing.AbstractAction |
---|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.awt.event.ActionListener |
---|
actionPerformed |
Field Detail |
---|
public static final java.lang.String VIEW_PROPERTY
public static final java.lang.String ENABLED_PROPERTY
Constructor Detail |
---|
public AbstractViewAction(Application app, View view)
Method Detail |
---|
protected void updateView(View oldValue, View newValue)
protected void setPropertyName(java.lang.String name)
protected java.lang.String getPropertyName()
protected void updateView()
protected void installViewListeners(View p)
protected void uninstallViewListeners(View p)
protected void updateEnabled(boolean oldValue, boolean newValue)
public Application getApplication()
public View getActiveView()
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)
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |