JHotDraw 7.0.9

org.jhotdraw.application.action
Class AbstractDocumentViewAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.jhotdraw.application.action.AbstractApplicationAction
          extended by org.jhotdraw.application.action.AbstractDocumentViewAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
AbstractSaveBeforeAction, ExportAction, FindAction, FindAction, MaximizeAction, MinimizeAction, PreferencesAction, PrintAction, PropertyAction, RedoAction, SaveAction, ToggleLineNumbersAction, ToggleLineWrapAction, ToggleProjectPropertyAction, ToggleStatusBarAction, UndoAction

public abstract class AbstractDocumentViewAction
extends AbstractApplicationAction

An Action that acts on on the current DocumentView of an DocumentOrientedApplication. If the current DocumentView object is disabled or is null, the AbstractDocumentViewAction is disabled as well.

A property name can be specified. When the specified property changes or when the current documentView changes, method updateProperty is invoked.

Version:
1.0 October 9, 2005 Created.
Author:
Werner Randelshofer
See Also:
org.jhotdraw.application.ApDocumentOrientedApplication, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
AbstractDocumentViewAction()
          Creates a new instance.
 
Method Summary
 DocumentView getCurrentView()
           
protected  java.lang.String getPropertyName()
          Gets the property name.
protected  void installProjectListeners(DocumentView p)
          Installs listeners on the documentView 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 uninstallProjectListeners(DocumentView p)
          Installs listeners on the documentView object.
protected  void updateEnabled(boolean oldValue, boolean newValue)
          Updates the enabled state of this action depending on the new enabled state of the documentView.
protected  void updateProject(DocumentView oldValue, DocumentView newValue)
          Updates the listeners of this action depending on the current documentView of the application.
protected  void updateProperty()
          This method is invoked, when the property changed and when the documentView changed.
 
Methods inherited from class org.jhotdraw.application.action.AbstractApplicationAction
getApplication, getFrameworkResourceMap, getResourceMap, initActionProperties, initActionProperties, installApplicationListeners, uninstallApplicationListeners, updateApplicationEnabled
 
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
 

Constructor Detail

AbstractDocumentViewAction

public AbstractDocumentViewAction()
Creates a new instance.

Method Detail

updateProject

protected void updateProject(DocumentView oldValue,
                             DocumentView newValue)
Updates the listeners of this action depending on the current documentView of the application.


setPropertyName

protected void setPropertyName(java.lang.String name)
Sets the property name.


getPropertyName

protected java.lang.String getPropertyName()
Gets the property name.


updateProperty

protected void updateProperty()
This method is invoked, when the property changed and when the documentView changed.


installProjectListeners

protected void installProjectListeners(DocumentView p)
Installs listeners on the documentView object.


uninstallProjectListeners

protected void uninstallProjectListeners(DocumentView p)
Installs listeners on the documentView object.


updateEnabled

protected void updateEnabled(boolean oldValue,
                             boolean newValue)
Updates the enabled state of this action depending on the new enabled state of the documentView.


getCurrentView

public DocumentView getCurrentView()

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:
isEnabled in interface javax.swing.Action
Overrides:
isEnabled in class AbstractApplicationAction
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:
setEnabled in interface javax.swing.Action
Overrides:
setEnabled in class AbstractApplicationAction
Parameters:
newValue - true to enable the action, false to disable it
See Also:
Action.setEnabled(boolean)

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.