PATH Documentation > WebObjects

Table of Contents

EOAction


Inherits from:
javax.swing.AbstractAction
Package:
com.webobjects.eoapplication


Class Description


EOAction objects are abstract representations of operations the user can invoke from the user interface. An action does not specify how it appears in the user interface-it can appear as a button, a menu item, or both.

Each action defines a method called the action name, that is invoked when the action triggers. An action also has a description path, which describes the category of the action and its name. For example, a Quit action's description path might be "Document/Quit". In addition, the action can have a short description that differs from the last element of the description path, for example, "Quit the Application".

Actions can have icons for buttons in the application and small icons for minor buttons in the user interface. To allow users to trigger actions with "hot-keys," each action has a menu accelerator, a javax.swing.KeyStroke the user can type on the keyboard.

Actions often appear in groups in the user interface: buttons in the same group are rendered close together and menu items in the group are rendered in separate menus like the Document, Edit, Tools, or Window menus. To group actions, EOAction defines a category priority. All actions in the same group have the same category priority. An additional parameter, the action priority defines the order in which actions appear within a group (for example, the order menu items appear within a menu).

An action triggers when the user clicks the corresponding user interface widget. In most cases, the action's method is dispatched to the subcontrollers of the controller that displays the action. Methods whose names end with ...ForControllerHierarchy return such actions. In some cases, the action's method is dispatched to the active widget, like the text field containing the cursor. Methods whose names end with ...ForFocusComponent return such actions. In other cases, the action's method is dispatched to a particular object, usually the EOApplication at the root of the controller hierarchy.

EOAction defines methods to create actions, access an action's parameters, manage groups of actions, and accessing shared actions used in Direct to Java Client applications.




Constants



Constant Description
ActivatePreviousWindowActionPriority Description forthcoming.
AppendActionPriority Description forthcoming.
CancelActionPriority Description forthcoming.
ClearActionPriority Description forthcoming.
CloseWindowActionPriority Description forthcoming.
DeleteActionPriority Description forthcoming.
DescriptionPathSeparator Description forthcoming.
DocumentCategoryPriority Description forthcoming.
EditCategoryPriority Description forthcoming.
FindActionPriority Description forthcoming.
HelpActionPriority Description forthcoming.
HelpCategoryPriority Description forthcoming.
InfoActionPriority Description forthcoming.
InsertActionPriority Description forthcoming.
ModalActionsCategoryPriority Description forthcoming.
NavigationActionPriority Description forthcoming.
NavigationActionsCategoryPriority Description forthcoming.
NewMultipleWindowActionPriority Description forthcoming.
NewSingleWindowActionPriority Description forthcoming.
ObjectActionPriority Description forthcoming.
ObjectActionsCategoryPriority Description forthcoming.
OkayActionPriority Description forthcoming.
OpenActionPriority Description forthcoming.
PasteboardCopyActionPriority Description forthcoming.
PasteboardCutActionPriority Description forthcoming.
PasteboardDeleteActionPriority Description forthcoming.
PasteboardPasteActionPriority Description forthcoming.
PasteboardSelectAllActionPriority Description forthcoming.
QuitActionPriority Description forthcoming.
RedoActionPriority Description forthcoming.
RefreshActionPriority Description forthcoming.
RevertActionPriority Description forthcoming.
SaveActionPriority Description forthcoming.
SaveAllActionPriority Description forthcoming.
SearchActionPriority Description forthcoming.
ToolsCateogryPriority Description forthcoming.
UndoActionPriority Description forthcoming.
WindowCategoryPriority Description forthcoming.



Method Types


