PATH Documentation > WebObjects

Table of Contents

EOCocoaComboBoxPlugin


Inherits from:
EOValueSelectionAssociation.ValueSelectionPlugin (EOInterface) : EOWidgetAssociation.WidgetPlugin (EOInterface) : Object
Implements:
EOWidgetAssociation.WidgetPlugin.Formatting
(EOInterface)
NSDisposable
Package:
com.webobjects.eointerface.cocoa


Class Description


An EOCocoaComboBoxPlugin object displays an attribute or to-one relationship value in an NSComboBox (Cocoa). The items in the combo box can be entered manually, or for a relationship, constructed dynamically from values supplied by an EODisplayGroup. EOCocoaComboBoxPlugin is very similar to the EOCocoaPopUpButtonPlugin.


Usable With
NSComboBox (com.apple.cocoa.application.NSComboBox)


Aspects
titles Property of the enterprise objects in an EODisplayGroup that supplies the titles for the items in the combo box list.
selectedTitle String property of the enterprise object supplying the title to display in the combo box. When the value of the combo box changes either because a new value is typed in or a selection is made using the pop up menu, the new text value is assigned to this property.
selectedObject Relationship property of the enterprise object containing the enterprise object to select from the titles EODisplayGroup. selectedObject is usually mutually exclusive with selectedTitle. When the value of the combo box changes, the association updates the relationship to point to the new object.
enabled A boolean attribute of the selected object that determines whether the combo box is enabled.


Object Keys Taken
dataSource When the NSComboBox requests values for its list, the EOCocoaComboBoxPlugin provides them by querying the appropriate EODisplayGroup or groups.
delegate An EOCocoaComboBoxPlugin accepts the message comboBoxSelectionDidChange.


Examples

There are three basic ways to configure a combo box and it's association. Each is described below.


Selecting a String from a Static List

Suppose you have a Movie display group and you want to provide a combo box 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 combo box. Control-drag a connection from the combo box to the Movie display group. Then bind the selectedTitle aspect to the "rating" key.


Selecting a String from a Dynamic List

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 combo box 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 combo box to the Ratings display group. Then bind the titles aspect to the "ratingString" key. Similarly, control-drag a connection from the combo box to the Movie display group, and bind the selectedTitle aspect to the "rating" key.


Selecting the Destination of a To-One Relationship

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 combo box to a Department display group. Then bind the titles aspect to the "name" key. Similarly, control-drag a connection from the combo box to the Employee display group, and bind the selectedObject to the "department" key.

If the selectedObject aspect is bound and the user types a value that doesn't match any of those currently in the list, an error panel is displayed.




Interfaces Implemented


NSDisposable
dispose
EOWidgetAssociation.WidgetPlugin.Formatting
setValueFormatter
valueFormatter


Method Types


All methods
EOCocoaComboBoxPlugin
breakConnection
establishConnection
selectionIndex
setSelectionIndex
setTitlesFromObjects
titles
widgetKeysTaken


Constructors



EOCocoaComboBoxPlugin

public EOCocoaComboBoxPlugin( com.webobjects.eointerface.EOWidgetAssociation anEOWidgetAssociation, Object widget)

Description forthcoming.


Instance Methods



breakConnection

public void breakConnection()

See the breakConnection method description in the superclass EOAssociation.

dispose

public void dispose()

See the description in the documentation for NSDisposable.

establishConnection

public void establishConnection()

See the establishConnection method description in the superclass (EOAssociation).

selectionIndex

public int selectionIndex()

Description forthcoming.

setSelectionIndex

public void setSelectionIndex( int selectionIndex, boolean enabled)

Description forthcoming.

setTitlesFromObjects

public void setTitlesFromObjects(Object[] objects[])

Description forthcoming.

setValueFormatter

public void setValueFormatter(Object formatter)

Description forthcoming.

titles

public String[] titles()

Description forthcoming.

valueFormatter

public Object valueFormatter()

Description forthcoming.

widgetKeysTaken

public String[] widgetKeysTaken()

Description forthcoming.

© 2001 Apple Computer, Inc. (Last Published April 21, 2001)


Table of Contents