Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Customizable ShapeCompartmentEditPart
Customizable ShapeCompartmentEditPart [message #202601] Wed, 20 August 2008 09:01 Go to next message
Eclipse UserFriend
Originally posted by: knakov.scopeset.de

Hello,

I need a ShapeCompartmentEditPart which I can customize dynamically when
the size changes. For example I need the compartment to be resized with
a specific size when the parent symbol is resized. In another more
expressive words, I need a compartment in the middle of a rounded
rectangle so that when I resize this rectangle vertically the
compartment should be stretched vertically too.

I tried all refresh() methods of the parent and the
ShapeCompartmentEditPart child with no success. Currently I use
ConstrainedToolbarLayout layout manager for the rounded rectangle.
Should I create my own layout manager or there is a simpler solution for
my ordinary case?

Thanks in advance,
Kalin
Re: Customizable ShapeCompartmentEditPart [message #202768 is a reply to message #202601] Thu, 21 August 2008 05:04 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

Yes, there is a way not to override the layout manager. Override
#getClientArea() on your rounded rectangle figure (compartment's parent).
Return the rectangle where your shape compartment needs to be. Don't
forget that figure's client area must be contained within the bounds of
the figure.
Hope this helps.

Cheers,
Alex
Re: Customizable ShapeCompartmentEditPart [message #202776 is a reply to message #202601] Thu, 21 August 2008 05:18 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
I meant that if you express the client area rectangle in terms of your
bounds rectangle, the compartment will grow in size as bounds of the
figure grow in size. Rectangle#shrink(int h, int v) should do the client
area rectangle for trick for you.
Examples:
public Rectangle getClientArea(Rectangle rect) {
Rectangle area = super.getClientArea(rect);
area.shrink(area.width / 4 , area.height / 4);
return area;
}

or
public Rectangle getClientArea(Rectangle rect) {
IMapMode mm = MapModeUtil.getMapMode(this);
Rectangle area = super.getClientArea(rect);
area.shrink(mm.DPtoLP(5) , mm.DPtoLP(5));
return area;
}

Cheers,
Alex
Previous Topic:tool doesn't work
Next Topic:Using a different feature for Containment and for Display
Goto Forum:
  


Current Time: Fri Apr 26 04:42:55 GMT 2024

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

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

Back to the top