WebObjects 5.2.3

com.webobjects.eointerface.cocoa
Class EOCocoaCheckBoxPlugin

java.lang.Object
  extended bycom.webobjects.eointerface.EOWidgetAssociation.WidgetPlugin
      extended bycom.webobjects.eointerface.EOValueAssociation.ValuePlugin
          extended bycom.webobjects.eointerface.cocoa.EOCocoaCheckBoxPlugin
All Implemented Interfaces:
NSDisposable

public class EOCocoaCheckBoxPlugin
extends EOValueAssociation.ValuePlugin

EOCocoaCheckBoxPlugin is used in Cocoa applications to connect check box buttons and button cells to value associations. Check boxes in Cocoa are buttons with an "on" state and an "off" state. This plugin handles setting the state of the checkbox on behalf of its value association and handles reporting the checkbox state to its value association as a Boolean. When the user changes the state of the check box in the interface, this plugin invokes its association's widgetDidChange 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: EOValueAssociation
Widget classes: NSButton, NSButtonCell


Nested Class Summary
 
Nested classes inherited from class com.webobjects.eointerface.EOWidgetAssociation.WidgetPlugin
EOWidgetAssociation.WidgetPlugin.Formatting
 
Constructor Summary
EOCocoaCheckBoxPlugin(EOWidgetAssociation association, Object widget)
          Creates a new EOCocoaCheckBoxPlugin for use with association and widget.
 
Method Summary
 void breakConnection()
          Tells the plugin to halt communication with its NSButton object.
 void establishConnection()
          Establishes a connection between the plugin and its UI widget.
 void setValue(Object value, boolean isEnabled)
          Sets the state of this plugin's checkbox based on value and isEnabled.
 Object value()
          Returns a Boolean object representing the state of this plugin's checkbox.
 String[] widgetKeysTaken()
          Returns an array of Strings which represent outlet names in Interface Builder.
 
Methods inherited from class com.webobjects.eointerface.EOValueAssociation.ValuePlugin
endEditing, useURLAsValue
 
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

EOCocoaCheckBoxPlugin

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

Parameters:
association - EOValueAssociation for this plugin to communicate with
widget - the UI widget for this plugin to manage
Method Detail

breakConnection

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

Overrides:
establishConnection in class EOWidgetAssociation.WidgetPlugin

setValue

public void setValue(Object value,
                     boolean isEnabled)
Sets the state of this plugin's checkbox based on value and isEnabled. If value is a Boolean object whose boolean value returns true, or if value is a Number object that does not represent 0, the checkbox will be checked ("on" state), otherwise, the check box will remain unchecked ("off" state). If value is any other type or null, the checkbox will be left in the default "off" state.

Specified by:
setValue in class EOValueAssociation.ValuePlugin
Parameters:
value - Object to use in setting the state of this plugin's checkbox.
isEnabled - if true, the checkbox will be enabled in the interface so its value can be changed; otherwise, the checkbox will be disabled

value

public Object value()
Returns a Boolean object representing the state of this plugin's checkbox.

Specified by:
value in class EOValueAssociation.ValuePlugin
Returns:
true if the checkbox is checked, false otherwise.

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 checkbox is connected to this plugins association.

EOCocoaCheckBoxPlugin takes over outlets with keys "action" and "target".

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.