WebObjects 5.2.3

com.webobjects.eointerface
Class EOWidgetAssociation

java.lang.Object
  extended bycom.webobjects.eocontrol.EODelayedObserver
      extended bycom.webobjects.eointerface.EOAssociation
          extended bycom.webobjects.eointerface.EOWidgetAssociation
All Implemented Interfaces:
EOObserving, NSDisposable
Direct Known Subclasses:
EOActionWidgetAssociation, EOTableAssociation, EOTableColumnAssociation, EOTreeAssociation, EOValueAssociation, EOValueSelectionAssociation

public abstract class EOWidgetAssociation
extends EOAssociation

The EOWidgetAssociation is the superclass for all associations that connect to user interface widgets. Because associations are meant to be widget-set independent, EOWidgetAssociations manage their UI widgets through the help of EOWidgetAssociation.WidgetPlugin concrete subclasses. Each EOWidgetAssociation has a related abstract plugin class. Concrete plugin implementations handle communicating with widgets in a platform specific way. For instance, the EOCocoaButtonPlugin reacts to actions on Cocoa NSButtons, while the EOSwingButtonPlugin reacts to events from javax.swing.JButtons. The abstraction the widget-plugins provide allows for an identical set of EOAssociations for both Cocoa/EOF and Java Client applications.

Widget plugins are automatically created for EOWidgetAssociations based on the widget the association is set up to work with. In order to know what kind of plugin to create, EOInterface keeps a registry of whcih plugins should be created for any pairing of an association and a widget. This registry is held in the EOWidgetPluginRegistry.

See Also:
EOWidgetPluginRegistry

Nested Class Summary
static class EOWidgetAssociation.WidgetPlugin
          WidgetPlugin is an abstract superclass for plugins that provide a layer of abstraction between user interface widgets and EOWidgetAssociation subclasses.
 
Field Summary
 
Fields inherited from class com.webobjects.eointerface.EOAssociation
ActionAspect, ArgumentAspect, AttributeAspectSignature, AttributeToManyAspectSignature, AttributeToOneAspectSignature, AttributeToOneToManyAspectSignature, BackgroundColorAspect, BoldAspect, ChildrenAspect, DestinationAspect, EnabledAspect, ExpandedIconAspect, IconAspect, IgnoreValue, IsLeafAspect, ItalicAspect, MatchKey1Aspect, MatchKey2Aspect, MatchKey3Aspect, NullAspectSignature, ParentAspect, RootAspect, SelectedIndexAspect, SelectedObjectAspect, SelectedTitleAspect, SetValue, SourceAspect, TextColorAspect, TitlesAspect, ToManyAspectSignature, ToOneAspectSignature, ToOneToManyAspectSignature, UnsetValue, URLAspect, ValueAspect
 
Fields inherited from class com.webobjects.eocontrol.EODelayedObserver
ObserverNumberOfPriorities, ObserverPriorityFifth, ObserverPriorityFirst, ObserverPriorityFourth, ObserverPriorityImmediate, ObserverPriorityLater, ObserverPrioritySecond, ObserverPrioritySixth, ObserverPriorityThird
 
Constructor Summary
EOWidgetAssociation(Object aDisplayObject)
          Used by subclasses of EOWidgetAssociation to initialize data structures and set aDisplayObject as the display object that the association manages.
 
Method Summary
 boolean canSupportValueFormatter()
          Returns whether or not this association supports setting a value formatter on its plugin or display object.
static boolean defaultPrefersContinuousChangeNotification()
          Returns the default value for the class preference for continuous change notification.
 void dispose()
          Clears all references this association has to other objects especially its display object and EODisplayGroup.
 boolean isUsableWithObject(Object aDisplayObject)
          Returns true if aDisplayObject is usable with the association.
 NSArray objectKeysTaken()
          Overridden by subclasses to return the names of display object outlets that instances assume control of.
 boolean prefersContinuousChangeNotification()
          Returns whether or not the receiver should be notified of every change made to its display object.
static void setDefaultPrefersContinuousChangeNotification(boolean flag)
          Sets the default preference for continuous change notification for all new instances of the association.
 void setObject(Object object)
          See the setObject method description in the superclass EOAssociation.
 void setPrefersContinuousChangeNotification(boolean flag)
          Sets whether or not the receiver should be notified of every change made to its display object.
 void setValueFormatter(Object format)
          Attempts to set format as the formatter object for this association's display object.
 Object valueFormatter()
          Returns the object used to format values in the association's display object.
 EOWidgetAssociation.WidgetPlugin widgetPlugin()
           
protected  Class widgetPluginClass()
          Returns the Class of widget plugin that this association requires for operation.
 
Methods inherited from class com.webobjects.eointerface.EOAssociation
aspects, aspectSignatures, associationClassesForObject, bindAspect, breakConnection, copyMatchingBindingsFromAssociation, displayGroupForAspect, displayGroupKeyForAspect, endEditing, establishConnection, isConnected, isEnabled, isEnabledAtIndex, isExplicitlyDisabled, object, primaryAspect, priority, registerAssociationClass, setExplicitlyDisabled, setValueForAspect, setValueForAspectAtIndex, shouldEndEditing, shouldEndEditingAtIndex, subjectChanged, valueForAspect, valueForAspectAtIndex
 
