|
|
Package com.dassault_systemes.catjdialog |
Class CATCallbackSource
|
Class Hierarchy |
java.lang.Object | +-com.dassault_systemes.catjdialog.CATCallbackSource
Class Location |
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:
public void <Method>(CATDialog iDialog, CATNotification iNotification, Object iData)
,
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; [...] } [...] }
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()Creates a callback source.
Method Detail |
void addCallback(CATNotification iNotification, Object iListener, String iMethod, Object iData)Registers a callback to the specified notification.
iNotification
get<Type_Name>Notification()
method).iListener
iMethod
public void <iMethod>(CATDialog iDialog, CATNotification iNotification, Object iData)
iData
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.
iNotification
get<Type_Name>Notification()
method).iListener
iMethod
iData
boolean hasCallback(CATNotification iNotification)Checks whether if the specified notification has registered callbacks.
iNotification
true
if the specified notification has associated callback(s); false
otherwise.void reset()Removes all callbacks from this callback source.
void sendNotification(CATNotification iNotification)Sends a notification.
All callbacks registered to the specified notification are triggered.
iNotification