Package com.dassault_systemes.catjdialog

   
Class CATHookup

 
Class Hierarchy
java.lang.Object
  |
  +-com.dassault_systemes.catjdialog.CATCallbackSource
        |
        +-com.dassault_systemes.catjdialog.CATHookup
Class Location

Framework : CATJDialog

Module : CATJDialog

Class Description

public class CATHookup

The session hookup service.

This class allows communication between two commands or pieces of application in the same user session that don't know each other.

The CATHookup service is based on the standard JDialog callback/notification pattern (see CATCallbackSource). The CATHookup is itself a CATCallbackSource (it is able to register/unregister callbacks, fire notifications, check callbacks).

The CATHookup only manages CATHookupNotification notification types. Every notification that is fired through the CATHookup should extend the CATHookupNotification.

Hookup Usage Samples:

1- How to declare a hookup notification:

 public class MyHookupNotification extends CATHookupNotification
 {
     // --- constructor with message
     public MyHookupNotification(String iMyMessage)
     {
         super(iMyMessage);
     }
     // --- message getter method (used by the receiver)
     public String getMyMessage()
     {
         return (String)getObject();
     }
 }
 

2- How to fire a hookup notification:

     [...]
     CATDialog aComponent...
 
     // --- get the session hookup
     CATHookup hookup = CATHookup.getHookup(aComponent.getSession());
     // --- fire the hookup notification with my message
     hookup.sendNotification(new MyHookupNotification("hello world!"));
 

3- How to listen/receive a hookup notification:

 public class MyReceiver
 {
     // --- the callback method associated to the 'Create' notification from the topmost command component
     public void onCreate(CATDialog iDialog, CATNotification iNotification, Object iData)
     {
         // --- register to my hookup notifications
         CATHookup hookup = CATHookup.getHookup(iDialog.getSession());
         hookup.addCallback(new MyHookupNotification(null), this, "onHookup", null);
     }
     // --- the hookup callback method
     public void onHookup(CATDialog iDialog, CATNotification iNotification, Object iData)
     {
         // --- retreive my message
         MyHookupNotification mynotif = (MyHookupNotification)iNotification;
         System.out.println("Received a hookup message: "+mynotif.getMyMessage());
     }
     [...]
 }
 

See Also:
CATHookupNotification
CATCallbackSource
Field Summary

Constructor Summary
CATHookup()

Method Summary
CATHookup getHookup(CATSession iSession)


Field Detail

Constructor Detail

CATHookup

    CATHookup()


Method Detail

getHookup

    CATHookup getHookup(CATSession iSession)

Returns the session hookup object.

Parameters:
iSession
The user session object.


Copyright © 2000, Dassault Systèmes. All rights reserved