Skip to content

Callbacks Overview

You can optionally provide callback listeners. These will be called when the user interacts with the canvas and allows your application to perform processing specific to your application’s needs based on user interactions. If you don’t implement any of the callbacks, Common Canvas will perform appropriate actions if necessary.

These listeners are as follows:

Context Menu Handler

Overrides or adds to the default context menu (or context toolbar) displayed for nodes, links, comments, etc.

Before Edit Action Handler

Called for each edit action on the canvas. It is called before the internal object model has been updated and the edit action has completed, so this can be used to cancel user actions if necessary.

Edit Action Handler

Called for each edit action on the canvas. It is called after the internal object model has been updated and the edit action has completed.

Layout Handler

Allows the application to override layout settings for nodes on a node-by-node basis.

Decoration Action Handler

Called whenever the user clicks on a decoration which has its hotspot field set to true.

Tip Handler

Allows the application to override the tips displayed for canvas objects such as nodes and links.

ID Generator Handler

Called whenever a new object is created and allows the application to specify its own IDs for canvas objects.

Selection Change Handler

Called whenever the set of selected objects changes.

Click Action Handler

Called whenever something is clicked, double-clicked or right-clicked on the canvas. This can be used, for example, to open a properties window when a node is double clicked.

Action Label Handler

Allows the application to override labels displayed for command actions that are shown for undo and redo actions.