Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Auto resize of figures/compartments
Auto resize of figures/compartments [message #202487] Tue, 19 August 2008 16:00 Go to next message
Eclipse UserFriend
Originally posted by: fbanica.soluta.net

Hello everybody,

I need some help with this issue: I have a GMF editor which works pretty
well, but I have this request: "the figures should resize (get larger) every
time a new element is added inside of them".

In other words, I have a figure called "Item" which has two compartments,
for two other types of elements: "Attributes" and "Issues". When I add an
Attribute, its compartment resizes automatically, but when I add an Issue
this doesn't happen. I also attached some pictures to make things clear
(hope they are). On the second figure you can notice that scroll-bars appear
on both compartments, instead of resizing the "Item" (the orange rectangle).

Can anyone tell me how to make the editor resize both types of compartments,
please?

Thanks,


Floppy



  • Attachment: Figure2.PNG
    (Size: 65.47KB, Downloaded 261 times)
  • Attachment: Figure1.PNG
    (Size: 65.33KB, Downloaded 226 times)
Re: Auto resize of figures/compartments [message #202830 is a reply to message #202487] Thu, 21 August 2008 08:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fbanica.soluta.net

Anybody? Any idea?


"Florin Banica" <fbanica@soluta.net> wrote in message
news:g8eqnj$jik$1@build.eclipse.org...
> Hello everybody,
>
> I need some help with this issue: I have a GMF editor which works pretty
> well, but I have this request: "the figures should resize (get larger)
> every time a new element is added inside of them".
>
> In other words, I have a figure called "Item" which has two compartments,
> for two other types of elements: "Attributes" and "Issues". When I add an
> Attribute, its compartment resizes automatically, but when I add an Issue
> this doesn't happen. I also attached some pictures to make things clear
> (hope they are). On the second figure you can notice that scroll-bars
> appear on both compartments, instead of resizing the "Item" (the orange
> rectangle).
>
> Can anyone tell me how to make the editor resize both types of
> compartments, please?
>
> Thanks,
>
>
> Floppy
>
>
>
Re: Auto resize of figures/compartments [message #203889 is a reply to message #202830] Fri, 29 August 2008 13:37 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Florin Banica wrote:

>> I need some help with this issue: I have a GMF editor which works pretty
>> well, but I have this request: "the figures should resize (get larger)
>> every time a new element is added inside of them".

Looking for the same feature. I have an StateMachine Diagram where I
want states and compartments always to resize automatically.

This works perfectly but only when I create a fresh diagram, create
fresh nodes and do not touch their size manually. Then adding new
elements to a copartment will cause in automatic new and correct sizing
of the compartment.

When I ever go and manually change the size of an Item by manually drag
its borders, the automatic sizing feature gets disabled for this
element, forever... Did not find any way to turn the autosizer on again.
Only workaround is to manually edit the *_diagram file and remove the
explicit size attributes with a text editor.

So maybe to use this feature consistently you need to dig into the
source code and find its implementation and understand when it gets
activated and when not. Maybe one could manipulate this for the special
needs.

I'm not an expert, but maybe someone who _does_ know about it could
comment on this.

Cheers,
Hauke
Re: Auto resize of figures/compartments [message #203897 is a reply to message #203889] Fri, 29 August 2008 15:22 Go to previous message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

At the beginning your figure has a default -1, -1 size in the model, that
translates to preferred size of the figure, which is determined by the
layout manager. So compartment size is just big enough to fit all its
children. Ones you resize the compartment the size is fixed in the model
and this means that instaed of preferred size you get the one from the
model - the user specified size.
To switch the compartment to auto-size mode (preferred size) you need to
make its size -1, -1 in the notation model. There is an "Auto-Size" button
on the toolbar that does this - I believe this is the answer you're
looking for.
Now, you may disable compartment resize by installing
NonResizableEditPolicy instead of Resizable.
Hope this helps.

Cheers,
Alex
Previous Topic:subgroups in a toolgroup
Next Topic:hiding and redrawing figures
Goto Forum:
  


Current Time: Sat Apr 27 05:08:40 GMT 2024

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

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

Back to the top