| 
 | WebObjects 5.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
  |
  +--com.webobjects.eocontrol.EODelayedObserver
        |
        +--com.webobjects.eointerface.EOAssociation
              |
              +--com.webobjects.eointerface.EOWidgetAssociation
                    |
                    +--com.webobjects.eointerface.EOValueSelectionAssociation
EOValueSelectionAssociation displays an attribute or to-one relationship value in a display object that offers the user multiple choices and the option of choosing just one of those choices. This association is typically used with pop-up lists, drop down menus, combo boxes, or radio matrices.
The value
 displayed in the display object can be set manually in
 Interface Builder or in the case of a relationship, constructed
 dynamically from values supplied by the destination entity's 
 EODisplayGroup. The value displayed in the display object can
 be bound by one of three aspects: selectedTitle, which is useful
 for values representable as strings; selectedIndex, for integer
 values; and selectedObject, for the destination object of
 a relationship.
Usable with:
 com.webobjects.eointerface.swing: javax.swing.JComboBox and
 its subclasses.
 com.webobjects.eointerface.cocoa: NSComboBox, NSPopUpButton,
 NSRadioMatrix, and their subclasses.
Aspects:
| titles | An attribute of the objects in an EODisplayGroup whose values can be represented as strings. | 
| selectedTitle | An attribute of the selected object whose values can be represented as strings. | 
| selectedTag | An integer attribute of the selected object. | 
| selectedObject | A to-one relationship of the selected object; the value displayed is that for the attribute bound to the titles aspect. | 
| enabled | A boolean attribute of the selected object, which determines whether the display object is enabled. | 
Examples:
There are several basic ways to configure, for example, a combo box and it's association. They are described below.Suppose you have a Movie display group and you want to provide
 a pop-up list for setting the rating from a static list of strings.
 In this example, a Movie object's rating is a string property 
 rather than a relationship to a Rating object. To do this, in
 Interface Builder, type the list of ratings into the pop-up list.
 Control-drag a connection from the pop-up list to the Movie display
 group. Choose EOValueSelectionAssociation in the Connections inspector, and
 bind the selectedTitle aspect to the "rating" key. With this
 configuration, if an object's string attribute value isn't in the
 pop-up list, it's temporarily added while the object is selected.
This example is similar to the previous one, except in this example,
 a Movie object's rating is chosen from strings in a Rating database
 table. There's a Rating EODisplayGroup that fetches the ratings 
 into Rating objects, and the pop-up list is filled from the
 "ratingString" property of the rating display group's Rating objects. 
 To do this, in Interface Builder, Control-drag a connection from
 the pop-up list to the Ratings display group. Choose
 EOValueSelectionAssociation in the Connections inspector, and bind the
 titles aspect to the "ratingString" key. Similarly, Control-drag
 a connection from the pop-up list to the Movie display group.
 Again choose EOComboBoxAssociation in the Connections inspector,
 and bind the selectedTitle aspect to the "rating" key.
Suppose you have a Customer enterprise object whose credit card
 type (Visa, MasterCard, and so on) is indicated by an integer
 tag. You want a user to be able to choose a customer's card type
 from a pop-up list. To do this, in Interface Builder, set the
 credit card names and tags for the pop-up list. Control-drag a
 connection from the pop-up list to the Customer display group.
 Choose EOValueSelectionAssociation in the Connections inspector, and bind
 the selectedTag aspect to the "cardType" key.
Suppose you have a list of employees and want to assign each
 employee a department. In terms of the object model, you want
 to assign a Department object as the destination of an Employee
 object's department relationship. To do this, in Interface Builder, 
 Control-drag a connection from the pop-up list to a Department
 display group. Choose EOComboBoxAssociation in the Connections
 inspector, and bind the titles aspect to the "name" key. Similarly,
 Control-drag a connection from the pop-up list to the Employee
 display group. Again choose EOComboBoxAssociation in the Connections
 inspector, and bind the selectedObject to the "department" key.
 This fills the pop-up list with the names of departments, and
 causes the name of the selected Employee's Department to be 
 selected in the pop-up list.
| Inner Class Summary | |
| static class | EOValueSelectionAssociation.ValueSelectionPluginValueSelectionPlugin communicates with a UI widget on behalf of a EOValueSelectionAssociation. | 
| Inner classes inherited from class com.webobjects.eointerface.EOWidgetAssociation | 
| EOWidgetAssociation.WidgetPlugin | 
| Fields inherited from class com.webobjects.eocontrol.EODelayedObserver | 
| ObserverNumberOfPriorities, ObserverPriorityFifth, ObserverPriorityFirst, ObserverPriorityFourth, ObserverPriorityImmediate, ObserverPriorityLater, ObserverPrioritySecond, ObserverPrioritySixth, ObserverPriorityThird | 
| Constructor Summary | |
| EOValueSelectionAssociation(Object object)Creates a new EOValueSelectionAssociation to monitor and update the values in aDisplayObject. | |
| Method Summary | |
|  void | bindAspect(String aspect,
           EODisplayGroup displayGroup,
           String key)Defines the receiver's link between its display object and displayGroup. | 
|  boolean | endEditing()See the endEditingmethod description in the
 superclass EOAssociation. | 
|  String | primaryAspect()Overridden by subclasses to return the default aspect, usually one denoting the displayed value, which by convention is named "value". | 
|  void | subjectChanged()See the subjectChangedmethod description in the
 superclass EOAssociation. | 
| protected  Class | widgetPluginClass()See the widgetPluginClassmethod description in the
 superclass EOWidgetAssociation. | 
|  boolean | widgetSelectionDidChange()Invoked by the association's plugin when the selection in the display object changes. | 
| 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.eocontrol.EODelayedObserver | 
| discardPendingNotification, objectWillChange, observerQueue | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public EOValueSelectionAssociation(Object object)
You normally set up associations with the Interface Builder application, 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.
object - user interface widget for this association to connect to| Method Detail | 
public void bindAspect(String aspect,
                       EODisplayGroup displayGroup,
                       String key)
displayGroup. aspect is the name of the
 aspect it observes in its display object, and key is the name of the property it observes in aEODisplayGroup.
 Invoke establishConnection after this method to finish setting up the binding.bindAspect in class EOAssociationaspect - String that specifies what key of this association should be used to bind to
				EnterpriseObjects valuesdisplayGroup - EODisplayGroup object to bind this association tokey - String specifying which property of the EOs in the display group
				should be used when setting values for aspectpublic boolean endEditing()
endEditing method description in the
 superclass EOAssociation. If ending editing fails, and the
 selected object aspect is bound, invokes
 associationFailedToValidateValue on the selected object
 display group.endEditing in class EOAssociationtrue if editing in the display object ended
          successful, false if notpublic String primaryAspect()
EOAssociationnull.primaryAspect in class EOAssociationEOAssociation.primaryAspect()public void subjectChanged()
subjectChanged method description in the
 superclass EOAssociation.subjectChanged in class EOAssociationEOAssociation.subjectChanged()protected Class widgetPluginClass()
widgetPluginClass method description in the
 superclass EOWidgetAssociation.widgetPluginClass in class EOWidgetAssociationEOWidgetAssociation.widgetPluginClass()public boolean widgetSelectionDidChange()
true if setting the new selection value in the display
         group succeeds, false otherwise| 
 | Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||