Skip to main content



      Home
Home » Eclipse Projects » GEF » Need help in PolylineConnection
Need help in PolylineConnection [message #168642] Thu, 17 February 2005 10:37
Eclipse UserFriend
Originally posted by: pengfai.hotmail.com

hi...i encounter problem like below:
Once i add the polylineConnection between two nodes,
the nodes's location are relocated out of order and the conneciton line
not linked each others.

However,the nodes are well located if i comment out the "add connection
command". The same problem when i try with BorderLayout. Is that the
layout itself mess up or PolylineConnection matter?
Of course, the XYLayout will give the desire result.


// customize layout
public void layout(IFigure parent)
{ Rectangle area = parent.getClientArea();
List children = parent.getChildren();
IFigure child;

centralNode(parent);
for (int i=0;i<children.size();i++)
{ child = (IFigure)children.get(i);
Rectangle rect = new Rectangle();
if (child.equals(center))
{continue;}

else if(child!=center && child.isVisible()){
rect.x =(int)(center.getBounds().x +
radius*(Math.cos(i*getAngle(parent)))) rect.y
=(int)(center.getBounds().y+radius*(Math.sin(i*getAngle(pare nt))));

area.x = rect.x;
area.y = rect.y;

}
child.setBounds(area);
}
}

PolylineConnection c1 = new PolylineConnection();
ChopboxAnchor sourceAnchor1 = new ChopboxAnchor(node1);
ChopboxAnchor targetAnchor1 = new ChopboxAnchor(node2);
c1.setSourceAnchor(sourceAnchor1);
c1.setTargetAnchor(targetAnchor1);
panel.add(c1); // problems when invoke

thanks in advance..
Previous Topic:displaying graph in popup window
Next Topic:Sharing an EditDomain among multiple editors?
Goto Forum:
  


Current Time: Mon Jun 16 19:15:23 EDT 2025

Powered by FUDForum. Page generated in 0.03934 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top