Progress
ADM 2 Guide


SmartLink Events

For each SmartLink type, the Source object has specific responsibilities to the Target object, and the Target object has specific responsibilities to the Source object. These responsibilities are fulfilled by the methods contained in the SmartObject; therefore, the type of links that a particular SmartObject can support is determined by the methods that it contains.

The specific responsibilities of a pair of linked SmartObjects to each other depend only on the type of SmartLink that connects them, not on their object types. For example, in a TableIO relationship, the Target object always has the same responsibilities regardless of whether it is a SmartDataBrowser or a SmartDataViewer. Specifically:

Therefore, the Source and Target objects must SUBSCRIBE to the correct set of events or they cannot interact as expected. These events evaluate to the internal procedures in the Source and Target objects.

Subscription occurs when you add the SmartLink: the addLink procedure (in smart.p) SUBSCRIBEs the Target procedure to the SourceEvents for the link and SUBSCRIBEs the Source procedure to the TargetEvents, as shown in the following code fragment:

/* SUBSCRIBE to all the appropriate events on each side of the link. 
     First SUBSCRIBE the target to all the events it says it wants
     from its source. */
  cEvents = dynamic-function("get":U + pcLink + "SourceEvents":U IN phTarget) 
      NO-ERROR.
  IF cEvents NE ? THEN
  DO iEvent = 1 TO NUM-ENTRIES(cEvents):
    SUBSCRIBE PROCEDURE phTarget TO ENTRY(iEvent, cEvents) IN phSource.
  END.
  /* Then SUBSCRIBE the source to all the events (if any) that it wants
     from its target. */
  cEvents = dynamic-function("get":U + pcLink + "TargetEvents":U IN phSource) 
      NO-ERROR.
  IF cEvents NE ? THEN
  DO iEvent = 1 TO NUM-ENTRIES(cEvents):
    SUBSCRIBE PROCEDURE phSource TO ENTRY(iEvent, cEvents) IN phTarget.
  END.

  RETURN.
END PROCEDURE. 

Note that this behavior happens automatically, in the addLink procedure.

See the Progress Programming Handbook or the Progress Language Reference for more information on PUBLISH and SUBSCRIBE. For a description of dynamic–function, see the Progress Language Reference.

The following sections describe the responsibilities of the Source and Target SmartObjects for each ADM-recognized SmartLink type. These sections also list, for each SmartLink type, the subscribed events/internal procedures required by the Source and Target objects.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095