Skip to content

Jjodel Events

Jjodel supports an event-driven interaction model that allows you to define custom behaviors in response to user actions on model elements. Events are configured through the Events tab in the Viewpoint Properties Panel.

Jjodel provides handlers for the following user interactions:

EventTriggered When
onClickThe user clicks on a node or edge
onDoubleClickThe user double-clicks on an element
onDragThe user drags a node to a new position
onDragStartA drag operation begins
onDragEndA drag operation ends
onResizeThe user resizes a node
onDataUpdateAn attribute or reference value changes
onSelectAn element is selected
onDeselectAn element is deselected
onHoverThe cursor enters an element’s bounding box
onHoverEndThe cursor leaves an element’s bounding box

Events are defined per viewpoint view. To configure an event:

  1. Select the viewpoint view in the editor
  2. Open the Events tab in the Properties Panel
  3. Choose the event type
  4. Write the handler logic in JavaScript
// When a class is clicked, log its name to the console
(element) => {
console.log("Clicked:", element.name);
}
// When an attribute changes, validate the new value
(element, attribute, newValue) => {
if (attribute.name === "name" && newValue.length === 0) {
console.warn("Name cannot be empty");
}
}

For advanced scenarios where callback chains are insufficient, Jjodel supports custom DOM events for inter-component communication. These events follow the standard browser CustomEvent API and can be dispatched and listened to across different parts of the interface.