Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » MVC
MVC [message #248106] Mon, 06 April 2009 15:56 Go to next message
luciano is currently offline lucianoFriend
Messages: 16
Registered: July 2009
Junior Member
I have an editor similar to the standard logic editor. As an add-on, if an
element within a container is resized in such a way that it is not anymore
totally visible, I would like to change the size of the container as well.
This process can naturally cascade to the next outer container and so on.
To support undo/redo , I want to have the whole thing in one command. What
is the cleanest way to do this, especially with respect to the
MVC-architecture of GEF? Are there any samples available doing something
similar?

Thanks,
Luzi
Re: MVC [message #248134 is a reply to message #248106] Tue, 07 April 2009 20:59 Go to previous messageGo to next message
Ben Vitale is currently offline Ben VitaleFriend
Messages: 247
Registered: July 2009
Senior Member
If it were me, I would just write a blob of code in my Command to resize
all the model objects, in whatever order I feel like. If the model
objects fire their own change events, fine. If you fire off one
notification at the end, also fine. When the event is received by the
various edit parts that represent the containers, they will update their
figures.

Draw2D uses a deferred painting mechanism by default, so most likely all
the resizes (at the Figure level) will get repainted at once and the
user won't even notice the cascade effect.

Thoughts?
Ben

luciano wrote:
> I have an editor similar to the standard logic editor. As an add-on, if
> an element within a container is resized in such a way that it is not
> anymore totally visible, I would like to change the size of the
> container as well. This process can naturally cascade to the next outer
> container and so on. To support undo/redo , I want to have the whole
> thing in one command. What is the cleanest way to do this, especially
> with respect to the MVC-architecture of GEF? Are there any samples
> available doing something similar?
>
> Thanks,
> Luzi
>
>
>
Re: MVC [message #248146 is a reply to message #248134] Wed, 08 April 2009 07:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: luzi.anderegg.ergon.ch

Ben Vitale wrote:
> If it were me, I would just write a blob of code in my Command to resize
> all the model objects, in whatever order I feel like. If the model
> objects fire their own change events, fine. If you fire off one
> notification at the end, also fine. When the event is received by the
> various edit parts that represent the containers, they will update their
> figures.

In principal, I would use the approach you suggest. The problem is that
in some cases I only know after drawing the figures that I have to
resize the container. Therefore, I am not sure whether I use the MVC
approach in GEF correctly. Any ideas?



>
> Draw2D uses a deferred painting mechanism by default, so most likely all
> the resizes (at the Figure level) will get repainted at once and the
> user won't even notice the cascade effect.
>
> Thoughts?
> Ben
>
> luciano wrote:
>> I have an editor similar to the standard logic editor. As an add-on,
>> if an element within a container is resized in such a way that it is
>> not anymore totally visible, I would like to change the size of the
>> container as well. This process can naturally cascade to the next
>> outer container and so on. To support undo/redo , I want to have the
>> whole thing in one command. What is the cleanest way to do this,
>> especially with respect to the MVC-architecture of GEF? Are there any
>> samples available doing something similar?
>>
>> Thanks,
>> Luzi
>>
>>
>>
Re: MVC [message #248155 is a reply to message #248146] Wed, 08 April 2009 14:19 Go to previous message
Ben Vitale is currently offline Ben VitaleFriend
Messages: 247
Registered: July 2009
Senior Member
Luzi Anderegg wrote:
>
> In principal, I would use the approach you suggest. The problem is that
> in some cases I only know after drawing the figures that I have to
> resize the container. Therefore, I am not sure whether I use the MVC
> approach in GEF correctly. Any ideas?
>

If you only know after drawing, it sounds like you are using the figure
as your model. You need a simple bean model with no dependencies on GEF
or Draw2D to hold information about the current state of your diagram.
The figures are just a visual representation of that model.

Feel free to elaborate more on the specific cases that are problematic.

-Ben
Previous Topic:Multiple Content Outline
Next Topic:Help in understaning Container EditPart
Goto Forum:
  


Current Time: Fri Apr 19 23:37:34 GMT 2024

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

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

Back to the top