How to add an EditPart below the Primary Layer [message #156010] |
Thu, 28 October 2004 14:32  |
Eclipse User |
|
|
|
The GEF editor that I'm working on is a Visual Builder for a 4GL language.
One of the components on my Palette is a GroupBox that is really just a
box drawn around some other components.
The run-time is implemented using Swing, so during Design time with GEF
I'm using ImageFigures that capture an off-screen Swing image (sort of the
same trick that VE uses for WYSIWYG).
Everything works well except when a GroupBox is drawn around some existing
components. Even though the IFigure is transparent, it overlays the
components that it surrounds because the whole offscreen image is used.
I tried to fix this by overriding paintFigure() for the IFigure of the
GroupBox. In the override I only drew the outside of the GroupBox and thus
it would not hide the components it surrounded. But clicking on a
Component inside the GroupBox would select the GroupBox itself and not the
Component that was clicked on.
So I'm thinking the way to fix this would be to place the GroupBox on the
ConnectionLayer of something "below" the PrimaryLayer. I see how to call
ScalableRootEditPart.getLayer(), but have no idea how to use the returned
IFigure to control the layer that my GroupBox is added to. Also feels like
I'd do this in my EditPartFactory, but again see no way to control Layer
there. Also tried overriding AbstractGraphicalEditPart.getLayer() thinking
it would use the value returned, but found that this is never called.
I'm open to suggestions...
|
|
|
|
|
|
Re: How to add an EditPart below the Primary Layer [message #158730 is a reply to message #156254] |
Fri, 19 November 2004 09:41  |
Eclipse User |
|
|
|
Yes, that's exactly what I ended up doing. Turned out to be very easy to
change getModelChildren() to put the GroupBoxes at the end.
Seems to work fine, thanks for your great advice.
Still wonder if there's a way to Layer parts that I create. API didn't
seem to be open to this.
Eugene Ostroukhov wrote:
> I guess, in your case you could write your getModelChildren this way:
> public List getModelChildren() {
> final List children = new LinkedList();
> final Model model = (Model) getModel(); // Your model
> children.addAll(model.getGroupboxes());
> children.addAll(model.getChildren()); // Excluding groupboxes
> return children;
> }
> I guess, using layered approach could overcomplicate your code.
|
|
|
Powered by
FUDForum. Page generated in 0.03607 seconds