PATH |
- Inherits from:
- EOValueSelectionAssociation.ValueSelectionPlugin (EOInterface) : EOWidgetAssociation.WidgetPlugin (EOInterface) : Object
- Implements:
- java.awt.event.ActionListener
- EOWidgetAssociation.WidgetPlugin.Formatting (EOInterface)
- NSDisposable
- Package:
- com.webobjects.eointerface.swing
An EOSwingComboBoxPlugin object displays an attribute or to-one relationship value in an JComboBox. The items in the combo box can be entered manually, or for a relationship, constructed dynamically from values supplied by an EODisplayGroup. EOSwingComboBoxPlugin is very similar to the EOSwingPopUpButtonPlugin.
There are three basic ways to configure a combo box and it's association. Each is described below.
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. Choose EOSwingComboBoxPlugin in the Connections inspector, and bind the selectedTitle aspect to the "rating" key.
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. Choose EOSwingComboBoxPlugin in the Connections inspector, and bind the titles aspect to the "ratingString" key. Similarly, control-drag a connection from the combo box to the Movie display group. Again choose EOSwingComboBoxPlugin in the Connections inspector, and bind the selectedTitle aspect to the "rating" 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 combo box to a Department display group. Choose EOSwingComboBoxPlugin in the Connections inspector, and bind the titles aspect to the "name" key. Similarly, control-drag a connection from the combo box to the Employee display group. Again choose EOSwingComboBoxPlugin in the Connections inspector, 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.
- NSDisposable
- EOWidgetAssociation.WidgetPlugin.Formatting
- setValueFormatter
- valueFormatter
- java.awt.event.ActionListener
- actionPerformed
- All methods
- EOSwingComboBoxPlugin
- breakConnection
- establishConnection
- selectionIndex
- setSelectionIndex
- setTitlesFromObjects
- titles
- widgetKeysTaken
public EOSwingComboBoxPlugin( com.webobjects.eointerface.EOWidgetAssociation anEOWidgetAssociation, Object widget)
public void actionPerformed(java.awt.event.ActionEvent anActionEvent)
public void breakConnection()
public void establishConnection()
public int selectionIndex()
public void setSelectionIndex( int selectionIndex, boolean enabled)
public void setTitlesFromObjects(Object[] objects)
public void setValueFormatter(Object formatter)
public String[] titles()
public Object valueFormatter()
public String[] widgetKeysTaken()
© 2001 Apple Computer, Inc. (Last Published April 21, 2001)