Methods inherited from class com.webobjects.eocontrol.EODelayedObserver
discardPendingNotification, objectWillChange, observerQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EOWidgetAssociation

public EOWidgetAssociation(Object aDisplayObject)
Used by subclasses of EOWidgetAssociation to initialize data structures and set aDisplayObject as the display object that the association manages.

Parameters:
aDisplayObject - display object for this association to manage; subclasses should call their super class's constructor and pass in aDisplayObject
Method Detail

canSupportValueFormatter

public boolean canSupportValueFormatter()
Returns whether or not this association supports setting a value formatter on its plugin or display object.

Returns:
true if the association has a widget plugin and it implements EOWidgetAssociation.WidgetPlugin.Formatting; false otherwise

defaultPrefersContinuousChangeNotification

public static boolean defaultPrefersContinuousChangeNotification()
Returns the default value for the class preference for continuous change notification.

Returns:
true if the preference set by default in new instances for continuous change notification is true; false otherwise
See Also:
prefersContinuousChangeNotification(), setDefaultPrefersContinuousChangeNotification(boolean)

dispose

public void dispose()
Clears all references this association has to other objects especially its display object and EODisplayGroup. Call this method before nulling out a reference to this association to ensure it gets garbage collected properly. Subclasses should override this method to do any additional cleanup that may be needed and invoke super's implementation at the end.

Specified by:
dispose in interface NSDisposable
Overrides:
dispose in class EOAssociation
See Also:
NSDisposable

isUsableWithObject

public boolean isUsableWithObject(Object aDisplayObject)
Returns true if aDisplayObject is usable with the association.

Overrides:
isUsableWithObject in class EOAssociation
Parameters:
aDisplayObject - object this method should verify is usable with the association
Returns:
true if a widget plugin can be found that works with aDisplayObject, and if either the plugin found is a subclass of the class returned by widgetPluginClass, or if widgetPluginClass returns null; false otherwise
See Also:
EOAssociation.isUsableWithObject(java.lang.Object)

objectKeysTaken

public NSArray objectKeysTaken()
Overridden by subclasses to return the names of display object outlets that instances assume control of. Interface Builder uses this information to disable connections from these outlets in its Connections Inspector.

Overrides:
objectKeysTaken in class EOAssociation
Returns:
EOWidgetAssociation's implementation returns the the key taken by its widget plugin, or if there is no plugin for this associaion, returns an empty NSArray

prefersContinuousChangeNotification

public boolean prefersContinuousChangeNotification()
Returns whether or not the receiver should be notified of every change made to its display object. If the preference has not been changed using the setPrefersContinuousChangeNotification method, the result will be the same as the defaultPrefersContinuousChangeNotification result.

Returns:
true if the receiver wants to be notified every time a change has been made to its display object; false otherwise

setDefaultPrefersContinuousChangeNotification

public static void setDefaultPrefersContinuousChangeNotification(boolean flag)
Sets the default preference for continuous change notification for all new instances of the association.

Parameters:
flag - if true, all new instances of the association will, by default, be notified every time a change has been made to its display object; if false, by default, only once editing has ended in the display object will the association receive a notification

setObject

public void setObject(Object object)
See the setObject method description in the superclass EOAssociation.

Overrides:
setObject in class EOAssociation
Parameters:
object - the object for the association to manage
See Also:
EOAssociation.setObject(java.lang.Object)

setPrefersContinuousChangeNotification

public void setPrefersContinuousChangeNotification(boolean flag)
Sets whether or not the receiver should be notified of every change made to its display object.

Parameters:
flag - if true, the receiver will be notified every time a change has been made to its display object; if false, only once editing has ended in the display object will the association receive a notification

setValueFormatter

public void setValueFormatter(Object format)
Attempts to set format as the formatter object for this association's display object. If the association's widget plugin is null or it doesn't implement the EOWidgetAssociation.WidgetPlugin.Formatting interface, this method throws an IllegalStateException.

Parameters:
format - object to use to format values in the association's display object

valueFormatter

public Object valueFormatter()
Returns the object used to format values in the association's display object. If the association's widget plugin is null or it doesn't implement the EOWidgetAssociation.WidgetPlugin.Formatting interface, this method throws an IllegalStateException.

Returns:
object used to format values in the association's display object

widgetPlugin

public EOWidgetAssociation.WidgetPlugin widgetPlugin()
Returns:
the association's widget plugin object

widgetPluginClass

protected Class widgetPluginClass()
Returns the Class of widget plugin that this association requires for operation. Subclasses should override this method to return the Class of plugin they require in order to work. (For example EOActionWidgetAsssociation requires a plugin class of EOActionWidgetAssociation.ActionPlugin).

Returns:
EOWidgetAssociation.WidgetPlugin

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

Copyright © 2004 Apple Computer, Inc.