Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Resizing Figures children
Resizing Figures children [message #167967] Sun, 13 January 2008 18:17 Go to next message
Eclipse UserFriend
Originally posted by: surayya.daimi.au.dk

I have RcetEditPart with correspondent complex figure RectFigure
RectFigure extends NodeFigure{

public RectFigure() {
XYLayout xy_layout = new XYLayout();
panel_left = new NodeFigure();
panel_right = new NodeFigure();
TwoBorderedFigure double_border = new TwoBorderedFigure();
******* double_border.setSize(200,70);
createContents();
xy_layout.setConstraint(double_border,new Rectangle(0,0,-1,-1));
xy_layout.setConstraint(panel_left, new Rectangle(10,30,-1,-1));
xy_layout.setConstraint(panel_right,new Rectangle(100, 30, -1 ,-1));

this.setLayoutManager(xy_layout);

this.add(double_border);
this.add(panel_left);
this.add(panel_right);

}
}

And TwoBorderedFigure is just this:

public void paint(Graphics graphics) {
// TODO Auto-generated method stub
Rectangle r = getBounds().getCopy();
graphics.drawRoundRectangle(new Rectangle r.x+10,r.y+10,r.width-20,
r.height-20), 7,7);
graphics.drawRoundRectangle(new Rectangle (r.x+14,r.y+14,r.width-28,
r.height-28), 7,7);
super.paint(graphics);
}

My goal is to place panel left_panel(all Xes labels layout out as
toolbarlayout) and right_panel(all Ys labels layed out as toolbar layout)
on the doubled lines produced by TwoBorderedFigure as on the drwaing:

-------------
-------------
|| ||
XXXXXX YYYYYY
|| ||
XXXXXX YYYYYY
|| ||
XXXXXX YYYYYY
|| ||
-------------
-------------

This figure is layed out using XYLayout
Problem is that i don't want to statically assign the size of the border
to this:
double_border.setSize(200,70);

I want that panels lay presizely on lines and labels can have different
length so static size for border figure will destroy the design

I would like to know the bounds of the parent figure but this is always a
rectangle of 0000 zeros when asked inside the RectFigure

How can i first get the size of the figure that is not null. I guess i
should do it from its editpart asking the model but because i am working
with gmf (autogenerated code)and not gef i don't know how to get the size
of the figure and on creation of the figure set the
double_border.setSize(200,70); to a dynamic value of the figure.

Hope you understand what i mean

I really spent lots of time finding out how this can be fixed to layout
labels on top of border lines

Any help will be appreciated
Regards Surayya
Re: Resizing Figures children [message #169004 is a reply to message #167967] Mon, 21 January 2008 15:06 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Surayya,

Sorry, I did not understand your requirements properly - the picture you
draw looks broken in my reader.. But, AFAIU, you should layout a part of
your figure dynamically to fill some space. I think it's better to use one
of the existing layouts - Border or Grid for these purposes..

If you need an information about size of the diagram element stored in the
notation model you can call org.eclipse.gmf.runtime.notation.Node.getLayoutConstraint().
Node instance is available by calling getModel() on corresponding EditPart
instance.

-----------------
Alex Shatalin
Previous Topic:Validation Failed Unexpectedly for "Gen Top Level Node...
Next Topic:Button in Properties
Goto Forum:
  


Current Time: Thu Apr 25 07:51:06 GMT 2024

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

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

Back to the top