WebObjects 5.2

com.webobjects.eointerface.cocoa
Class EOCocoaComboBoxPlugin

java.lang.Object
  |
  +--com.webobjects.eointerface.EOWidgetAssociation.WidgetPlugin
        |
        +--com.webobjects.eointerface.EOValueSelectionAssociation.ValueSelectionPlugin
              |
              +--com.webobjects.eointerface.cocoa.EOCocoaComboBoxPlugin
All Implemented Interfaces:
EOWidgetAssociation.WidgetPlugin.Formatting, NSDisposable

public class EOCocoaComboBoxPlugin
extends EOValueSelectionAssociation.ValueSelectionPlugin
implements EOWidgetAssociation.WidgetPlugin.Formatting

EOCocoaComboBoxPlugin is used in Cocoa applications to connect combo boxes to value selection associations. This plugin handles setting the list of items in the combo box on behalf of its association and handles reporting the selection index to its association. You can populate the combo box list by hand in Interface Builder. In that case, do not bind the titles aspect of this plugin's association. When the user changes the selection of the combo box in the interface, this plugin invokes its association's widgetSelectionDidChange method.

Object Keys Taken: target, action

When the user chooses an item in the display object, the EOValueSelectionAssociation updates the selected object's property with the item's title, tag, or object.

Usage:
Association classes: EOValueSelectionAssociation
Widget classes: NSComboBox


Inner classes inherited from class com.webobjects.eointerface.EOWidgetAssociation.WidgetPlugin
EOWidgetAssociation.WidgetPlugin.Formatting
 
Fields inherited from class com.webobjects.eointerface.EOValueSelectionAssociation.ValueSelectionPlugin
NoSelection
 
Constructor Summary
EOCocoaComboBoxPlugin(EOWidgetAssociation association, Object widget)
          Creates a new EOCocoaComboBoxPlugin for use with association and widget.
 
Method Summary
 void breakConnection()
          Tells the plugin to halt communication with its NSComboBox object.
 void establishConnection()
          Establishes a connection between the plugin and its UI widget.
 int selectionIndex()
           
 void setSelectionIndex(int selectionIndex, boolean enabled)
          Selects the item at selectionIndex in this plugin's comboBox list.
 void setTitlesFromObjects(Object[] objects)
          Sets the combo box list to the items of objects.
 void setValueFormatter(Object formatter)
          Sets the formatter used to format values in the interface.
 String[] titles()
          Returns a String array of titles that the plugin's widget currently displays Only invoked if EOAssociation.SelectedTitleAspect bound.
 Object valueFormatter()
          Returns the formatter object of the receiver.
 String[] widgetKeysTaken()
          Returns an array of Strings which represent outlet names in Interface Builder.
 
Methods inherited from class com.webobjects.eointerface.EOWidgetAssociation.WidgetPlugin
association, dispose, unacceptableAspects, widget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EOCocoaComboBoxPlugin

public EOCocoaComboBoxPlugin(EOWidgetAssociation association,
                             Object widget)
Creates a new EOCocoaComboBoxPlugin for use with association and widget.
Parameters:
association - EOValueSelectionAssociation for this plugin to communicate with
widget - the NSComboBox object for this plugin to manage
Method Detail

breakConnection

public void breakConnection()
Tells the plugin to halt communication with its NSComboBox object. This makes sure that actions from the NSComboBox don't get to this plugin.
Overrides:
breakConnection in class EOWidgetAssociation.WidgetPlugin

establishConnection

public void establishConnection()
Establishes a connection between the plugin and its UI widget. This makes sure that actions from the NSComboBox are sent to this plugin.
Overrides:
establishConnection in class EOWidgetAssociation.WidgetPlugin

selectionIndex

public int selectionIndex()
Overrides:
selectionIndex in class EOValueSelectionAssociation.ValueSelectionPlugin
Returns:
index of the item selected in this plugin's combo box list

setSelectionIndex

public void setSelectionIndex(int selectionIndex,
                              boolean enabled)
Selects the item at selectionIndex in this plugin's comboBox list.
Overrides:
setSelectionIndex in class EOValueSelectionAssociation.ValueSelectionPlugin
Parameters:
selectionIndex - index of the item to select in this plugin's combo box list
enabled - if true, the combo box is enabled in the interface; if false, the combo box is disabled and the user cannot change the combo box's selected item.

setTitlesFromObjects

public void setTitlesFromObjects(Object[] objects)
Sets the combo box list to the items of objects. This method is only invoked if EOAssociation.TitlesAspect bound in the plugin's association.
Overrides:
setTitlesFromObjects in class EOValueSelectionAssociation.ValueSelectionPlugin
Parameters:
objects - array of objects to use to populate the list of items in the plugin's combo box

setValueFormatter

public void setValueFormatter(Object formatter)
Sets the formatter used to format values in the interface. In Cocoa, formatters should be set on the combo box in your nib file using Interface Builder.
Specified by:
setValueFormatter in interface EOWidgetAssociation.WidgetPlugin.Formatting
Parameters:
formatter - NSFormatter used to format values in the interface

titles

public String[] titles()
Description copied from class: EOValueSelectionAssociation.ValueSelectionPlugin
Returns a String array of titles that the plugin's widget currently displays Only invoked if EOAssociation.SelectedTitleAspect bound. Even if titles are derived from setTitlesFromObjects, returns the actual strings displayed
Overrides:
titles in class EOValueSelectionAssociation.ValueSelectionPlugin
Returns:
array of String objects displayed to the user in the combo box list

valueFormatter

public Object valueFormatter()
Description copied from interface: EOWidgetAssociation.WidgetPlugin.Formatting
Returns the formatter object of the receiver.
Specified by:
valueFormatter in interface EOWidgetAssociation.WidgetPlugin.Formatting
Returns:
NSFormatter used to format values in the interface

widgetKeysTaken

public String[] widgetKeysTaken()
Returns an array of Strings which represent outlet names in Interface Builder. These outlets are disabled by Interface Builder once the combo box is connected to this plugin's association.

EOCocoaComboBoxPlugin takes over outlets with keys "delegate" and "dataSource".

Overrides:
widgetKeysTaken in class EOWidgetAssociation.WidgetPlugin
Returns:
String array of outlet names

Last updated Fri Feb 21 13:15:00 PST 2003.

Copyright © 2003 Apple Computer, Inc.