Connection endpoint problem [message #192218] |
Tue, 16 August 2005 21:03 |
Eclipse User |
|
|
|
Originally posted by: prb113.york.ac.uk
Hi I am having a problem creating connections between edit parts. I've
found varios similar problems on the news groups but not the same as the
one I am experiencing.
I have edit parts implementing NodeEditPart and each of the
getSource/TargetConnectionAnchor() methods returns the result of the
method getConnectionAnchor which is basically copied from the shapes
example.
However, when I try to draw a connection, the feedback is all correct but
the final result yields two arrows, one going from the source to a point
at about (100, 100) and another going from a point at about (0,0) to the
target. I'm guessing that I am returning incorrect connection anchors but
I can't see where it goes wrong.
can you help?
|
|
|
Re: Connection endpoint problem [message #192290 is a reply to message #192218] |
Wed, 17 August 2005 20:16 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> I have edit parts implementing NodeEditPart and each of the
> getSource/TargetConnectionAnchor() methods returns the result of the
> method getConnectionAnchor which is basically copied from the shapes
> example.
All four methods?? 2 are used during feedback, 2 once an editpart actually
exists.
|
|
|
Re: Connection endpoint problem [message #193819 is a reply to message #192290] |
Mon, 29 August 2005 11:09 |
Eclipse User |
|
|
|
Originally posted by: prb113.york.ac.uk
Yes I have implemented all four methods.
They all return the method shown below:
anchor is a field declared in the class.
protected ConnectionAnchor getConnectionAnchor() {
if(anchor==null) {
if(getModel() instanceof Box)
anchor = new ChopboxAnchor(getFigure());
else if(getModel() instanceof AbstractNode)
anchor = new EllipseAnchor(getFigure());
else
throw new IllegalArgumentException("unexpected model");
}
return anchor;
}
Is it correct for the methods to always return the same ancor once it has
been created?
|
|
|
Solved!! [message #194041 is a reply to message #193819] |
Tue, 30 August 2005 13:45 |
Eclipse User |
|
|
|
Originally posted by: prb113.york.ac.uk
Found the problem. I'd simply forgot to set the model in the constructor
of the Connection editpart. It works now.
thanks for your help
Paul
|
|
|
Powered by
FUDForum. Page generated in 0.05842 seconds