PATH |
- Inherits from:
- EOValueSelectionAssociation.ValueSelectionPlugin (EOInterface) : EOWidgetAssociation.WidgetPlugin (EOInterface) : Object
- Implements:
- EOWidgetAssociation.WidgetPlugin.Formatting
- (EOInterface)
- NSDisposable
- Package:
- com.webobjects.eointerface.cocoa
An EOCocoaPopUpButtonPlugin object displays an attribute or to-one relationship value in an NSPopUpButton (Cocoa).
The items in the NSPopUpButton can be entered manually, or for a relationship, constructed dynamically from values supplied by the destination entity's EODisplayGroup. The value displayed by the NSPopUpButton 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 |
NSPopUpButton (Cocoa) |
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. |
selectedIndex |
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 NSPopUpButton is enabled. |
Object Keys Taken | |
target |
When the user chooses an item in the pop-up list, the EOPopUpAssociation updates the selected object's property with the item's title, tag, or object. |
There are several basic ways to configure 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. Then 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. Then bind the titles
aspect to the "ratingString" key. Similarly, control-drag a connection from the pop-up list to the Movie display group, 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. Then bind the selectedIndex
aspect to the "cardType" key. You can also allow for a general "other" value by defining a special tag and setting it in the EOCocoaPopUpButtonPlugin. Credit card tags from the database not matching any in the pop-up list are then displayed as the "other" value. (It would also make sense to disable the pop-up list in this case, to avoid writing the meaningless tag back to the database.)
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. Then bind the titles
aspect to the "name" key. Similarly, control-drag a connection from the pop-up list to the Employee display group, 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.
- NSDisposable
- dispose
- EOWidgetAssociation.WidgetPlugin.Formatting
- setValueFormatter
- valueFormatter
- All methods
- EOCocoaPopUpButtonPlugin
- breakConnection
- establishConnection
- selectionIndex
- setSelectionIndex
- setTitlesFromObjects
- titles
- widgetKeysTaken
public EOCocoaPopUpButtonPlugin( com.webobjects.eointerface.EOWidgetAssociation anEOWidgetAssociation, Object widget)
public void breakConnection()
public void dispose()
public void establishConnection()
public int selectionIndex()
public void setSelectionIndex( int value, boolean isEnabled)
public void setTitlesFromObjects(Object[] objects[])
public void setValueFormatter(Object anObject)
public String[] titles()
public Object valueFormatter()
public String[] widgetKeysTaken()
© 2001 Apple Computer, Inc. (Last Published April 21, 2001)