In a new project I'm using rectangles to represent equipments with some ports, and connections to represent the linking between two equipments.
However on huge diagrams the connection shapes are stacked and when the user selects a connection I would like to bring it to the front in order to see the whole connection selected.
Any ideas on how I could achieve this? I have already had a look at the PeService#sendToFront() API which should be used for Shapes but there do not seem to be an entry point for Connections... In another thread you said connections are drawn on one single layer above the Shape one but there might be a GEF trick to bring a connection to the front (eg: take its container and set the connection figure as first child, then refresh).
Michael Wenz Messages: 1883 Registered: July 2009 Location: Walldorf, Germany
yes, the sendTo... methods only take shapes. And yes connections are rendered on a different GEF layer.
Without haveing a look into the concrete coding, I expect that the same thing we do in the sendTo... methods for shapes will also work for connections. Basically shapes are stored in ordered collections and drawn in the sequence they are stored in the collection. This means that the last shape is drawn last and thus appears on top.
The same should apply to connections, so placeing the connection in the end of the list should make it appear on top of other connections.
I've just tried the trick and I think it's supposed to work but I cannot find anywhere using the debugger instructions during refresh() for Connections ?! Looks like children shapes & connection decorators are updated during refresh but not Connections.
Edit: I though I had discovered where to look for the bug, actually not...
If you could spend some time on this issue Michael it would be really great! Test case is just to have 2 connections one above the other and to select the lowest one. I'd like to push the selected connection to the Front to see the selected shape .
I'll investigate a bit more on this issue later on and try to find a fix, this will be a blocking issue for my project around mid-january.