Ending a Notification
Use the endClassNotification, endClassesNotification, endClassNotificationForIF, or endClassesNotificationForIF method to deregister a class notification and the endNotification or endNotificationForIF method to deregister an object notification registered by using the beginNotification or beginNotificationForIF method.
Alternatively, use the endNotificationForSubscriber method to terminate all previous notification requests for a specific subscriber.
The endNotification, endClassNotification, endClassesNotification, endNotificationForIF, endClassNotificationForIF, or endClassesNotificationForIF method eventType parameter must be the same as the eventType parameter specified in the beginNotification, beginClassNotification, beginClassesNotification, beginClassNotificationForIF, beginClassesNotificationForIF, or beginNotificationForIF method, respectively.
The parameters for methods that end notifications are listed in the following table.
Parameter |
Description |
eventType |
Specifies the type of event for which the notification subscription is to be terminated. This must be the same as the eventType parameters specified in the beginNotification, beginClassNotification, beginClassesNotification, beginClassNotificationForIF, beginClassesNotificationForIF, and beginNotificationForIF methods. |
subscriber |
For the endNotificationForSubscriber method, specifies the subscriber whose registered notifications are to be terminated. |
theClass |
For the endClassNotification, endClassesNotification, endClassNotificationForIF, and endClassesNotificationForIF methods, specifies the class for which the class notification of the specified type is to be terminated. |
includeSubclasses |
For the beginClassesNotification and beginClassesNotificationForIF methods, specifies whether subclasses are included or excluded in the notification registration. |
theObj |
For the endNotification and endNotificationForIF methods, specifies the object for which the notification subscription is to be terminated. Note that if this object is transient, only user end notifications can be invoked. |
transients |
For the endClassNotification, endClassesNotification, endClassNotificationForIF, and endClassesNotificationForIF methods, specifies if the user end notification is to be invoked for events that occur to transient instances (true), or persistent instances (false) of the class. (System notifications apply only to persistent objects.) |
For more details, see the appropriate methods under "Object Class", in Chapter 1 of the JADE Encyclopaedia of Classes.
For an example of the use of the endNotificationForSubscriber method, see "Receiving User Notifications" under "Receiving a Notification", earlier in this chapter.
The following example, from the Erewhon Investments example schema supplied on the JADE release medium, shows the use of the endNotification method when ending the notification on an item before removing it from the list.
removeItem(pos : Integer) updating;
begin
if showUpdates then
if pos > 0 and pos <= self.listCount then
endNotification(self.itemObject[pos], Object_Update_Event);
endif;
endif;
inheritMethod(pos);
end;
The following example shows the use of the endClassNotification method when a form is unloaded.
unload() updating;
begin
endClassNotification(Sale, false, Object_Create_Event);
end;
The following example, from the Erewhon Investments example schema supplied on the JADE release medium, shows the use of the endNotificationForSubscriber method when clearing the contents of a list box and disabling notifications for the objects that were in the list.
clear() updating;
begin
// End all notifications
endNotificationForSubscriber(self);
// The list box is being cleared so clear our selected objects list
zSelectedObjects.clear;
if showUpdates and zCollectionOid <> null then
// Turn notifications back on for the collection itself
beginNotification(zCollectionOid.asOid.Collection, Any_System_Event,
Response_Continuous, NotifyCollectionUpdate);
endif;
inheritMethod;
end;