// This sample demonstrates how to connect nodes with links and // how to enable collapsing and expanding of tree branches // Setting the default property NodesExpandable indicates that all // subsequently created nodes will be expandable diagram.setNodesExpandable(true); // Create two nodes ShapeNode parent = diagram.getFactory().createShapeNode(10, 10, 50, 20); ShapeNode child = diagram.getFactory().createShapeNode(10, 40, 50, 20); // Connect the nodes by creating a new link // from the parent node to the child node diagram.getFactory().createDiagramLink(parent, child); |