|
Hi,
Another problem I noticed:
[code]
@Override public void init() { super.init(); flowChart = new Diagram(); flowchartView = new DiagramView(flowChart); flowChart.setSelectionOnTop(false); flowChart.setShadowsStyle(ShadowsStyle.None); this.getContentPane().add(flowchartView); flowChart.setMeasureUnit(GraphicsUnit.Pixel);
flowChart.setAllowUnconnectedLinks(true); flowChart.setLinkStyle(LinkStyle.Cascading); flowChart.setSnapToAnchor(SnapToAnchor.OnCreateOrModify); flowChart.setRouteLinks(true); flowChart.getRoutingOptions().setTriggerRerouting( RerouteLinks.WhileCreating); flowChart.setLinksSnapToBorders(true);
testArrowSnap(); }
private void testArrowSnap() { one = new ShapeNode(flowChart); one.setBounds(100, 100, 200, 200); flowChart.add(one);
two = new ShapeNode(flowChart); two.setBounds(500, 100, 200, 200); flowChart.add(two);
DiagramLink arrow = new DiagramLink(flowChart, one, two); arrow.setStyle(LinkStyle.Polyline); arrow.setAutoRoute(false); arrow.setSegmentCount(1); arrow.getControlPoints().set(0, new Point2D.Float(300, 110)); arrow.getControlPoints().set(1, new Point2D.Float(500, 110)); arrow.setSnapToNodeBorder(true); flowChart.add(arrow); }
[/code]
Above I have two DiagramNodes and one DiagramLink connecting them. I have mentioned only one segment, but you will see that the DiagramLink has two segments.
Also when you move the first DiagramNode, the origin of the DiagramLink jumps to the center of the first box. The destination of the DiagramLink is now positioned at the right place (where it was placed during its creation)
If you move the second box only, the origin is at the right place, but the destination is now at the center of the second box.
Some way I can get around this problem too?
Thanks, Praveen
|