PATH |
EOAssociation
- Inherits from:
- EODelayedObserver (EOControl) : Object
- Implements:
- NSDisposable
- EOObserving (EOControl)
- Package:
- com.webobjects.eointerface
Class at a Glance
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.
Principal Attributes
- A display object (such as a text field or combo box)
- Aspects that control different parameters of the display object (such as value and enabled)
- One or more EODisplayGroups (no more than one per aspect)
- One or more keys (enteprise object properties) (as many as one key per aspect)
Class Description
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:
- "How EOAssociations Work" (page 41)
- "Setting up an EOAssociation Programmatically" (page 43)
- "Creating a Subclass of EOAssociation" (page 44)
Constants
EOAssociation defines the following String constants to identify the names of association aspects:
Interfaces Implemented
- NSDisposable
- dispose
- EOObserving
Method Types
- 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
Constructors
EOAssociation
public EOAssociation(Object anObject)
Static Methods
associationClassesForObject
public static NSArray associationClassesForObject(Object anObject)
registerAssociationClass
public static void registerAssociationClass(Class aClass)
Instance Methods
aspectSignatures
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.
aspects
public NSArray aspects()
bindAspect
public void bindAspect( String aspectName, EODisplayGroup anEODisplayGroup, String key )
breakConnection
public void breakConnection()
See Also: establishConnection
copyMatchingBindingsFromAssociation
public void copyMatchingBindingsFromAssociation(EOAssociation anEOAssociation)
displayGroupForAspect
public EODisplayGroup displayGroupForAspect(String aspectName)
See Also: displayGroupKeyForAspect
displayGroupKeyForAspect
public String displayGroupKeyForAspect(String aspectName,)
See Also: displayGroupForAspect
dispose
public void dispose()
endEditing
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.
establishConnection
public void establishConnection()
See "Setting up an EOAssociation Programmatically" (page 43) in the class description for more information.
isConnected
public boolean isConnected()
isEnabled
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.
isEnabledAtIndex
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.
isExplicitlyDisabled
public boolean isExplicitlyDisabled()
true
if the receiver has explicitly disabled its display object, false
otherwise.
isUsableWithObject
public boolean isUsableWithObject(Object anObject)
object
public Object object()
objectKeysTaken
public NSArray objectKeysTaken()
primaryAspect
public String primaryAspect()
priority
public int priority()
setExplicitlyDisabled
public void setExplicitlyDisabled(boolean flag)
setObject
public void setObject(Object anObject)
setValueForAspect
public boolean setValueForAspect( Object value, String aspectName)
See Also: valueForAspect
setValueForAspectAtIndex
public boolean setValueForAspectAtIndex( Object value, String aspectName, int index)
See Also: valueForAspectAtIndex
shouldEndEditing
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.
shouldEndEditingAtIndex
public boolean shouldEndEditingAtIndex( String aspectName, String inputString, String errorDescription, int index)
subjectChanged
public void subjectChanged()
valueForAspect
public Object valueForAspect(String aspectName)
See Also: setValueForAspect
valueForAspectAtIndex
public Object valueForAspectAtIndex( String aspectName, int index)
See Also: valueForAspectAtIndex
© 2001 Apple Computer, Inc. (Last Published April 21, 2001)