|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eocontrol.EODelayedObserver com.webobjects.eointerface.EOAssociation
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:
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.
Constants
EOAssociation defines the following String constants to
identify the names of association aspects:
ActionAspect | NullAspectSignature |
ArgumentAspect | ParentAspect |
AttributeAspectSignature | SelectedIndexAspect |
AttributeToManyAspectSignature | SelectedObjectAspect |
AttributeToOneAspectSignature | SelectedTitleAspect |
AttributeToOneToManyAspectSignature | SourceAspect |
BackgroundColorAspect | TextColorAspect |
BoldAspect | TitlesAspect |
DestinationAspect | ToManyAspectSignature |
EnabledAspect | ToOneAspectSignature |
ItalicAspect | ToOneToManyAspectSignature |
MatchKey1Aspect | URLAspect |
MatchKey2Aspect | ValueAspect |
MatchKey3Aspect |
Field Summary | |
static String |
ActionAspect
String value of the Action aspect |
static String |
ArgumentAspect
String value of the Argument aspect |
static String |
AttributeAspectSignature
String signature of a Attribute aspect. |
static String |
AttributeToManyAspectSignature
String signature of a Attribute To Many aspect. |
static String |
AttributeToOneAspectSignature
String signature of a Attribute To One aspect. |
static String |
AttributeToOneToManyAspectSignature
String signature of a Attribute To One To Many aspect. |
static String |
BackgroundColorAspect
String value of the Background Color aspect |
static String |
BoldAspect
String value of the Bold aspect |
static String |
ChildrenAspect
String value of the Children aspect |
static String |
DestinationAspect
String value of the Destination aspect |
static String |
EnabledAspect
String value of the Enabled aspect |
static String |
ExpandedIconAspect
String value of the ExpandedIconAspect aspect |
static String |
IconAspect
String value of the IconAspect aspect |
static int |
IgnoreValue
Used to indicate that an aspect value has not been set to a usable value. |
static String |
IsLeafAspect
String value of the IsLeaf aspect |
static String |
ItalicAspect
String value of the Italic aspect |
static String |
MatchKey1Aspect
String value of the MatchKey1 aspect |
static String |
MatchKey2Aspect
String value of the MatchKey2 aspect |
static String |
MatchKey3Aspect
String value of the MatchKey3 aspect |
static String |
NullAspectSignature
String signature of a Null aspect. |
static String |
ParentAspect
String value of the Parent aspect |
static String |
RootAspect
String value of the Root aspect |
static String |
SelectedIndexAspect
String value of the Selected Index aspect |
static String |
SelectedObjectAspect
String value of the Selected Object aspect |
static String |
SelectedTitleAspect
String value of the Selected Title aspect |
static int |
SetValue
Used to indicate that an aspect value has been set to a true/enabled value. |
static String |
SourceAspect
String value of the Source aspect |
static String |
TextColorAspect
String value of the Text Color aspect |
static String |
TitlesAspect
String value of the Titles aspect |
static String |
ToManyAspectSignature
String signature of a To Many aspect. |
static String |
ToOneAspectSignature
String signature of a To One aspect. |
static String |
ToOneToManyAspectSignature
String signature of a To One To Many Aspect aspect. |
static int |
UnsetValue
Used to indicate that an aspect value has been set to a false/inactive value. |
static String |
URLAspect
String value of the URL aspect |
static String |
ValueAspect
String value of the Value aspect |
Fields inherited from class com.webobjects.eocontrol.EODelayedObserver |
ObserverNumberOfPriorities, ObserverPriorityFifth, ObserverPriorityFirst, ObserverPriorityFourth, ObserverPriorityImmediate, ObserverPriorityLater, ObserverPrioritySecond, ObserverPrioritySixth, ObserverPriorityThird |
Constructor Summary | |
EOAssociation(Object aDisplayObject)
Used by subclasses of EOAssociation to initialize data structures and set aDisplayObject as the display object
that the association manages. |
Method Summary | |
NSArray |
aspects()
Overridden by subclasses to return the names of the receiving class's aspects as an array of string objects. |
NSArray |
aspectSignatures()
Overridden by subclasses to return the signatures of the receiver's aspects, an array of string objects matching its aspects array index for index. |
static NSArray |
associationClassesForObject(Object object)
Finds all EOAssociation subclasses that can be used with the specified display object. |
void |
bindAspect(String aspect,
EODisplayGroup displayGroup,
String key)
Defines the receiver's link between its display object and an EODisplayGroup. |
void |
breakConnection()
Removes the receiver from its EODisplayGroup and display object. |
void |
copyMatchingBindingsFromAssociation(EOAssociation source)
Binds this association's aspects to the same display group(s) as the source EOAssociation. |
EODisplayGroup |
displayGroupForAspect(String aspect)
|
String |
displayGroupKeyForAspect(String aspect)
|
void |
dispose()
Clears all references this association has to other objects, especially its display object and EODisplayGroup. |
boolean |
endEditing()
Overridden by subclasses to pass the value of the receiver's display object to the EODisplayGroup, by invoking setValueForAspect
with the display object's value and the appropriate aspect (typically
value). |
void |
establishConnection()
Overridden by subclasses to attach this association to the outlets of its display object and to otherwise configure the display object (such as by setting its action method). |
boolean |
isConnected()
Checks whether or not the association is connected and ready for use. |
protected boolean |
isEnabled()
|
protected boolean |
isEnabledAtIndex(int index)
|
boolean |
isExplicitlyDisabled()
|
boolean |
isUsableWithObject(Object object)
Overridden by subclasses to return whether or not the recieving instance will work with anObject. |
Object |
object()
Returns the receiver's display object. |
NSArray |
objectKeysTaken()
Overridden by subclasses to return the names of display object outlets that instances assume control of. |
String |
primaryAspect()
Overridden by subclasses to return the default aspect, usually one denoting the displayed value, which by convention is named "value". |
int |
priority()
Returns the receiver's change notification priority. |
static void |
registerAssociationClass(Class associationClass)
Registers associationClass with the EOAssociation class
map. |
void |
setExplicitlyDisabled(boolean flag)
Sets according to flag whether or not the association is explicitly
disabled. |
void |
setObject(Object aDisplayObject)
Sets aDisplayObject to be the display object that the association
manages. |
boolean |
setValueForAspect(Object value,
String aspect)
Sets value in the selected enterprise object in the EODisplayGroup
bound to aspect . |
boolean |
setValueForAspectAtIndex(Object value,
String aspect,
int index)
Sets a value of the enterprise object at index in the EODisplayGroup
bound to aspect . |
boolean |
shouldEndEditing(String aspect,
String invalidInput,
String errorDescription)
Invoked by subclasses when the display object fails to validate its input, this method informs the EODisplayGroup bound to aspect
with an associationFailedToValidateValue message, using the display
group's selected object. |
boolean |
shouldEndEditingAtIndex(String aspect,
String invalidInput,
String errorDescription,
int index)
Works in the same manner as shouldEndEditing , but allows you to
specify a particular object by index rather than implicitly specifying
the selected object. |
void |
subjectChanged()
Overridden by subclasses to update state based on when an EODisplayGroup's selection or contents changes. |
Object |
valueForAspect(String aspect)
Returns a value of the selected enterprise object in the EODisplayGroup bound to aspect . |
Object |
valueForAspectAtIndex(String aspect,
int index)
Returns a value of the enterprise object at index in the EODisplayGroup
bound to aspect . |
Methods inherited from class com.webobjects.eocontrol.EODelayedObserver |
discardPendingNotification, objectWillChange, observerQueue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String ActionAspect
public static final String ArgumentAspect
public static final String AttributeAspectSignature
public static final String AttributeToManyAspectSignature
public static final String AttributeToOneAspectSignature
public static final String AttributeToOneToManyAspectSignature
public static final String BackgroundColorAspect
public static final String BoldAspect
public static final String ChildrenAspect
public static final String DestinationAspect
public static final String EnabledAspect
public static final String ExpandedIconAspect
public static final String IconAspect
public static int IgnoreValue
public static final String IsLeafAspect
public static final String ItalicAspect
public static final String MatchKey1Aspect
public static final String MatchKey2Aspect
public static final String MatchKey3Aspect
public static final String NullAspectSignature
public static final String ParentAspect
public static final String RootAspect
public static final String SelectedIndexAspect
public static final String SelectedObjectAspect
public static final String SelectedTitleAspect
public static int SetValue
public static final String SourceAspect
public static final String TextColorAspect
public static final String TitlesAspect
public static final String ToManyAspectSignature
public static final String ToOneAspectSignature
public static final String ToOneToManyAspectSignature
public static final String URLAspect
public static int UnsetValue
public static final String ValueAspect
Constructor Detail |
public EOAssociation(Object aDisplayObject)
aDisplayObject
as the display object
that the association manages.
aDisplayObject
- display object for this association.
to manage; subclasses should call their super class's
constructor and pass in aDisplayObject
Method Detail |
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) |
public NSArray aspects()
public static NSArray associationClassesForObject(Object object)
object
- display object to attempt to find a matching EOAssociation for
anObject
public void bindAspect(String aspect, EODisplayGroup displayGroup, String key)
aspect
to key
in displayGroup
. Passing a null key unbinds
the aspect, and attempting to bind an invalid aspect or one of a
connected Association throws an exception. Invoke establishConnection
after
this method to finish setting up the binding.
aspect
- name of the aspect it observes in its display objectdisplayGroup
- EODisplayGroup that will be the target of this bindingkey
- name of the property it observes in aEODisplayGrouppublic void breakConnection()
public void copyMatchingBindingsFromAssociation(EOAssociation source)
source
- EOAssociation object to use as the source for bindings to copy;
source
should not be nullpublic EODisplayGroup displayGroupForAspect(String aspect)
aspect
- name of aspect of interest
aspect
,
or null
if there is no such objectdisplayGroupKeyForAspect(java.lang.String)
public String displayGroupKeyForAspect(String aspect)
aspect
- name of aspect of interest
aspect
,
or null
if there's no EODisplayGroupdisplayGroupForAspect(java.lang.String)
public void dispose()
Subclasses should override this method to do any additional cleanup that may be needed and invoke super's implementation at the end.
dispose
in interface NSDisposable
NSDisposable
public boolean endEditing()
setValueForAspect
with the display object's value and the appropriate aspect (typically
value). 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.
true
public void establishConnection()
IllegalStateException
- if the association has no display objectpublic boolean isConnected()
true
if connected, false
if notprotected boolean isEnabled()
false
if this association has explicitly disabled its display
object or if this association's enabled aspect (if bound) resolves
to false
; true
otherwiseprotected boolean isEnabledAtIndex(int index)
index
- index of object in the EODisplayGroup of the enabled aspect's
binding
false
if this association has explicitly disabled its display
object or if this association's enabled aspect (if bound) resolves
to false
for index
; true
otherwise.public boolean isExplicitlyDisabled()
true
if the receiver has explicitly disabled its display
object, false
otherwisepublic boolean isUsableWithObject(Object object)
anObject
such as its
class, configuration (such as whether an NSMatrix operates in radio
mode), and so on.
object
- object to examine for usability with the association
true
if the receiver
is usable with anObject
, false
otherwise,
default implementation always returns false
public Object object()
public NSArray objectKeysTaken()
public String primaryAspect()
null
.
null
public int priority()
priority
in class EODelayedObserver
EODelayedObserver.ObserverPriorityImmediate
,
EODelayedObserver.ObserverPriorityFirst
,
EODelayedObserver.ObserverPrioritySecond
,
EODelayedObserver.ObserverPriorityThird
,
EODelayedObserver.ObserverPriorityFourth
,
EODelayedObserver.ObserverPriorityFifth
,
EODelayedObserver.ObserverPrioritySixth
,
EODelayedObserver.ObserverPriorityLater
,
EODelayedObserverQueue
,
EODelayedObserver
public static void registerAssociationClass(Class associationClass)
associationClass
with the EOAssociation class
map. Once an association class is registered, using the
correct object argument, it can be
found by the associationClassesForObject
method.
associationClass
- the EOAssociation subclass to register
an
- IllegalArgumentException if associationClass
is null
or not a subclass of EOAssociationpublic void setExplicitlyDisabled(boolean flag)
flag
whether or not the association is explicitly
disabled. An association is "explicitly disabled" when the display
object shouldn't be editable, such as in the case where the display
object simply displays the results of a search.
flag
- if true
, then the association is explicitly disabled
should ignore edits from its display object and/or set the display
object to be not editable if possible.public void setObject(Object aDisplayObject)
aDisplayObject
to be the display object that the association
manages.
aDisplayObject
- the object for the association to manage
an
- IllegalStateException
if the association is
already connected when this method is invoked. Throws an
IllegalArgumentException
if aDisplayObject
is not usable
with the association (if isUsableWithObject
returns false
).public boolean setValueForAspect(Object value, String aspect)
value
in the selected enterprise object in the EODisplayGroup
bound to aspect
. Retrieves the display group and key bound to
aspect
, and sends the display group a setSelectedObjectValue
message with value
and the key as arguments.
value
- value to set in the selected object of the association's
display groupaspect
- key for which the association's display group
is bound
true
if successful, or if there's no display group
bound to aspect; false
if there's an display group
and it doesn't accept the new valuevalueForAspect(java.lang.String)
public boolean setValueForAspectAtIndex(Object value, String aspect, int index)
index
in the EODisplayGroup
bound to aspect
. Retrieves the display group and key bound to
aspect
, and sends the display group a setValueForObjectAtIndex
message with value
, index
, and the key
as arguments.
value
- value to set in the selected object of the association's
display groupaspect
- key for which the association's display group
is boundindex
- index of the object in the association's display
group to set value on
true
if successful, or if there's no display group
bound to aspect
; false
if there's an display group
and it doesn't accept the new value.valueForAspectAtIndex(java.lang.String, int)
public boolean shouldEndEditing(String aspect, String invalidInput, String errorDescription)
aspect
with an associationFailedToValidateValue
message, using the display
group's selected object. Returns the result of that message, or
true if there's no display group.
For example, an association's plugin 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
.
aspect
- key for which the association is bound to its
display groupinvalidInput
- the String value of the invalid inputerrorDescription
- description of the validation error
displayGroup.associationFailedToValidateValue
or
true
if there is no display grouppublic boolean shouldEndEditingAtIndex(String aspect, String invalidInput, String errorDescription, int index)
shouldEndEditing
, but allows you to
specify a particular object by index rather than implicitly specifying
the selected object.
aspect
- key for which the association is bound to its
display groupinvalidInput
- the String value of the invalid inputerrorDescription
- description of the validation errorindex
- index of object in the association's display group on
which value could not be set
displayGroup.associationFailedToValidateValue
or
true
if there is no display group.public void subjectChanged()
subjectChanged
in class EODelayedObserver
public Object valueForAspect(String aspect)
aspect
. Retrieves the display group and key bound to
aspect
and sends the display group a selectedObjectValueForKey
message with the key.
aspect
- key with which the association is bound to its
display group
null
if there is no display group or key bound to aspect
setValueForAspect(java.lang.Object, java.lang.String)
public Object valueForAspectAtIndex(String aspect, int index)
index
in the EODisplayGroup
bound to aspect
. Retrieves the display group and key bound to
aspect
, and sends the display group a valueForObjectAtIndex
message with index
and the key.
index
- index of object in the association's display group
from which to get a valueaspect
- key with which the association is bound to its
display group
null
if there is no display group or key bound to aspectsetValueForAspectAtIndex(java.lang.Object, java.lang.String, int)
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |