WebObjects 5.2.3

com.webobjects.eointerface.cocoa
Class EOCocoaPopUpButtonPlugin

java.lang.Object
  extended bycom.webobjects.eointerface.EOWidgetAssociation.WidgetPlugin
      extended bycom.webobjects.eointerface.EOValueSelectionAssociation.ValueSelectionPlugin
          extended bycom.webobjects.eointerface.cocoa.EOCocoaPopUpButtonPlugin
All Implemented Interfaces:
NSDisposable

public class EOCocoaPopUpButtonPlugin
extends EOValueSelectionAssociation.ValueSelectionPlugin

EOCocoaPopUpButtonPlugin is used in Cocoa applications to connect pop-up buttons to value selection associations. This plugin handles setting the list of items in the pop-up buttons on behalf of its association and handles reporting the selection index to its association.

You can populate the pop-up button's 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 pop-up button 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: NSPopUpButton


Nested Class Summary
 
Nested classes inherited from class com.webobjects.eointerface.EOWidgetAssociation.WidgetPlugin
EOWidgetAssociation.WidgetPlugin.Formatting
 
Field Summary
 
Fields inherited from class com.webobjects.eointerface.EOValueSelectionAssociation.ValueSelectionPlugin
NoSelection
 
Constructor Summary
EOCocoaPopUpButtonPlugin(EOWidgetAssociation association, Object widget)
          Creates a new EOCocoaPopUpButtonPlugin for use with association and widget.
 
Method Summary
 void breakConnection()
          Tells the plugin to halt communication with its NSPopUpButton object.
 void establishConnection()
          Establishes a connection between the plugin and its UI widget.
 int selectionIndex()
          Returns the index of the item selected in this plugin's pop-up button list.
 void setSelectionIndex(int selectionIndex, boolean enabled)
          Selects the item at selectionIndex in this plugin's pop-up button list.
 void setTitlesFromObjects(Object[] objects)
          Sets the pop-up button list to the items of objects.
 String[] titles()
          Returns the array of Strings used in the pop-up button list.
 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

EOCocoaPopUpButtonPlugin

public EOCocoaPopUpButtonPlugin(EOWidgetAssociation association,
                                Object widget)
Creates a new EOCocoaPopUpButtonPlugin for use with association and widget.

Parameters:
association - EOValueSelectionAssociation for this plugin to communicate with
widget - the NSPopUpButton object for this plugin to manage
Method Detail

breakConnection

public void breakConnection()
Tells the plugin to halt communication with its NSPopUpButton object. This makes sure that actions from the NSPopUpButton 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 NSPopUpButton are sent to this plugin.

Overrides:
establishConnection in class EOWidgetAssociation.WidgetPlugin

selectionIndex

public int selectionIndex()
Returns the index of the item selected in this plugin's pop-up button list.

Specified by:
selectionIndex in class EOValueSelectionAssociation.ValueSelectionPlugin
Returns:
index of the item selected in this plugin's pop-up button list

setSelectionIndex

public void setSelectionIndex(int selectionIndex,
                              boolean enabled)
Selects the item at selectionIndex in this plugin's pop-up button list.

Specified by:
setSelectionIndex in class EOValueSelectionAssociation.ValueSelectionPlugin
Parameters:
selectionIndex - index of the item to select in this plugin's pop-up button list
enabled - if true, the pop-up button is enabled in the interface; if false, the combo box is disabled and the user cannot change the pop-up button's selected item

setTitlesFromObjects

public void setTitlesFromObjects(Object[] objects)
Sets the pop-up button list to the items of objects. This method is only invoked if EOAssociation.TitlesAspect is bound in the plugin's association.

Specified by:
setTitlesFromObjects in class EOValueSelectionAssociation.ValueSelectionPlugin
Parameters:
objects - array of objects to use to populate the list of items in the plugin's pop-up button

titles

public String[] titles()
Returns the array of Strings used in the pop-up button list.

Specified by:
titles in class EOValueSelectionAssociation.ValueSelectionPlugin
Returns:
array of String objects displayed to the user in the pop-up button list

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 pop-up button is connected to this plugins association.

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.

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

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.