PATH |
- Inherits from:
- EODelayedObserver (EOControl) : Object
- Implements:
- NSDisposable
- EOObserving (EOControl)
- Package:
- com.webobjects.eointerface
An EOAssociation maintains a two-way binding between the properties of a display object, such as a text field or combo box, and the properties of one or more enterprise objects contained in one or more EODisplayGroups. You typically create and configure associations in Interface Builder, using the programmatic interface only when you write your own EOAssociation subclasses.
EOAssociation defines the mechanism that transfers values between EODisplayGroups and the user interface of an application. An EOAssociation instance is tied to a single display object, a user interface object or other kind of object that manages values intended for display. The EOAssociation takes over certain outlets of the display object and sets its value according to the selection in the EODisplayGroup. An EOAssociation also has various aspects, which define the different parameters of the display object that it controls, such as the value or values displayed and whether the display object is enabled or editable. Each aspect can be bound to an EODisplayGroup with a key denoting a property of the enterprise objects in the EODisplayGroup. The value or values of this property determine the value for the EOAssociation's aspect.
EOAssociation is an abstract class, defining only the general mechanism for binding display objects to EODisplayGroups. You always create instances of its various subclasses, which define behavior specific to different kinds of display objects. For information on the different EOAssociation subclasses you can use, see the following subclass specifications:
com.webobjects.eointerface.cocoa | |
EOCocoaButtonPlugin | EOCocoaSimpleTextPlugin |
EOCocoaCheckBoxPlugin | EOCocoaTableColumnPlugin |
EOCocoaComboBoxPlugin | EOCocoaTableViewPlugin |
EOCocoaImageViewPlugin | EOCocoaTextFieldPlugin |
EOCocoaPopUpButtonPlugin | EOCocoaTextPlugin |
EOCocoaRadioMatrixPlugin |
com.webobjects.eointerface.swing | |
EOSwingButtonPlugin | EOSwingQuickTimeViewPlugin |
EOSwingCheckBoxPlugin | EOSwingTableColumnPlugin |
EOSwingComboBoxPlugin | EOSwingTablePlugin |
EOSwingImageViewPlugin | EOSwingTextPlugin |
You normally set up EOAssociations using Interface Builder; each of the class specifications for EOAssociation's subclasses provide an example using Interface Builder to set them up. EOAssociation's programmatic interface is more important when defining custom EOAssociation subclasses. For more information on EOAssociations, see the sections:
EOAssociation defines the following String constants to identify the names of association aspects:
- NSDisposable
- dispose
- EOObserving
- All methods
- EOAssociation
- associationClassesForObject
- registerAssociationClass
- aspectSignatures
- aspects
- bindAspect
- breakConnection
- copyMatchingBindingsFromAssociation
- displayGroupForAspect
- displayGroupKeyForAspect
- endEditing
- establishConnection
- isConnected
- isEnabled
- isEnabledAtIndex
- isExplicitlyDisabled
- isUsableWithObject
- object
- objectKeysTaken
- primaryAspect
- priority
- setExplicitlyDisabled
- setObject
- setValueForAspect
- setValueForAspectAtIndex
- shouldEndEditing
- shouldEndEditingAtIndex
- subjectChanged
- valueForAspect
- valueForAspectAtIndex
public EOAssociation(Object anObject)
public static NSArray associationClassesForObject(Object anObject)
public static void registerAssociationClass(Class aClass)
public NSArray aspectSignatures()
Constant | The Aspect Can Be Bound to |
AttributeAspectSignature | Attributes |
AttributeToOneAspectSignature | Attributes and to-one relationships |
AttributeToManyAspectSignature | Attributes and to-many relationships |
AttributeToOneToManyAspectSignature | Attributes, to-one relationships, and to-many relationships |
ToOneAspectSignature | To-one relationships |
ToOneToManyAspectSignature | To-one and to-many relationships |
ToManyAspectSignature | To-many relationships |
NullAspectSignature | An EODisplayGroup without a key (the key is irrelevant). |
Interface Builder uses aspect signatures to enable and disable keys in its Connections inspectors.
EOAssociation's implementation of this method returns an array of AttributeToOneToManyAspectSignature
strings.
public NSArray aspects()
public void bindAspect( String aspectName, EODisplayGroup anEODisplayGroup, String key )
public void breakConnection()
See Also: establishConnection
public void copyMatchingBindingsFromAssociation(EOAssociation anEOAssociation)
public EODisplayGroup displayGroupForAspect(String aspectName)
See Also: displayGroupKeyForAspect
public String displayGroupKeyForAspect(String aspectName,)
See Also: displayGroupForAspect
public void dispose()
public boolean endEditing()
Subclasses whose display objects immediately pass their changes back to the EOAssociation-such as a button or pop-up list-need not override this method. It's only needed when the display object's value is edited rather than simply set.
EOAssociation's implementation does nothing but return true.
public void establishConnection()
See "Setting up an EOAssociation Programmatically" (page 43) in the class description for more information.
public boolean isConnected()
protected boolean isEnabled()
false
if the receiver has explicitly disabled its display object or if the receiver's EnabledAspect
(if bound) resolves to false
; true
otherwise.
protected boolean isEnabledAtIndex(int index)
false
if the receiver has explicitly disabled its display object or if the receiver's EnabledAspect
(if bound) resolves to false
for index; true
otherwise.
public boolean isExplicitlyDisabled()
true
if the receiver has explicitly disabled its display object, false
otherwise.
public boolean isUsableWithObject(Object anObject)
public Object object()
public NSArray objectKeysTaken()
public String primaryAspect()
public int priority()
public void setExplicitlyDisabled(boolean flag)
public void setObject(Object anObject)
public boolean setValueForAspect( Object value, String aspectName)
See Also: valueForAspect
public boolean setValueForAspectAtIndex( Object value, String aspectName, int index)
See Also: valueForAspectAtIndex
public boolean shouldEndEditing( String aspectName, String inputString, String errorDescription)
For example, an association bound to an NSControl object (Cocoa) receives a controlDidFailToFormatStringErrorDescription delegate message when the control's formatter fails to format the input string. Its implementation of that method invokes shouldEndEditing.
public boolean shouldEndEditingAtIndex( String aspectName, String inputString, String errorDescription, int index)
public void subjectChanged()
public Object valueForAspect(String aspectName)
See Also: setValueForAspect
public Object valueForAspectAtIndex( String aspectName, int index)
See Also: valueForAspectAtIndex
© 2001 Apple Computer, Inc. (Last Published April 21, 2001)