Accessing action parameters
actionName
actionPriority
actionTitle
categoryPriority
descriptionPath
descriptionPathComponents
icon
menuAccelerator
setActionName
setActionPriority
setCategoryPriority
setDescriptionPath
setIcon
setMenuAccelerator
setShortDescription
setSmallIcon
shortDescription
smallIcon
Creating actions
EOAction
actionForControllerHierarchy
actionForFocusComponent
actionForObject
standardActionForFocusComponent
standardDocumentActionForControllerHierarchy
standardDocumentActionForApplication
standardDocumentActionForControllerHierarchy
standardEditActionForControllerHierarchy
Creating menu accelerators
keyStrokeWithKeyCode
keyStrokeWithKeyCodeAndModifiers
keyStrokeWithKeyCodeAndShiftModifier
keyStrokeWithString
Accessing specific shared actions
standardActivatePreviousWindowActionForApplication
standardAddActionForControllerHierarchy
standardAppendActionForControllerHierarchy
standardCancelActionForControllerHierarchy
standardClearActionForControllerHierarchy
standardCloseWindowActionForControllerHierarchy
standardDeleteActionForControllerHierarchy
standardDeselectActionForControllerHierarchy
standardEditActionsForFocusComponent
standardFindActionForControllerHierarchy
standardInsertActionForControllerHierarchy
standardInsertWithTaskActionForControllerHierarchy
standardOkActionForControllerHierarchy
standardOkAndSaveActionForControllerHierarchy
standardOpenWithTaskActionForControllerHierarchy
standardQuitActionForApplication
standardRedoActionForControllerHierarchy
standardRefreshActionForApplication
standardRemoveActionForControllerHierarchy
standardRevertActionForControllerHierarchy
standardSaveActionForControllerHierarchy
standardSaveAllActionForApplication
standardSelectActionForControllerHierarchy
standardUndoActionForControllerHierarchy
Managing actions
actionCanBePerformedInContextOfController
actionPerformed
mergedActions
sortedActions
Managing the property change listener
addPropertyChangeListener
firePropertyChange
removePropertyChangeListener
Methods inherited from Object
equals
toString


Constructors



EOAction

public EOAction( String actionName, String descriptionPath, String shortDescription, javax.swing.Icon icon, javax.swing.Icon smallIcon, javax.swing.KeyStroke menuAccelerator, int categoryPriority, int actionPriority)

Returns a new action (an EOAction object) as specified by the arguments.

See Also: actionName, descriptionPath, shortDescription, icon, smallIcon, menuAccelerator, categoryPriority, and actionPriority.




Static Methods



actionForControllerHierarchy

public static EOAction actionForControllerHierarchy( String actionName, String descriptionPath, String shortDescription, javax.swing.Icon icon, javax.swing.Icon smallIcon, javax.swing.KeyStroke menuAccelerator, int categoryPriority, int actionPriority, boolean sendsActionToAllControllers)

Returns a new action (an EOAction object) as specified by the arguments. When this action triggers, it is dispatched to the subcontrollers of the controller that displays it. If sendsActionToAllControllers is true, the action is dispatched to the subcontrollers of the controller that displays the action. Otherwise, the action is dispatched to the first subcontroller that responds to it.

See Also: EOAction, actionName, descriptionPath, shortDescription, icon, smallIcon, menuAccelerator, categoryPriority, and actionPriority.



actionForFocusComponent

public static EOAction actionForFocusComponent( String actionName, String descriptionPath, String shortDescription, javax.swing.Icon icon, javax.swing.Icon smallIcon, javax.swing.KeyStroke menuAccelerator, int categoryPriority, int actionPriority)

Returns a new action (an EOAction object) as specified by the arguments. When this action triggers, it is dispatched to the active widget (for example, the text field containing the cursor). The other parameters are identical to the EOAction constructor parameters.

See Also: EOAction, actionName, descriptionPath, shortDescription, icon, smallIcon, menuAccelerator, categoryPriority, and actionPriority.



actionForObject

public static EOAction actionForObject( String actionName, String descriptionPath, String shortDescription, javax.swing.Icon icon, javax.swing.Icon smallIcon, javax.swing.KeyStroke menuAccelerator, int categoryPriority, int actionPriority, Object object)

Returns a new action (an EOAction object) as specified by the arguments. When this action triggers, it is dispatched directly to object. To create an action that gets dispatched to the application, set object to the EOApplication at the top of the controller hierarchy. The other parameters are identical to the EOAction constructor parameters.

