node1
to node2
specifying that the side of the port on the source node is South and the side of the port on the target port is North:GraphmlFactory factory = GraphmlFactory.getInstance(); GraphmlDiagram diagram = factory.newDiagram(); GraphMLNode node1 = diagram.addNodeWithLabel("node1"); GraphMLNode node2 = diagram.addNodeWithLabel("node2"); GraphMLEdge edge = diagram.addEdge(node1, node2); edge.setPortConstraint(PortConstraints.SOURCE, PortConstraints.SOUTH); // the edge comes from the South side of node1 (bottom) edge.setPortConstraint(PortConstraints.TARGET, PortConstraints.NORTH); // the edge goes to the North side of node2 (top)
GraphmlFactory factory = GraphmlFactory.getInstance(); GraphmlDiagram diagram = factory.newDiagram(); GraphMLNode node1 = diagram.addNode(); GraphMLNode node2 = diagram.addNode(); GraphMLEdge edge = diagram.addEdge(node1, node2); PortConstraints constraints = edge.getPortConstraints(); constraints.setPortConstraint(PortConstraints.SOURCE, PortConstraints.SOUTH); // the edge comes from the South side of node1 (bottom) constraints.setPortConstraint(PortConstraints.TARGET, PortConstraints.NORTH); // the edge goes to the North side of node2 (top)Or using Strings:
GraphmlFactory factory = GraphmlFactory.getInstance(); GraphmlDiagram diagram = factory.newDiagram(); GraphMLNode node1 = diagram.addNode(); GraphMLNode node2 = diagram.addNode(); GraphMLEdge edge = diagram.addEdge(node1, node2); PortConstraints constraints = edge.getPortConstraints(); constraints.setPortConstraint("source", "south"); // the edge comes from the South side of node1 (bottom) constraints.setPortConstraint("target", "north"); // the edge goes to the North side of node2 (top)
GraphmlFactory factory = GraphmlFactory.getInstance(); GraphmlDiagram diagram = factory.newDiagram(); GraphMLNode node1 = diagram.addNode(); GraphMLNode node2 = diagram.addNode(); GraphMLEdge edge = diagram.addEdge(node1, node2); edge.setPortConstraint(PortConstraints.SOURCE, PortConstraints.SOUTH); // the edge comes from the South side of node1 (bottom) edge.setPortConstraint(PortConstraints.TARGET, PortConstraints.NORTH); // the edge goes to the North side of node2 (top)Or using Strings:
GraphmlFactory factory = GraphmlFactory.getInstance(); GraphmlDiagram diagram = factory.newDiagram(); GraphMLNode node1 = diagram.addNode(); GraphMLNode node2 = diagram.addNode(); GraphMLEdge edge = diagram.addEdge(node1, node2); edge.setPortConstraint("source", "south"); // the edge comes from the South side of node1 (bottom) edge.setPortConstraint("target", "north"); // the edge goes to the North side of node2 (top)
GraphmlFactory factory = GraphmlFactory.getInstance(); GraphmlDiagram diagram = factory.newDiagram(); GraphMLNode node1 = diagram.addNode(); GraphMLNode node2 = diagram.addNode(); GraphMLEdge edge = diagram.addEdge(node1, node2); node1.setFromPortConstraint(PortConstraints.SOUTH); // set all edges originating from this node as coming from the South side of node (bottom) node2.setToPortConstraint(PortConstraints.NORTH); // set all edges originating from another node as going to the North side of node (top)
Copyright 2021 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence