home *** CD-ROM | disk | FTP | other *** search
/ NeXT Enterprise Objects Framework 1.1 / NeXT Enterprise Objects Framework 1.1.iso / NextDeveloper / Headers / eointerface / EOController.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-04  |  22.9 KB  |  558 lines

  1. // EOController.h
  2. // Enterprise Objects Framework
  3. // Copyright (c)1993, NeXT Computer, Inc. All rights reserved.
  4.  
  5.  
  6. #ifdef SHLIB
  7. #import "shlib.h"
  8. #endif
  9.  
  10. #import    <foundation/NSDictionary.h>
  11. #import    <eoaccess/eoaccess.h>
  12.  
  13. @class EOAssociation;
  14.  
  15.  
  16. // EOController uses EOAssociations to direct the movement of data between the
  17. // user interface and a source of data-bearing objects, ensuring that what
  18. // appears on screen is consistent with data in the objects.
  19.  
  20.  
  21. @interface EOController : NSObject
  22. {
  23. @private    
  24.     NSMutableArray *associations;
  25.     NSMutableArray *saveStack;
  26.     NSMutableArray *dataSourceStack;
  27.     NSMutableArray *undoStack;
  28.     NSMutableArray *undoMarkers;
  29.     id <EODataSources> dataSource;
  30.     NSMutableArray *objectArray;
  31.     id delegate;
  32.     id nextController;
  33.     NSMutableArray *selection;
  34.     struct {
  35.     int savesToObjectsAutomatically:1;
  36.     int savesToDataSourceAutomatically:1;
  37.     int marksEveryOperation:1;
  38.     int isUndoEnabled:1;
  39.     int selectsFirstObjectAfterFetch:1;
  40.     int associationNotification:16;
  41.     int _reserved:12;
  42.     } flags;
  43.     id undoScope;
  44.  
  45.     // Used for debugging.
  46.     NSArray *_sortOrdering;
  47.     void *_extras;        // id _saveStackText;
  48.     void *_reserved;
  49.  
  50.     unsigned int maximumUndoMarks;
  51.     NSMutableArray *_failureStack;
  52. }
  53.  
  54. - initWithDataSource:(id <EODataSources>)dataSource;
  55.     // Initializes a newly allocated EOController to get its data from objects
  56.     // provided by dataSource.
  57.  
  58. - (void)setDelegate:aDelegate;
  59. - delegate;
  60.     // These methods set/return the controller's delegate.
  61.  
  62. - (NSArray *)keys;
  63.     // Returns an array containing the keys used by all the associations for
  64.     // this controller.
  65.  
  66. - setNextController:(EOController *)aController;
  67. - (EOController *)nextController;
  68.     // These methods are used for chaining controllers together.  Chained
  69.     // controllers propagate fetch, saveToObjects, saveToDataSource, and
  70.     // redisplay.
  71.  
  72. - (void)addAssociation:(EOAssociation *)anAssociation;
  73.     // Adds anAssociation to the set managed by the controller.
  74.  
  75. - (void)removeAssociation:(EOAssociation *)anAssociation;
  76.     // Removes anAssociation from the set managed by the controller.
  77.  
  78. - (NSArray *)associations;
  79.     // Returns the controller's associations.
  80.  
  81. - (void)disableAssociationNotification;
  82. - (void)reenableAssociationNotification;
  83.     // Enable or disable sending of EOAssociationNotification messages.
  84.     // Messages are sent by default.  These messages nest (one reenable
  85.     // must be sent for every disable).
  86.  
  87. - (BOOL)isDiscardAllowed;
  88.     // If there are any edits that haven't been saved to the objects sends
  89.     // -controllerWillDiscardEdits: to the delegate.  If the delegate doesn't
  90.     // implement this method the controller opens an alert panel asking the
  91.     // user if it's okay to discard edits.  Then if there are any operations
  92.     // not flushed to the data source the controller sends
  93.     // -controllerWillDiscardUpdates: to the delegate.  Again, if the delegate
  94.     // doesn't implement this method the controller opens an alert panel
  95.     // asking the user to confirm.
  96.     
  97. - (NSArray *)selectionIndexes;
  98.     // Returns the selection as an array of NSNumbers.
  99.  
  100. - (BOOL)setSelectionIndexes:(NSArray *)selection;
  101.     // Sets the selection as an array of NSNumbers.  The controller sends
  102.     // -isDiscardAllowed to all its detail controllers, as a change in
  103.     // selection will cause detail controllers to change their data source.
  104.     // If any controller returns NO the selection is NOT changed and NO is
  105.     // returned.  If an association attempts to change the selection and
  106.     // fails, the association should reset its selection by asking the
  107.     // controller for the current selection.  Returns YES on success, NO on
  108.     // failure.
  109.  
  110. - (BOOL)selectNext;
  111.     // This convenience method increments the selection.  If incrementing
  112.     // the selection would set the selection beyond the end of the array
  113.     // then the selection is set to 0.  If the previous selection was a
  114.     // multiple selection then the selection is set to the next record
  115.     // after the first item in the previous selection.  This method (and
  116.     // it's cover selectNext:) are useful for user interfaces that don't
  117.     // have widgets to directly control the selection.  Does not redisplay.
  118.     
  119. - (BOOL)selectPrevious;
  120.     // This convenience method decrements the selection.  If decrementing
  121.     // the selection would set the selection before the start of the array
  122.     // then the selection is set to the last object.  If the previous
  123.     // selection was a multiple selection then the selection is set to the
  124.     // previous record before the first item in the previous selection.
  125.     // This method (and it's cover selectPrevious:) are useful for user
  126.     // interfaces that don't have widgets to directly control the selection.
  127.     // Does not redisplay.
  128.     
  129. - (BOOL)clearSelection;
  130.     // Clears the selection.  Shortcut for sending -setSelection: with an
  131.     // empty array. Doesn't redisplay.
  132.  
  133. - (NSArray *)allObjects;
  134.     // Returns all data-bearing objects accessible through the controller.
  135.  
  136. - (NSArray *)selectedObjects;
  137.     // Returns the selected objects.
  138.  
  139. - (id <EODataSources>)dataSource;
  140.    // Returns the data source.
  141.  
  142. - (void)setDataSource: (id <EODataSources>)dataSource;
  143.     // Sets the new data source.
  144.  
  145. - (void)redisplay;
  146.     // Sends -contentsDidChange to all the associations.
  147.     
  148. - (BOOL)fetch;
  149.     // Sends -endEditing to the associations.  Then, if there are edits that
  150.     // haven't been sent to the objects, sends -controllerWillDiscardEdits:
  151.     // to the delegate.  Then, if there are modifications that haven't been
  152.     // sent to the data source, sends -controllerWillDiscardUpdates: to the
  153.     // delegate.  If the delegate agrees, sends -controllerWillFetch: to the
  154.     // delegate.  If the delegate agrees, sends -contentsWillChange to all
  155.     // associations, then after fetching, sends -contentsDidChange to all the
  156.     // associations and -controllerDidFetch: to the delegate.  Returns YES on
  157.     // success, NO on failure.
  158.  
  159. - (BOOL)deleteObjectAtIndex:(unsigned)anIndex;
  160.     // Sends -controller:willDeleteObject: to the delegate.  If the delegate
  161.     // agrees, deletes the object, then sends -controller:didDeleteObject: to
  162.     // the delegate.  If the selection can change -selectionDidChange is sent
  163.     // to the associations.  Finally -contentsDidChange is always sent to the
  164.     // associations.  Returns YES on success, NO on failure.
  165.  
  166. - (BOOL)deleteSelection;
  167.     // Iterates over the selection, sending -deleteObjectAtIndex: to self for
  168.     // each object in the selection.  Aborts the delete and return NO if
  169.     // any -deleteObjectAtIndex: message returns NO.  Returns YES if all
  170.     // objects are successfully deleted.
  171.  
  172. - insertObjectAtIndex:(unsigned)anIndex;
  173.     // Asks the data source to create a new object using the createObject
  174.     // method.  The calls insertObject:atIndex:.
  175.  
  176. - insertObject: newObject atIndex:(unsigned)anIndex;
  177.     // The newObject should be of an appropriate class for the controller's
  178.     // data source.  A new object can be allocated using the data source's
  179.     // createObject method.
  180.     // Sends -controller:willInsertObject:atIndex to the delegate.
  181.     // If the delegate disagrees, the new object is released, otherwise
  182.     // the object is inserted. Returns the object that was inserted, or nil
  183.     // on failure.
  184.  
  185. - (void)setValues: (NSDictionary *)newValues forObject: anObject;
  186.     // The dictionary newValues should contain key/value pairs that
  187.     // anObject can receive via the EOKeyValueCoding methods.  The
  188.     // controller acts as though the values had been received from an
  189.     // association.  So, for example, if savesToObjectsAutomatically is
  190.     // not enabled the values will not be sent to the EO.
  191.  
  192. - (void)associationDidEdit:(EOAssociation *)association;
  193.     // Informs the controller that association has a pending edit.  An
  194.     // association must send this message to its controller whenever it ends
  195.     // an editing session.
  196.  
  197. - (void)endEditing;
  198.     // This method is invoked whenever the controller needs to force an end
  199.     // to text editing.  It's invoked from -saveToObjects.
  200.  
  201. - (BOOL)hasChangesForObjects;
  202.     // Returns YES if any edits need to be made; that is, if any objects
  203.     // have been edited in the user interface but not applied to the objects.
  204.  
  205. - (BOOL)hasChangesForDataSource;
  206.     // Returns YES if any object has been modified; that is, if any objects
  207.     // have been edited, inserted, or deleted.
  208.  
  209. - (void)discardEdits;
  210.     // This clears the stack of changes to be made to the data-bearing
  211.     // objects.  This method is only useful if -savesToObjectsAutomatically is
  212.     // turned off.  This method sends -discardEdits to all the
  213.     // associations.
  214.     
  215. - (BOOL)saveToObjects;
  216.     // Sends buffered edits to the data-bearing objects via the
  217.     // EOKeyValueCoding category.  Buffering is enabled with
  218.     // -setSavesToObjectsAutomatically:.  When enabled, edits are buffered
  219.     // whenever an association sends an -associationDidEdit: message to the
  220.     // controller.  If the selection changes then any outstanding edits for
  221.     // the previously selected objects are cached.
  222.  
  223. - (void)setSelectsFirstObjectAfterFetch:(BOOL)yn;
  224. - (BOOL)selectsFirstObjectAfterFetch;
  225.     // Set/return the selection policy after fetching.  If YES and nothing
  226.     // was selected before the fetch then the first object will be selected.
  227.     // If YES and there was a previous selection the controller will attempt
  228.     // to maintain that selection after the fetch.  If NO the controller will
  229.     // not alter the selection.  The default is YES.
  230.  
  231. - (BOOL)setSavesToObjectsAutomatically:(BOOL)yn;
  232.     // Fails if there are any buffered edits.
  233. - (BOOL)savesToObjectsAutomatically;
  234.     // Set/return the automatic object updating policy.  If YES edits are sent
  235.     // directly to the selected object (or the first selected object) when an
  236.     // association send a -associationDidEdit: message to the controller.  If
  237.     // NO all edits are buffered until an update message is sent to the
  238.     // controller.  The default is NO.
  239.  
  240. - (void)discardOperations;
  241.     // Clears the list of pending operations that would be processed
  242.     // by saveToDataSource.
  243.     
  244. - (BOOL)saveToDataSource;
  245.     // For each edited, inserted, or deleted object, sends
  246.     // -prepareForDataSource to the object, -controllerWillUpateDataSource:
  247.     // to the delegate, -updateObject:, -insertObject:, or -deleteObject: to
  248.     // the data source, and finally -controllerDidUpateDataSource: to the
  249.     // delegate.  If any of these fails, this method fails and returns NO, and
  250.     // no further operations are performed.  After successfully saving edits
  251.     // for all of its modified objects, sends -saveToDataSource to all of
  252.     // subcontrollers, and then to the next controller, and returns YES.
  253.  
  254. - (BOOL)setSavesToDataSourceAutomatically:(BOOL)yn;
  255.     // Fails and returns NO if there are any buffered operations.
  256. - (BOOL)savesToDataSourceAutomatically;
  257.     // Set/return the automatic data-source updating policy.  If YES
  258.     // operations such as insert, delete, and edit are sent directly to the
  259.     // data source.  The default is NO.
  260.  
  261. - (void)setSortOrdering:(NSArray *)keySortOrderArray;
  262.     // sets an EOKeySortOrder array to be applied to all records upon fetch
  263. - (NSArray *)sortOrdering;
  264. - (void)resort;
  265.     // forces a resorting of the object array (and a redisplay)
  266. @end
  267.  
  268.  
  269. // These methods provide an undo stack by making copies of the operations
  270. // performed on the data-bearing objects and reverting to previous versions
  271. // when requested.
  272.  
  273. @interface EOController (EOUndoBehavior)
  274.  
  275. - (void)setUndoEnabled:(BOOL)yn;
  276. - (BOOL)isUndoEnabled;
  277.     // Enables or disabled undo.  The default is NO.
  278.  
  279. - (void)markUndo;
  280.     // Marks the current state of the objects as an undo point.
  281.  
  282. - (void)setMarksEveryOperation:(BOOL)yn;
  283. - (BOOL)marksEveryOperation;
  284.     // If this flag is set then every time an insert, delete, or edit is
  285.     // performed a mark is also placed on the undo stack.  The default is NO.
  286.  
  287. - (void)undo;
  288.     // Reverts to the most recent mark, and redisplays everything.
  289.     // Note that if undo is enabled an entry will be made for every insert,
  290.     // delete, or edit.  The controller will perform a saveToObjects before
  291.     // the undo is applied.
  292.  
  293. - (void)releaseUndos;
  294.     // Clears all undo information. No undo is possible until a new mark is
  295.     // established with -markUndo.
  296.  
  297. - (BOOL)hasUndos;
  298.     // Returns whether this controller has any entries on its undo stack.
  299.  
  300. - (void)setMaximumUndoMarks:(unsigned int)max;
  301. - (unsigned int)maximumUndoMarks;
  302.     // Set/return the maximum number of undo marks that will be recorded.
  303.     // Marks added after the maximum will causes earlier marks to fall off the
  304.     // queue.  This method is useful for restricting memory usage.  Setting
  305.     // the maximum to zero will allow unlimited undo queueing.  The default
  306.     // is zero.
  307.  
  308. @end
  309.  
  310.  
  311. // These methods are simple convienience methods to facilitate target/action
  312. // connections in InterfaceBuilder.
  313.  
  314. @interface EOController (EOControllerTargetAction)
  315.  
  316. - selectNext: sender;
  317.     // This is a target-action cover for -selectNext.  Also sends
  318.     // -redisplay after changing the selection.
  319.  
  320. - selectPrevious: sender;
  321.     // This is a target-action cover for -selectPrevious.  Also sends
  322.     // -redisplay after changing the selection.
  323.  
  324. - fetch:sender;
  325.     // This is a target-action cover for -fetch.
  326.  
  327. - insert:sender;
  328.     // Inserts an object after the selected object, or, if nothing is
  329.     // selected, at the end of the array.
  330.  
  331. - delete:sender;
  332.     // This is a target-action cover for -deleteObjectAtIndex:.  Deletes the
  333.     // first selected object, or, if nothing is selected the last object.
  334.  
  335. - saveToObjects:sender;
  336. - markUndo:sender;
  337. - undo:sender;
  338. - saveToDataSource:sender;
  339. - discardOperations:sender;
  340. - discardEdits:sender;
  341.     // These are target-action covers for the methods of the same name with
  342.     // no arguments.
  343.  
  344. @end
  345.  
  346.  
  347. // This optional protocol describes the methods a delegate of the
  348. // EOController may implement.
  349.  
  350. @interface NSObject (EOControllerDelegate)
  351.  
  352. - (void)controllerDidChangeSelection:(EOController *)controller;
  353.     // Sent when the selection changes.
  354.     
  355. - (BOOL)controllerWillFetch:(EOController *)controller;
  356.     // Informs the delegate that the controller is about to fetch.  If the
  357.     // delegate returns no the fetch fails; if the delegate returns YES
  358.     // the fetch proceeds.
  359.  
  360. - (void)controller:(EOController *)controller didFetchObjects: (NSArray *)objects;
  361.     // Informs the delegate that the controller has fetched object.
  362.  
  363. - (void)controller:(EOController *)controller sortObjects:(NSMutableArray *)objects;
  364.     // If the delegate implements this method, it is responsible for sorting
  365.     // the given object array.  If the delegate does not implement this method
  366.     // and a sortOrdering has been specified, the controller will sort the objects
  367.     // itself using [objects sortUsingKeyOrderArray:[self sortOrdering]];
  368.  
  369. // Note that the insert, delete, and update operations are buffered until an
  370. // -saveToDataSource message is sent to the controller.  The delegate receives
  371. // delegate messages for these operations as the insert, delete, and update
  372. // operations are sent to the controller.  The delegate receives different
  373. // delegate messages when the buffered operations are actually sent on to the
  374. // data source.
  375.  
  376. - (BOOL)controller:(EOController *)controller willInsertObject:object atIndex: (unsigned)newIndex;
  377.     // If the delegate returns NO object is released and not inserted.
  378.  
  379. - (void)controller:(EOController *)controller didInsertObject:object;
  380.     // Informs the delegate that the controller has inserted object.
  381.  
  382.  
  383. - (BOOL)controller:(EOController *)controller willDeleteObject:object;
  384.     // If the delegate returns NO object is not deleted.
  385.  
  386. - (void)controller:(EOController *)controller didDeleteObject:object;
  387.     // Informs the delegate that the controller has deleted object.
  388.  
  389. - (NSDictionary *)controller:(EOController *)controller willSaveEdits: (NSDictionary *)edits toObject:object;
  390.     // Invoked by -saveObjects for each object before
  391.     // -takeValuesFromDictionary: is sent to the object.  If the delegate
  392.     // responds nil -takeValuesFromDictionary: is not sent and the controller
  393.     // aborts -saveToObjects.  The edits will be ignored and the associations
  394.     // will not be notified of any change.  If the delegate returns a
  395.     // dictionary that dictionary will be sent to the object.  This method is
  396.     // useful for doing validation prior to data actually being sent to the
  397.     // object and will also prevent the UI from refreshing.
  398.  
  399. - (void)controller:(EOController *)controller didSaveToObject:object;
  400.     // Informs the delegate that the controller has saved object.
  401.  
  402. - (BOOL)controllerWillDiscardEdits:(EOController *)controller;
  403.     // Sent during the -fetch method before the fetch begins if there are any
  404.     // operations that haven't been saved to the objects.  Also sent when a
  405.     // selection is about to change, causing a detail controller to flush its
  406.     // caches.  The operation is aborted if this method returns NO.  The
  407.     // delegate should send -saveToObjects if it wants to preserve the
  408.     // changes.  If the delegate doesn't implement this method the controller
  409.     // opens an alert panel warning the user that edits may be lost.
  410.  
  411. - (BOOL)controllerWillDiscardOperations:(EOController *)controller;
  412.     // Sent during the -fetch method before the fetch begins if there are any
  413.     // operations that haven't been saved to the data source.  Also sent
  414.     // when a selection is about to change, causing a detail controller to
  415.     // flush its caches.  The fetch is aborted if this method returns NO.
  416.     // The delegate should invoke -saveToDataSource if it wants to preserve the
  417.     // changes.  If the delegate doesn't implement this method the controller
  418.     // opens an alert panel warning the user that updates may be lost.
  419.  
  420.  
  421. - (BOOL)controllerWillSaveToDataSource:(EOController *)controller;
  422. - (void)controllerDidSaveToDataSource:(EOController *)controller;
  423.     // These delegate messages are sent as the data source is notified of
  424.     // changes to data-bearing objects.  If the savesToDataSourceAutomatically
  425.     // flag is turned off and -saveToDataSource is invoked then the delegate
  426.     // is notified of each buffered operation.
  427.  
  428.  
  429. typedef enum {
  430.     EONoDataSourceFailure = 0,
  431.     EOContinueDataSourceFailureResponse,
  432.     EORollbackDataSourceFailureResponse
  433. } EODataSourceFailureResponse;
  434.     // These return values allow a controller's delegate to determine what
  435.     // action should be taken on a failure.  EONoDataSourceFailure means there
  436.     // was no failure; EOContinuteDataSourceFailureResponse means that the
  437.     // failure should be ignored and the operation should continue;
  438.     // EORollbackDataSourceFailureResponse means that the controller should
  439.     // roll back the data source.  EORollbackDataSourceFailureResponse is only
  440.     // useful if the data source conforms to the EORollbackDataSource
  441.     // protocol.
  442.  
  443. typedef enum {
  444.     EODiscardDataSourceOperation = 0,    // NO response in EOF 1.0
  445.     EOPerformDataSourceOperation,    // YES response in EOF 1.0
  446.     EOContinueDataSourceOperation,
  447.     EORollbackDataSourceOperation,     
  448. } EODataSourceOperationDelegateResponse;
  449.     // The return values allow a controller's delegate to dictate
  450.     // in a will<Operation>inDataSource method what should be done
  451.     // with the current operation.  EOPerformDataSourceOperation means
  452.     // the operation should proceed.  EODiscardDataSourceOperation means
  453.     // the operation should not be performed, and should be discarded
  454.     // from the operation stack.  EOContinueDataSourceOperation means
  455.     // that the operation not be performed but should be left on the
  456.     // operation stack to be performed on the next save.  EORollbackDataSourceOperation
  457.     // indicates that the current saveToDataSource operation should be
  458.     // aborted and all changes rolled back.
  459.  
  460. // These methods are currently undocumented.
  461.  
  462. - (EODataSourceFailureResponse)controller:(EOController *)controller
  463.     object:object
  464.     failedToPrepareForDataSource:dataSource;
  465.  
  466. - (EODataSourceOperationDelegateResponse)controller:(EOController *)controller
  467.     willInsertObject:object
  468.     inDataSource:dataSource;
  469.  
  470. - (EODataSourceFailureResponse)controller:(EOController *)controller
  471.     failedToInsertObject:object
  472.     inDataSource:dataSource;
  473.  
  474. - (void)controller:(EOController *)controller
  475.     didInsertObject:object
  476.     inDataSource:dataSource;
  477.  
  478. - (EODataSourceOperationDelegateResponse)controller:(EOController *)controller
  479.     willDeleteObject:object
  480.     inDataSource:dataSource;
  481.  
  482. - (EODataSourceFailureResponse)controller:(EOController *)controller
  483.     failedToDeleteObject:object
  484.     inDataSource:dataSource;
  485.  
  486. - (void)controller:(EOController *)controller
  487.     didDeleteObject:object
  488.     inDataSource:dataSource;
  489.  
  490. - (EODataSourceOperationDelegateResponse)controller:(EOController *)controller
  491.     willUpdateObject:object
  492.     inDataSource:dataSource;
  493.  
  494. - (EODataSourceFailureResponse)
  495.     controller:(EOController *)controller
  496.     failedToUpdateObject:object
  497.     inDataSource:dataSource;
  498.  
  499. - (void)controller:(EOController *)controller
  500.     didUpdateObject:object
  501.     inDataSource:dataSource;
  502.  
  503. - (void) controller:(EOController *)controller
  504.     saveObjectsFailedForDataSource:dataSource;
  505.  
  506. - (void) controller:(EOController *)controller
  507.     createObjectFailedForDataSource:dataSource;
  508.  
  509. - (void)controller:(EOController *)controller willRollbackDataSource:(id <EODataSources>)dataSource;
  510. - (void)controller:(EOController *)controller didRollbackDataSource:(id <EODataSources>)dataSource;
  511.  
  512.  
  513. - (BOOL)controllerWillUndo:(EOController *)controller;
  514. - (void)controllerDidUndo:(EOController *)controller;
  515.  
  516. - (void)controller:(EOController *)controller didChangeDataSource: (id <EODataSources>)dataSource;
  517.  
  518. - (void)controller:(EOController *)controller association: (EOAssociation *)association didEditObject: anObject key: (NSString *)key value: aValue;
  519.  
  520. - (BOOL)controller:(EOController *)controller willUndoObject:anObject;
  521. - (void)controller:(EOController *)controller didUndoObject:anObject;
  522.  
  523. @end
  524.  
  525.  
  526. @protocol EOObjectValidation
  527.  
  528. - (BOOL)prepareForDataSource;
  529.     // Sent to objects before they are updated in, inserted into, or deleted
  530.     // from the data source.  If the object returns NO the data source
  531.     // operation will not be performed.
  532.  
  533. @end
  534.  
  535.  
  536. // These notifications are sent by EOController to EOAssociations.
  537.  
  538. @protocol EOAssociationNotification
  539.  
  540. - (void)contentsDidChange;
  541.     // Sent to all associations whenever data may have changed; for example,
  542.     // when a controller's data source is changed.  Associations should only
  543.     // update themselves if the value is in fact different from what they're
  544.     // currently displaying.
  545.     
  546. - (void)selectionDidChange;
  547.     // Sent to all associations whenever selection has changed.
  548.  
  549. - (void)endEditing;
  550.     // Sent when the receiver should end editing.  This is a necessary to
  551.     // correctly disassociate the window's field editor for the widget's view.
  552.  
  553. - (void)discardEdits;
  554.     // The association should discard any buffer edits.  This is sent by the
  555.     // controller before objects are fetched from the data source.
  556.  
  557. @end
  558.