Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Is the GEF really a MVC framework?
Is the GEF really a MVC framework? [message #755178] Mon, 07 November 2011 15:41 Go to next message
John M. is currently offline John M.Friend
Messages: 198
Registered: July 2010
Senior Member
Hello guys,

I am confused about the documentation of GEF.

In the tutorials from wwwdotvainolodotcom/tutorials/ the position of the model is saved in the model. I want to save all data to file and want to get the same view, when I load the file.

Searching for an answer for this question, I got another more important question:
Is the GEF really a MVC framework?

GEF Section Controllers tells the mvc controller role is taken from the EditPart. It creates the specified objects.
Regarding the GEF_Description Section Listening_to_the_model the controller holds view parts, but the mvc pattern tells, that the controller only reacts on user interaction and tells the view, it has to update or what ever.
Concluding on it the following code is wrong, because it is part of EditPart and it changes:

	public void refreshVisuals(){
		IPersonFigure figure = (IPersonFigure)getFigure();
		Person model = (Person)getModel();
		figure.setName(model.getName());
		figure.setSurname(model.getSurname());
	}


Regarding wikipedia mvc the view has an observer on the model, so the following sentence from GEF is wrong, isn't it?
The EditPart syncs the actual model state to the view and implements the observer.
Quote:
In the MVC pattern, the controllers must listen to the changes of the model. In GEF, EditParts are the controllers so they must listen to their model to update the view according to the new state of the model.


So what is correct?

To prevent crossposting look have a look on StackOverflow and search for Is the GEF really a MVC framework? (8038578), too.
Re: Is the GEF really a MVC framework? [message #755449 is a reply to message #755178] Tue, 08 November 2011 14:54 Go to previous message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 244
Registered: July 2009
Location: Lünen
Senior Member
Hello,

concerning your first question I am not quite aware that you mean with "and want to get the same view, when I load the file". GEF is fully application neutral (also with respect to the model persistence technology), so its all up to you where you store the information you want to edit.

Second, yes, GEF is a MVC framework, because it clearly separates between model, view and controller, which is imposed by the MVC architecture pattern. By playing the controller role, EditParts have two responsibilities:

1) map the model elements to their respective view elements (the mapping of the EditPart to model elements is performed by an EditPartFactory
2) React to user input, i.e. update the model as a reaction to user interaction and ensure the views get updated on model changes.

Whether the view registers itself on the model or the controller does this (and notifies the view about it) is a detail you may find to differ in various concrete MVC implementations (take e.g. a look how it is done in the J2EE context). As such, I think that to be a rather academic discussion, and as the way GEF interprets the MVC paradigm is in my eyes completely reasonable, I think both are correct (to answer your questions).

Cheers,
Alexander
Previous Topic:GEF and e4
Next Topic:Gef Connection source and endpoint location update
Goto Forum:
  


Current Time: Fri Apr 26 04:28:01 GMT 2024

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

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

Back to the top