One of the most common tasks when using the component is iterating over all items in the document or navigating through the connections between items - from a node to the incoming or outgoing links, or from a link to its origin and destination nodes. To enumerate items of a diagram, use the collections returned by the following methods: getItems, getLinks, and getNodes. The nodes connected through a link are returned by the link's getDestination and getOrigin methods. To access the links connected to a node, use its getIncomingLinks and getOutgoingLinks methods. The first collection contains references to all links pointing to the node, the second - to the links that start from it. Links can connect to rows of a table; to find such links, use the table’s getRows method and the getIncomingLinks and getOutgoingLinks methods.
If only one chart object is selected, it is considered the active object and can be accessed with the getActiveItem method. Multiple objects can be selected when clicking or dragging with the Ctrl key pressed at the same time. Multiple- selection can be accessed through the getSelection method of the Diagram class. The Selection object provides methods to access the selected items: getItems, getLinks, getNodes.
You can search for chart objects by their tag using the findLink, findNode, findGroup methods. Tag objects are compared by calling the equals method of the java.lang.Object class. If there are more objects with the same tag, the first one will be returned. If no object with the specified tag exists, null object reference will be returned. Groups can also be searched by tag using findGroup.