public abstract class AbstractViewAction
extends javax.swing.AbstractAction
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ENABLED_PROPERTY |
static java.lang.String |
VIEW_PROPERTY |
Constructor and Description |
---|
AbstractViewAction(Application app,
View view)
Creates a new instance which acts on the specified view of the application.
|
Modifier and Type | Method and Description |
---|---|
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.
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, putValue, removePropertyChangeListener
public static final java.lang.String VIEW_PROPERTY
public static final java.lang.String ENABLED_PROPERTY
public AbstractViewAction(Application app, View view)
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)