Once you start to work with the diagram there is a natural desire to move on from the visualisation aspects into interactivity. This raises the basic question: If I have an event handler on a node, how can I get information about that node?
The pattern for doing this is simple but it's a good topic to cover. When you click a node to the diagram it updates the selectedRowKeySet associated with the diagramNodes (the same is true for the diagramLinks as well), so when you need to access the selected node this is the place to look.
As a simple example of this we might have a popup menu associated with your nodes:
And then a menu item wired to a listener:
<af:commandMenuItem text="Operate on node"
So in the listener all you need to do is to obtain the handle to the diagramNodes object and call getSelectedRowKeys on that:
RowKeySet keys = getRuleDiagramNodes().getSelectedRowKeys();
In this case the getRuleDiagramNodes() method returns the UIDiagramNodes reference created by defining the standard binding attribute in the <dvt:diagramNodes> tag to inject it's reference into this managed bean.
Once you have the RowKeySet, you can either iterate through it's entries or convert it to an array and access the key value. Once you have the key, then you can look up the underlying object that the node represents from your model, and from there, access any of the attributes that you need.