Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Compartments to fit children
Compartments to fit children [message #237323] Thu, 23 July 2009 12:36 Go to next message
Josip Maras is currently offline Josip MarasFriend
Messages: 41
Registered: July 2009
Member
Hi,

Does anybody now the solution to the following problem:

I have a parent component which stores it's children in a compartment -
how can i make the parent component fit its children (it needs to resize
when accepting new children)??

The whole thing works if i create the parent component with one click, but
if i outline the parent component while creating it then the parent
component keeps the given dimensions and creates a scroll bar within if
the child size is greater then parent size.

I'll take any ideas, i'm banging my head with this one...


Thank you
Re: Compartments to fit children [message #237336 is a reply to message #237323] Thu, 23 July 2009 13:22 Go to previous messageGo to next message
Gary is currently offline GaryFriend
Messages: 125
Registered: July 2009
Senior Member
You could try to set 'preferred size' in your figure descriptor for your
node!
I did a quick test and it seams to work ok!

let me know how you get on,
hope this helps,
Gary
Re: Compartments to fit children [message #237403 is a reply to message #237336] Fri, 24 July 2009 09:33 Go to previous messageGo to next message
Josip Maras is currently offline Josip MarasFriend
Messages: 41
Registered: July 2009
Member
Thank you,

I've all ready done that, but unfortunately it isn't working.
Here is a video that more accurately describes the situation:

http://www.fesb.hr/~jomaras/videos/component/comp.html

or just the video at: http://www.fesb.hr/~jomaras/videos/component/comp.mp4

Thank you
Re: Compartments to fit children [message #237445 is a reply to message #237403] Fri, 24 July 2009 20:43 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
You could try override the getMinimumSize() to return the preferred size.
Something like:
@Override

public Dimension getMinimumSize(int hint, int hint2) {

return super.getPreferredSize(hint, hint2);

}

From you video I see that you are explicitly setting the size. If you
select "Auto Size" from the toolbar, your figure would expand out. The
width and height constraints need to remain -1, -1 for the preferred size to
accomodate all the children.

Regards,
- James.


"Josip Maras" <jomaras@gmail.com> wrote in message
news:58cddf5ae94d4a7fc9b26902b2ee0be5$1@www.eclipse.org...
> Thank you,
>
> I've all ready done that, but unfortunately it isn't working. Here is a
> video that more accurately describes the situation:
>
> http://www.fesb.hr/~jomaras/videos/component/comp.html
> or just the video at:
> http://www.fesb.hr/~jomaras/videos/component/comp.mp4
>
> Thank you
>
>
>
Re: Compartments to fit children [message #237451 is a reply to message #237445] Fri, 24 July 2009 20:44 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
... or

@Override

public Dimension getMinimumSize(int hint, int hint2) {

return getPreferredSize();

}



"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:h4d66p$nio$1@build.eclipse.org...
> You could try override the getMinimumSize() to return the preferred size.
> Something like:
> @Override
>
> public Dimension getMinimumSize(int hint, int hint2) {
>
> return super.getPreferredSize(hint, hint2);
>
> }
>
> From you video I see that you are explicitly setting the size. If you
> select "Auto Size" from the toolbar, your figure would expand out. The
> width and height constraints need to remain -1, -1 for the preferred size
> to accomodate all the children.
>
> Regards,
> - James.
>
>
> "Josip Maras" <jomaras@gmail.com> wrote in message
> news:58cddf5ae94d4a7fc9b26902b2ee0be5$1@www.eclipse.org...
>> Thank you,
>>
>> I've all ready done that, but unfortunately it isn't working. Here is a
>> video that more accurately describes the situation:
>>
>> http://www.fesb.hr/~jomaras/videos/component/comp.html
>> or just the video at:
>> http://www.fesb.hr/~jomaras/videos/component/comp.mp4
>>
>> Thank you
>>
>>
>>
>
>
Re: Compartments to fit children [message #237511 is a reply to message #237451] Mon, 27 July 2009 07:27 Go to previous message
Josip Maras is currently offline Josip MarasFriend
Messages: 41
Registered: July 2009
Member
Hi James, THANK YOU!!

I've overridden the getMinimumSize() method in the parent figure
descriptor - and now everything works - thank you.

In the last couple of days i've tried a lot of, now i see, complicated
things - but this works just fine..

Thanks
Previous Topic:Multiple (or more than one) compartments on canvas
Next Topic:Cascade deletion in EMF/GMF
Goto Forum:
  


Current Time: Thu Apr 25 01:54:31 GMT 2024

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

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

Back to the top