Package com.dassault_systemes.catjdialog

   
Class CATCallbackSource

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

Framework : CATJDialog

Module : CATJDialog

Class Description

public class CATCallbackSource

The base callback source implementation.

CATCallbackSource and CATNotification provide the registration/notification pattern in JDialog.

A callback is defined by:


The CATCallbackSource allows to:

Usage Sample: registering a controller to a CATTree contextual menu

 public class MyController
 {
     // --- the 'mytree' attribute
     CATTree mytree;
     
     // --- the callback method associated to the 'Create' notification from the topmost command component
     public void onCreate(CATDialog iDialog, CATNotification iNotification, Object iData)
     {
         // --- register to the tree contextual menu notification
         mytree.addCallback(mytree.getMenuNotification(), this, "onContextualMenu", null);
     }
     // --- the contextual menu callback method
     public void onContextualMenu(CATDialog iDialog, CATNotification iNotification, Object iData)
     {
         // --- cast to CATTreeCommandNotification
         CATTreeCommandNotification ctxmenunotif = (CATTreeCommandNotification)iNotification;
         [...]
     }
     [...]
 }
 

See Also:
com.dassault_systemes.catjdialog.CATNotification
Field Summary

Constructor Summary
CATCallbackSource()

Method Summary
void addCallback(CATNotification iNotification, Object iListener, String iMethod, Object iData)
void removeCallback(CATNotification iNotification, Object iListener, String iMethod, Object iData)
boolean hasCallback(CATNotification iNotification)
void reset()
void sendNotification(CATNotification iNotification)


Field Detail

Constructor Detail

CATCallbackSource

    CATCallbackSource()

Creates a callback source.


Method Detail

addCallback

    void addCallback(CATNotification iNotification, Object iListener, String iMethod, Object iData)

Registers a callback to the specified notification.

Parameters:
iNotification
The CATNotification object associated to the callback (this notification must be exposed by the CATCallbackSource object itself through a get<Type_Name>Notification() method).
iListener
The listener object.
iMethod
the callback method name of the listener object. It must have the following signature:
    public void <iMethod>(CATDialog iDialog, CATNotification iNotification, Object iData)
iData
This optional argument (may be null) is passed-back to the callback method (for contextual purpose).

removeCallback

    void removeCallback(CATNotification iNotification, Object iListener, String iMethod, Object iData)

Unregisters a callback to the specified notification.

Note: Unregistration must be done with exactly the same arguments that were used to register.

Parameters:
iNotification
The CATNotification object associated to the callback (this notification must be exposed by the CATCallbackSource object itself through a get<Type_Name>Notification() method).
iListener
The listener object.
iMethod
The callback method name of the listener object.
iData
The callback data.

hasCallback

    boolean hasCallback(CATNotification iNotification)

Checks whether if the specified notification has registered callbacks.

Parameters:
iNotification
A notification object.
Returns:
true if the specified notification has associated callback(s); false otherwise.

reset

    void reset()

Removes all callbacks from this callback source.


sendNotification

    void sendNotification(CATNotification iNotification)

Sends a notification.

All callbacks registered to the specified notification are triggered.

Parameters:
iNotification
A notification object.


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