com.webobjects.eointerface
Class EOActionAssociation
java.lang.Object
|
+--com.webobjects.eocontrol.EODelayedObserver
|
+--com.webobjects.eointerface.EOAssociation
|
+--com.webobjects.eointerface.EOWidgetAssociation
|
+--com.webobjects.eointerface.EOActionWidgetAssociation
|
+--com.webobjects.eointerface.EOActionAssociation
- All Implemented Interfaces:
- EOObserving, NSDisposable
- public class EOActionAssociation
- extends EOActionWidgetAssociation
An EOActionAssociation object allows you to set up an interface
object, such as a button, to send a message to the Enterprise Objects
selected in the association's display group when the interface
object is acted on.
Usable with:
com.webobjects.eointerface.swing
: Any object that implements
the method addActionListener
(javax.swing.JButton
and
javax.swing.JMenuItem
, for example).
com.webobjects.eointerface.cocoa
: NSControl, NSActionCell,
and their subclasses.
Aspects:
action | Bound to a key that names the method to invoke
on the selected objects. If the argument aspect
isn't bound, the method must take no arguments.
If the argument aspect is bound, then the
method must take exactly one argument. |
argument | An object attribute or relationship of the
selected object, passed as an argument to
the action method. (Usually bound to a different
EODisplayGroup than the one bound to action.) |
enabled | A boolean attribute of the selected object,
which determines whether the display object is enabled. |
Examples:
Suppose you have an application that manages member accounts, each
of which has a restriction on the outstanding balance allowed. You
want a user to be able to increase the restriction limit by
selecting one or more members and then clicking a button. To do
this, you define a boostRestrictions
method in the Member class that
increases the limit by 20%. In Interface Builder, control-drag a
connection from the button to the Member display group. Select
EOActionAssociation in the Connections inspector, and bind the
association's action
aspect to the "boostRestrictions" key.
In another scenario, one EODisplayGroup shows Members, while another
shows video tapes available for rent. Here, you want a user to be
able to select a member, select a video tape, and then click a Rent
button that checks the selected tape out to the selected member. To
do this, define a rentVideoTape
method in the Member class that
takes a VideoTape as an argument and handles the accounting involved
in a video rental. Then, in Interface Builder, control-drag a
connection from the button to the Members display group. Select
EOActionAssociation in the Connections inspector, and bind the
association's action
aspect to Member's rentVideoTape action.
Similarly, control-drag a connection from the button to the
VideoTape display group. Select EOActionAssociation in the
Connections inspector, and bind the association's argument
aspect
to the VideoTape display group. Now, when the user selects a Member,
selects a VideoTape, and clicks the button, the selected Member is
sent a rentVideoTape
message with the selected VideoTape.
Fields inherited from class com.webobjects.eointerface.EOAssociation |
ActionAspect, ArgumentAspect, AttributeAspectSignature, AttributeToManyAspectSignature, AttributeToOneAspectSignature, AttributeToOneToManyAspectSignature, BackgroundColorAspect, BoldAspect, ChildrenAspect, DestinationAspect, EnabledAspect, ExpandedIconAspect, IconAspect, IgnoreValue, IsLeafAspect, ItalicAspect, MatchKey1Aspect, MatchKey2Aspect, MatchKey3Aspect, NullAspectSignature, ParentAspect, RootAspect, SelectedIndexAspect, SelectedObjectAspect, SelectedTitleAspect, SetValue, SourceAspect, TextColorAspect, TitlesAspect, ToManyAspectSignature, ToOneAspectSignature, ToOneToManyAspectSignature, UnsetValue, URLAspect, ValueAspect |
Constructor Summary |
EOActionAssociation(Object object)
Creates a new EOActionAssociation to monitor and update the value
in aDisplayObject , typically a button or menu item. |
Method Summary |
protected boolean |
displayGroupSelectionsAllowEnabled()
Returns whether or not the set of selected items in the action display group
allows for this association to perform its action. |
void |
invokeAction()
Invoked by the receiver's plugin when its display
object is acted upon. |
String |
primaryAspect()
Returns the primary aspect this association
gets bound to. |
Methods inherited from class com.webobjects.eointerface.EOWidgetAssociation |
canSupportValueFormatter, defaultPrefersContinuousChangeNotification, dispose, isUsableWithObject, objectKeysTaken, prefersContinuousChangeNotification, setDefaultPrefersContinuousChangeNotification, setObject, setPrefersContinuousChangeNotification, setValueFormatter, valueFormatter, widgetPlugin |
Methods inherited from class com.webobjects.eointerface.EOAssociation |
aspects, aspectSignatures, associationClassesForObject, bindAspect, breakConnection, copyMatchingBindingsFromAssociation, displayGroupForAspect, displayGroupKeyForAspect, endEditing, establishConnection, isConnected, isExplicitlyDisabled, object, priority, registerAssociationClass, setExplicitlyDisabled, setValueForAspect, setValueForAspectAtIndex, shouldEndEditing, shouldEndEditingAtIndex, valueForAspect, valueForAspectAtIndex |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EOActionAssociation
public EOActionAssociation(Object object)
- Creates a new EOActionAssociation to monitor and update the value
in
aDisplayObject
, typically a button or menu item.
You normally set up associations in Interface Builder, in which
case you don't need to create them programmatically. However,
if you do create them up programmatically, setting them up is a
multi-step process. After creating an association, you must bind
its aspects and establish its connections.
- Parameters:
aDisplayObject
- display object for this association to manage- See Also:
EOAssociation.bindAspect(java.lang.String, com.webobjects.eointerface.EODisplayGroup, java.lang.String)
,
EOAssociation.establishConnection()
displayGroupSelectionsAllowEnabled
protected boolean displayGroupSelectionsAllowEnabled()
- Returns whether or not the set of selected items in the action display group
allows for this association to perform its action. If
true
, then the action
can be invoked, otherwise nothing will happen when the invokeAction
method is
called on this association.
- Overrides:
displayGroupSelectionsAllowEnabled
in class EOActionWidgetAssociation
- Returns:
true
if the action display group selection is
not empty and either the argument aspect is not bound
or the argument display group selection is not empty; false
otherwise
invokeAction
public void invokeAction()
- Invoked by the receiver's plugin when its display
object is acted upon. Sends the method identified
by the receiver's action aspect (with an argument,
if the argument aspect is bound) to the selected objects.
- Overrides:
invokeAction
in class EOActionWidgetAssociation
primaryAspect
public String primaryAspect()
- Returns the primary aspect this association
gets bound to.
- Overrides:
primaryAspect
in class EOAssociation
- Returns:
- EOAssociaion.ActionAspect
Copyright © 2003 Apple Computer, Inc.