Customizable ShapeCompartmentEditPart [message #202601] |
Wed, 20 August 2008 05:01  |
Eclipse User |
|
|
|
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 #202776 is a reply to message #202601] |
Thu, 21 August 2008 01:18  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03449 seconds