Manhatten routing dummy connections [message #149073] |
Mon, 30 August 2004 14:52  |
Eclipse User |
|
|
|
Greetings,
I am trying to get my dummy connection to "Manhattan route" while it is
being dragged from source to target. I have noticed that several GEF
tools including the Logic example do this, but I can't quite figure out
how do it.
In the edit policy that handles the connection creation, I overrode
createDummyConnection as follows:
protected Connection createDummyConnection(Request req) {
Connection conn = new PolylineConnection();
conn.setConnectionRouter(new ManhattanConnectionRouter());
return conn;
}
When I do something similar for the real connection, it seems to route the
connection just fine, but with the dummy I still get the default
"center-to-center" straight line routing.
Is there something more I need to do here to make this do what I want?
--Cam
|
|
|
|
|
Re: Manhatten routing dummy connections [message #149846 is a reply to message #149260] |
Fri, 03 September 2004 09:57  |
Eclipse User |
|
|
|
> Are you saying that you connection layer's router is NULL, and that the
> policy is getting that null and setting it into your feedback connection?
> Null would probably be a case it should ignore in case the client has set
> another router.
The connection layer's router is set to the Null router (uppercase Null
not lower case null). If you check GraphicalNodeEditPolicy,
getFeedbackHelper looks like below. On the first starred line, it asks
createDummyConnection for a temporary Connection figure. But on the
second starred line it forces the connection router to be the connection
layer's router regardless of whether the dummy has something specific set
that it wants (in my case, Manhattan).
Perhaps you could create a new member methods called
"createDummyConnectionRouter", that by default returns the layer's router,
but can be overridden to return a different. You could then replace the
second starred line with a call to the method. Existing code should be
unbroken.
protected FeedbackHelper getFeedbackHelper(CreateConnectionRequest
request) {
if (feedbackHelper == null) {
feedbackHelper = new FeedbackHelper();
Point p = request.getLocation();
* connectionFeedback = createDummyConnection(request);
ConnectionLayer layer = (ConnectionLayer)getLayer
(LayerConstants.CONNECTION_LAYER);
* connectionFeedback.setConnectionRouter
(layer.getConnectionRouter());
connectionFeedback.setSourceAnchor(getSourceConnectionAnchor
request));
feedbackHelper.setConnection(connectionFeedback);
addFeedback(connectionFeedback);
feedbackHelper.update(null, p);
}
return feedbackHelper;
}
|
|
|
Powered by
FUDForum. Page generated in 0.06000 seconds