Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Manhatten routing dummy connections
Manhatten routing dummy connections [message #149073] Mon, 30 August 2004 18:52 Go to next message
Cameron Bateman is currently offline Cameron BatemanFriend
Messages: 39
Registered: July 2009
Member
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 #149089 is a reply to message #149073] Mon, 30 August 2004 21:32 Go to previous messageGo to next message
Cameron Bateman is currently offline Cameron BatemanFriend
Messages: 39
Registered: July 2009
Member
Okay, I seem to have figured part of the problem. It turns out that
GraphicalNodeEditPolicy, which my edit policy is sub-classing overrides
the dummy connection's ConnectionRouter to the connection layer's default
router in getFeedbackHelper.

For now I'm going to work-around this by overriding this method so it uses
the connection router that I want.

Is there a more "correct" way to do this?


--Cam

Cameron Bateman wrote:

> 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 #149260 is a reply to message #149089] Tue, 31 August 2004 18:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

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.

"Cameron Bateman" <cbateman@rim.com> wrote in message
news:ch06e5$lsh$1@eclipse.org...
> Okay, I seem to have figured part of the problem. It turns out that
> GraphicalNodeEditPolicy, which my edit policy is sub-classing overrides
> the dummy connection's ConnectionRouter to the connection layer's default
> router in getFeedbackHelper.
>
> For now I'm going to work-around this by overriding this method so it uses
> the connection router that I want.
>
> Is there a more "correct" way to do this?
>
>
> --Cam
>
> Cameron Bateman wrote:
>
> > 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 13:57 Go to previous message
Cameron Bateman is currently offline Cameron BatemanFriend
Messages: 39
Registered: July 2009
Member
> 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;
}
Previous Topic:Simple example code using GEF
Next Topic:Paste Action
Goto Forum:
  


Current Time: Fri Apr 26 02:54:59 GMT 2024

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

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

Back to the top