See Also: EOAction, actionName, descriptionPath, shortDescription, icon, smallIcon, menuAccelerator, categoryPriority, and actionPriority.



keyStrokeWithKeyCode

public static javax.swing.KeyStroke keyStrokeWithKeyCode(int keyCode)

Returns a KeyStroke given the numerical key code keyCode with the appropriate modifier for the client operating system (usually CTRL_MASK). See Sun's javax.swing.KeyStroke documentation for more information.

keyStrokeWithKeyCodeAndModifiers

public static javax.swing.KeyStroke keyStrokeWithKeyCodeAndModifiers( int keyCode, int modifiers)

Returns a KeyStroke given the numerical key code keyCode and the modifier mask modifiers. This method adds the appropriate modifier for the client operating system (usually CTRL_MASK). See Sun's javax.swing.KeyStroke documentation for more information.

keyStrokeWithKeyCodeAndShiftModifier

public static javax.swing.KeyStroke keyStrokeWithKeyCodeAndShiftModifier(int keyCode)

Returns a KeyStroke given the numerical key code keyCode with the SHIFT modifier. This method also adds the appropriate modifier for the client operating system (usually CTRL_MASK). See Sun's javax.swing.KeyStroke documentation for more information.

keyStrokeWithString

public static javax.swing.KeyStroke keyStrokeWithString(String keyStrokeDescription)

Returns a KeyStroke for the String keyStrokeDescription. This method adds the appropriate modifier for the client operating system (usually CTRL_MASK). See Sun's javax.swing.KeyStroke documentation for more information.

mergedActions

public static NSArray mergedActions( NSArray actionArray1, NSArray actionArray2)

Returns an NSArray containing all of the actions in actionArray1 and actionArray2 with duplicate actions removed.

sortedActions

public static NSArray sortedActions(NSArray actionArray)

Returns a sorted NSArray containing the actions in actionArray. The actions are sorted first on the category priority, then on the action priority, and finally on the description path.

See Also: categoryPriority, actionPriority, and descriptionPath.



standardActionForFocusComponent

public static EOAction standardActionForFocusComponent( String actionName, javax.swing.KeyStroke menuAccelerator, int actionPriority)

Returns a shared action as specified by the arguments. When the action triggers, it is dispatched to the focus component (for example, a text field). The action's category priority is the edit action priority so the action is grouped with the other edit actions.

See Also: actionName, menuAccelerator, and actionPriority.



standardActivatePreviousWindowActionForApplication

public static EOAction standardActivatePreviousWindowActionForApplication()

Returns a shared action (an EOAction object) for the activatePreviousWindow method. When this action triggers, it is dispatched to the EOApplication at the top of the controller hierarchy. The action's category priority is the window action priority so the action is grouped with the other window actions. This action appears as the Activate Previous Window item in the Window menu in Direct to Java Client applications.

standardAddActionForControllerHierarchy

public static EOAction standardAddActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the add method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardAppendActionForControllerHierarchy

public static EOAction standardAppendActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the append method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the edit action priority so the action is grouped with the other edit actions.

standardCancelActionForControllerHierarchy

public static EOAction standardCancelActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the cancel method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the modal dialog action priority so the action is grouped with the other modal dialog actions.

standardClearActionForControllerHierarchy

public static EOAction standardClearActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the clear method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the edit action priority so the action is grouped with the other edit actions.

standardCloseWindowActionForControllerHierarchy

public static EOAction standardCloseWindowActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the close method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the window action priority so the action is grouped with the other window actions.

standardDeleteActionForControllerHierarchy

public static EOAction standardDeleteActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the delete method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardDeselectActionForControllerHierarchy

public static EOAction standardDeselectActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the deselect method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardDocumentActionForApplication

public static EOAction standardDocumentActionForApplication( String actionName, javax.swing.KeyStroke menuAccelerator, int actionPriority)

Returns a shared action with the method name actionName, menu accelerator menuAccelerator, and action priority actionPriority. When this action triggers, it is dispatched to the EOApplication at the top of the controller hierarchy. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardDocumentActionForControllerHierarchy

