@Override
protected void createEditPolicies() {
}
protected PolylineConnection createConnection(Edge edge) {
PolylineConnection conn = new PolylineConnection();
// Prepare connection router with corresponding bendpoints
conn.setConnectionRouter(new BendpointConnectionRouter());
// Add bend point if source's bean prefered height is different from
// heigth calculated by DirectedGraphLayout
List<AbsoluteBendpoint> bends = new ArrayList<AbsoluteBendpoint>();
Bean source = (Bean) getReference().source;
if (source.height > source.preferredHeight) {
Rectangle rect = new Rectangle(source.x + GraphPart.MARGIN_SIZE,
source.y + GraphPart.MARGIN_SIZE, source.width,
source.height);
bends.add(new AbsoluteBendpoint(rect.getBottom()));
}
// Create bend points for edge's virtual nodes (if any)
NodeList nodes = edge.vNodes;
if (nodes != null) {
for (int i = 0; i < nodes.size(); i++) {
Node node = nodes.getNode(i);
// Check if edge was inverted (due to broken cycle)
if (edge.isFeedback()) {
bends.add(new AbsoluteBendpoint(node.x
+ GraphPart.MARGIN_SIZE, node.y
+ GraphPart.MARGIN_SIZE + node.height));
bends.add(new AbsoluteBendpoint(node.x
+ GraphPart.MARGIN_SIZE, node.y
+ GraphPart.MARGIN_SIZE));
} else {
bends.add(new AbsoluteBendpoint(node.x
+ GraphPart.MARGIN_SIZE, node.y
+ GraphPart.MARGIN_SIZE));
bends.add(new AbsoluteBendpoint(node.x
+ GraphPart.MARGIN_SIZE, node.y
+ GraphPart.MARGIN_SIZE + node.height));
}
}
}
conn.setRoutingConstraint(bends);
conn.setTargetDecoration(new PolylineDecoration());
if (getReference().isInner()) {
conn.setLineStyle(Graphics.LINE_DOT);
}
return conn;
}