Edge newEdge = Lookup.getDefault().lookup(GraphController.class).getModel().factory().newEdge(id, source, target, DEFAULT_EDGE_WEIGHT, directed);
return newEdge;
}
private Node copyNodeRecursively(Node node, Node parent, HierarchicalGraph hg) {
NodeData nodeData = node.getNodeData();
Node copy = buildNode(nodeData.getLabel());
NodeData copyData = copy.getNodeData();
//Copy properties (position, size and color):
copyData.setX(nodeData.x());
copyData.setY(nodeData.y());
copyData.setZ(nodeData.z());
copyData.setSize(nodeData.getSize());
copyData.setColor(nodeData.r(), nodeData.g(), nodeData.b());
copyData.setAlpha(nodeData.alpha());
//Copy attributes:
AttributeRow row = (AttributeRow) nodeData.getAttributes();
for (int i = 0; i < row.countValues(); i++) {
if (row.getValues()[i].getColumn().getOrigin() == AttributeOrigin.DATA) {
copyData.getAttributes().setValue(i, row.getValue(i));
}
}
if (parent != null) {
hg.addNode(copy, parent);