public static EOAction standardDocumentActionForControllerHierarchy( String actionName, javax.swing.KeyStroke menuAccelerator, int actionPriority)

Returns a shared action with the method name actionName, menu accelerator menuAccelerator, and action priority actionPriority. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardDocumentActionForControllerHierarchy

public static EOAction standardDocumentActionForControllerHierarchy( String actionName, String baseTitle, javax.swing.KeyStroke menuAccelerator, int actionPriority)

Returns a shared action as specified by the arguments. The baseTitle parameter is the name of the action as it appears in the user interface and is used for both the short description and the action title. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

See Also: actionName, actionTitle, shortDescription, menuAccelerator, and actionPriority.



standardEditActionForControllerHierarchy

public static EOAction standardEditActionForControllerHierarchy( String actionName, javax.swing.KeyStroke menuAccelerator, int actionPriority)

Returns a shared action as specified by the arguments. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the edit action priority so the action is grouped with the other edit actions.

See Also: actionName, menuAccelerator, and actionPriority.



standardEditActionsForFocusComponent

public static NSArray standardEditActionsForFocusComponent()

Returns an NSArray containing shared actions for the cut, copy, and paste methods. When these actions trigger, they are dispatched to the focus component. Sets the category priorities for the actions to the edit category priority so the actions are grouped with the other edit actions.

standardFindActionForControllerHierarchy

public static EOAction standardFindActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the find method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the edit action priority so the action is grouped with the other edit actions.

standardInsertActionForControllerHierarchy

public static EOAction standardInsertActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the insertWithTask method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardInsertWithTaskActionForControllerHierarchy

public static EOAction standardInsertWithTaskActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the insertWithTask method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardOkActionForControllerHierarchy

public static EOAction standardOkActionForControllerHierarchy()

Returns a shared action (an EOAction object) for an OK button in a modal dialog box. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the modal dialog action priority so the action is grouped with the other modal dialog actions.

standardOkAndSaveActionForControllerHierarchy

public static EOAction standardOkAndSaveActionForControllerHierarchy()

Returns a shared action (an EOAction object) for an OK and Save button in a modal dialog box. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the modal dialog action priority so the action is grouped with the other modal dialog actions.

standardOpenWithTaskActionForControllerHierarchy

public static EOAction standardOpenWithTaskActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the openWithTask method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardQuitActionForApplication

public static EOAction standardQuitActionForApplication()

Returns a shared action (an EOAction object) for the quit method. When this action triggers, it is dispatched to the EOApplication at the top of the controller hierarchy. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardRedoActionForControllerHierarchy

public static EOAction standardRedoActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the redo method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the edit action priority so the action is grouped with the other edit actions.

standardRefreshActionForApplication

public static EOAction standardRefreshActionForApplication()

Returns a shared action (an EOAction object) for the refresh method. When this action triggers, it is dispatched to the EOApplication at the top of the controller hierarchy. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardRemoveActionForControllerHierarchy

public static EOAction standardRemoveActionForControllerHierarchy()

The action's category priority is the document action priority so the action is grouped with the other document actions.Returns a shared action (an EOAction object) for the remove method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it.

standardRevertActionForControllerHierarchy

public static EOAction standardRevertActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the revert method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardSaveActionForControllerHierarchy

public static EOAction standardSaveActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the save method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardSaveAllActionForApplication

public static EOAction standardSaveAllActionForApplication()

Returns a shared action (an EOAction object) for the saveAll method. When this action triggers, it is dispatched to the EOApplication at the top of the controller hierarchy. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardSelectActionForControllerHierarchy

public static EOAction standardSelectActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the select method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the document action priority so the action is grouped with the other document actions.

standardUndoActionForControllerHierarchy

public static EOAction standardUndoActionForControllerHierarchy()

Returns a shared action (an EOAction object) for the undo method. When the action triggers, it is dispatched to the subcontrollers of the controller that displays it. The action's category priority is the edit action priority so the action is grouped with the other edit actions.


Instance Methods



actionCanBePerformedInContextOfController

public boolean actionCanBePerformedInContextOfController(EOController controller)

Returns whether or not an action can trigger, which depends on the state of controllers in the controller hierarchy. For example, a Save action for an unedited document can not trigger.

actionName

public String actionName()

Returns the name of the method that executes when the receiver triggers.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent actionEvent)

This method is called when an action is triggered, that is, the user presses the action's button or selects its menu item.

actionPriority

public int actionPriority()

Returns the receiver's action priority, which determines the order in which its button or menu item appears within a category.

See Also: categoryPriority



actionTitle

public String actionTitle()

Returns the receiver's title, the last component of the receiver's description path.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

See the method description for addPropertyChangeListener in Sun's documentation for javax.swing.AbstractAction.

categoryPriority

public int categoryPriority()

Returns the receiver's category priority, which determines the order in which the group of buttons or menu items that contains the receiver appears.

descriptionPath

public String descriptionPath()

Returns the receiver's menu hierarchy path. For example, the Quit menu item description path is Document/Quit.

descriptionPathComponents

public NSArray descriptionPathComponents()

Returns an NSArray containing the separate components of the receiver's menu hierarchy path.

equals

public boolean equals(Object anObject)

Indicates whether some object "is equal to" this one.

firePropertyChange

protected void firePropertyChange( String propertyName, Object oldValue, Object newValue)

See the method description for firePropertyChange in Sun's documentation for javax.swing.AbstractAction.

icon

public javax.swing.Icon icon()

Returns the receiver's icon.

menuAccelerator

public javax.swing.KeyStroke menuAccelerator()

Returns the KeyStroke the user can type to invoke the receiver instead of selecting it from the menu.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

See the method description for removePropertyChangeListener in Sun's documentation for javax.swing.AbstractAction.

setActionName

public void setActionName(String actionName)

Sets the name of the method that executes when the receiver triggers.

setActionPriority

public void setActionPriority(int actionPriority)

Sets the receiver's action priority, which determines the order in which its button or menu item appears within a category.

setCategoryPriority

public void setCategoryPriority(int categoryPriority)

Returns the receiver's category priority, which determines the order in which the group of buttons or menu items containing the receiver appears.

setDescriptionPath

public void setDescriptionPath(String descriptionPath)

Sets the receiver's menu hierarchy path to descriptionPath.

setIcon

public void setIcon(javax.swing.Icon icon)

Sets the receiver's icon to icon.

setMenuAccelerator

public void setMenuAccelerator(javax.swing.KeyStroke menuAccelerator)

Sets the KeyStroke the user can type to invoke the receiver instead of selecting it from a menu.

See Also: keyStrokeWithKeyCode, keyStrokeWithKeyCodeAndModifiers, keyStrokeWithKeyCodeAndShiftModifier, and keyStrokeWithString.



setShortDescription

public void setShortDescription(String shortDescription)

Sets the action's short description to shortDescription. The short description appears in buttons and menu items. If shortDescription is null, the receiver's title is displayed instead.

See Also: actionTitle



setSmallIcon

public void setSmallIcon(javax.swing.Icon anIcon)

Sets the receiver's small icon used for some small buttons in the user interface (the Select button in a Form window's to-one relationship editor is an example).

shortDescription

public String shortDescription()

Returns the receiver's short description, which is displayed in buttons and menu items. If the short description is set to null or has not been assigned, shortDescription returns the action's title.

See Also: actionTitle



smallIcon

public javax.swing.Icon smallIcon()

Returns the receiver's small icon used for some small buttons in the user interface (the Select button in a Form window's to-one relationship editor is an example). By default, the small icon is not displayed for such buttons; the short description is displayed instead.

See Also: shortDescription



toString

public String toString()

Returns the receiver as a string that states the receiver's method name, description path, category priority, and action priority.

© 2001 Apple Computer, Inc. (Last Published April 14, 2001)


Table of Contents