Skip to main content



      Home
Home » Eclipse Projects » GEF » Edge-specific router?
Edge-specific router? [message #71646] Thu, 20 March 2003 09:58 Go to next message
Eclipse UserFriend
Hi -

Trying to find a way to 'turn off' Manhattan Routing on a per-edge basis,
that is, I'd like to select default Manhattan routing for a diagram, but
(via property setting) have certain edges routed manually. Is it
presently possible to do this, or is the manual/Manhattan router applied
to everything automatically?

Tried modifying the logic in (Logic Example)
LinkEditPart.refreshBendpoints() and refreshBendpointEditPolicy(), based
on 'manual override' property set in the model. Unfortunately, switching
in the 'manual' version of the logic based on the property setting (per
edge) resulted in the Manhattan router still being used on all edges.

If it's possible to do this, is there another point in the figure
hierarchy where changes are required?

thanks!

Ron
Re: Edge-specific router? [message #71705 is a reply to message #71646] Thu, 20 March 2003 10:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

For convenience, the ConnectionLayer takes an *optional* ConnectionRouter,
and whenever a connection is added or removed to that layer, it has its
connection router set. This means all connections have the same router in
the logic example. To change this, you would have to remove the router from
the connectionlayer, and set the router some other way, probably in
refresh...() on the ConnectionEditPArt

"Ron" <rr.cm@cox.net> wrote in message news:b5ckui$kcd$1@rogue.oti.com...
> Hi -
>
> Trying to find a way to 'turn off' Manhattan Routing on a per-edge basis,
> that is, I'd like to select default Manhattan routing for a diagram, but
> (via property setting) have certain edges routed manually. Is it
> presently possible to do this, or is the manual/Manhattan router applied
> to everything automatically?
>
> Tried modifying the logic in (Logic Example)
> LinkEditPart.refreshBendpoints() and refreshBendpointEditPolicy(), based
> on 'manual override' property set in the model. Unfortunately, switching
> in the 'manual' version of the logic based on the property setting (per
> edge) resulted in the Manhattan router still being used on all edges.
>
> If it's possible to do this, is there another point in the figure
> hierarchy where changes are required?
>
> thanks!
>
> Ron
>
Re: Edge-specific router? [message #71743 is a reply to message #71705] Thu, 20 March 2003 11:25 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Randy -

Randy Hudson wrote:

> [snip] To change this, you would have to remove the router from
> the connectionlayer, and set the router some other way, probably in
> refresh...() on the ConnectionEditPArt

Tried this, but wasn't sure it was the right approach and started looking
elsewhere when I couldn't find the right combination to keep from blowing
up. Will look into it further.

Might another feasible approach be to create a 'custom' Connection Layer -
i.e., one that always uses the manual routing - and add all manually
routed connections (using switching logic in activateFigure()) to that
layer instead of the CONNECTION_LAYER?

Thanks again,

Ron
Re: Edge-specific router? [message #71781 is a reply to message #71743] Thu, 20 March 2003 12:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Ron" <rr.cm@cox.net> wrote in message news:b5cq2j$ost$1@rogue.oti.com...
> Thanks Randy -
>
> Randy Hudson wrote:
>
> > [snip] To change this, you would have to remove the router from
> > the connectionlayer, and set the router some other way, probably in
> > refresh...() on the ConnectionEditPArt
>
> Tried this, but wasn't sure it was the right approach and started looking
> elsewhere when I couldn't find the right combination to keep from blowing
> up. Will look into it further.
>
> Might another feasible approach be to create a 'custom' Connection Layer -
> i.e., one that always uses the manual routing - and add all manually
> routed connections (using switching logic in activateFigure()) to that
> layer instead of the CONNECTION_LAYER?

Yes, but then when the use changes routing, you would have to reparent the
connection figure, or call activeFigure() again. Calling activeFigure() more
than once has undefined behavior. Also, the Z-order of the connection would
change, although this might not be detectable to the user.

>
> Thanks again,
>
> Ron
>
>
>
Re: Edge-specific router? [message #71876 is a reply to message #71781] Thu, 20 March 2003 17:58 Go to previous messageGo to next message
Eclipse UserFriend
Thanks -

> > Randy Hudson wrote:
> >
> > > [snip] To change this, you would have to remove the router from
> > > the connectionlayer, and set the router some other way, probably in
> > > refresh...() on the ConnectionEditPArt
> >
> > Tried this, but wasn't sure it was the right approach and started looking
> > elsewhere when I couldn't find the right combination to keep from blowing
> > up. Will look into it further.

After looking further, I discovered that altering the connection router
setting in refresh...() was causing a Stack Overflow (infinite recursion).
Had to use a static flag to prevent this (icky, but works). With that
fixed, your original suggestion worked very well, with one caveat: when
the route mode of an individual connection is changed, it doesn't seem to
get redrawn, even if I manually getConnectionFigure().invalidate(). I had
to force a re-layout of all connections in propertyChange() on
ConnectionEditPart. For some reason, this didn't do the trick:

ConnectionLayer c = (ConnectionLayer)getLayer(CONNECTION_LAYER);
c.invalidate(); // doesn't work...???

I had to do this:

ConnectionLayer c = (ConnectionLayer)getLayer(CONNECTION_LAYER);
ConnectionRouter cr = c.getConnectionRouter();
c.setConnectionRouter( null );
c.setConnectionRouter(cr);

(also icky, but works).

Getting the desired behavior, thanks to your suggestion. Any
critique/suggestions appreciated.

cheers!

Ron
Re: Edge-specific router? [message #71888 is a reply to message #71876] Thu, 20 March 2003 18:33 Go to previous messageGo to next message
Eclipse UserFriend
Ron wrote:
> ConnectionLayer c = (ConnectionLayer)getLayer(CONNECTION_LAYER);
> c.invalidate(); // doesn't work...???

You should call c.revalidate() here. That way the UpdateManager will be
notified and will perform an update.

> I had to do this:
>
> ConnectionLayer c = (ConnectionLayer)getLayer(CONNECTION_LAYER);
> ConnectionRouter cr = c.getConnectionRouter();
> c.setConnectionRouter( null );
> c.setConnectionRouter(cr);
>
> (also icky, but works).
Re: Edge-specific router? [message #71907 is a reply to message #71876] Thu, 20 March 2003 20:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Please open a bugzilla. Connection's should call revalidate() on
themselves, I guess we missed this usage. This is analagous to
Figure.setLayoutManager(LayoutManager), which does correctly call
revalidate().

"Ron" <rr.cm@cox.net> wrote in message news:b5dh32$bs4$1@rogue.oti.com...
> Thanks -
>
> > > Randy Hudson wrote:
> > >
> > > > [snip] To change this, you would have to remove the router from
> > > > the connectionlayer, and set the router some other way, probably in
> > > > refresh...() on the ConnectionEditPArt
> > >
> > > Tried this, but wasn't sure it was the right approach and started
looking
> > > elsewhere when I couldn't find the right combination to keep from
blowing
> > > up. Will look into it further.
>
> After looking further, I discovered that altering the connection router
> setting in refresh...() was causing a Stack Overflow (infinite recursion).
> Had to use a static flag to prevent this (icky, but works). With that
> fixed, your original suggestion worked very well, with one caveat: when
> the route mode of an individual connection is changed, it doesn't seem to
> get redrawn, even if I manually getConnectionFigure().invalidate(). I had
> to force a re-layout of all connections in propertyChange() on
> ConnectionEditPart. For some reason, this didn't do the trick:
>
> ConnectionLayer c = (ConnectionLayer)getLayer(CONNECTION_LAYER);
> c.invalidate(); // doesn't work...???
>
> I had to do this:
>
> ConnectionLayer c = (ConnectionLayer)getLayer(CONNECTION_LAYER);
> ConnectionRouter cr = c.getConnectionRouter();
> c.setConnectionRouter( null );
> c.setConnectionRouter(cr);
>
> (also icky, but works).
>
> Getting the desired behavior, thanks to your suggestion. Any
> critique/suggestions appreciated.
>
> cheers!
>
> Ron
>
Re: Edge-specific router? [message #72022 is a reply to message #71888] Fri, 21 March 2003 09:24 Go to previous message
Eclipse UserFriend
Eric Bordeau wrote:

> Ron wrote:
> > ConnectionLayer c = (ConnectionLayer)getLayer(CONNECTION_LAYER);
> > c.invalidate(); // doesn't work...???

> You should call c.revalidate() here. That way the UpdateManager will be
> notified and will perform an update.


Thanks Eric - I tried this but got the same behavior, i.e., the connection
is not redrawn when the route mode is changed. I tried all the following
from within the ConnectionEditPart's propertyChange() method:

getConnectionFigure().invalidate() / .revalidate()
and
Connection c = getConnectionFigure();
ConnectionRouter cr = c.getConnectionRouter();
c.setConnectionRouter( null );
c.setConnectionRouter(cr);
and
((ConnectionLayer)getLayer(CONNECTION_LAYER)).invalidate() /
revalidate()

Only manually re-setting the connection router on the connection layer
(i.e., to null and then back to original object) seems to cause an
immediate redraw.

I'll submit this via bugzilla, as Randy suggested.

cheers,

Ron
Previous Topic:Deleting EditParts
Next Topic:setBackgroundColor doesn't work, why?
Goto Forum:
  


Current Time: Fri Jul 25 19:39:59 EDT 2025

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

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

Back to the top