Content deleted Content added
Restructured the article and rewrote some passages |
|||
Line 1:
{{Cleanup|date=September 2007}}
'''Graphical Editing Framework''' '''(GEF)''' is a framework that was developed for the [[Eclipse (software)|Eclipse]] platform. It is used to create graphical editors for various diagrams like electrical networks or tree diagrams. Such diagrams offer easy editing capabilities for data in specific domains and are well suited as a graphical representation of that
Editors generated with GEF consist of the following components:
* The diagram editor including tool palette
* Request/command objects that edit the model and provide [[undo]]-redo▼
* Figures which graphically represent the underlying data model elements
* EditParts which match figures and their respective model elements
* Request objects for user input
* EditPolicy objects which evaluate the requests and create appropriate command objects
== Design Pattern Usage ==
GEF makes heavy use of [[design patterns|Design Patterns]]. These patterns are often mandatory under GEF and developers are required to understand them.
=== Model-View-Controller Pattern in GEF ===
[[Model-View-Controller]] is an architectural design pattern which divides an application into seperate parts which communicate which each other in a specific way. The goal is to separate data model (model), graphical user interface (view) and business logic (controller). GEF uses the MVC pattern extensively.
* Controller: The EditParts act as controllers. Typically, each model element has its matching EditPart. EditParts may contain other EditParts thereby matching model elements containing other model elements. EditParts also have a reference to the figure which graphically represents the model element. Finally, EditParts evaluate requests and create the appropriate command to edit the unterlying model.
=== Other Featured Design Patterns ===
* [[Factory pattern|Factory]]: Creating models from palette, creating
▲<u>View:</u> For each element within the model, including connections, a View has to be implemented, using [[draw2d]]. In order to implement the view, an implementation of IFigure of the [[draw2d]] library has to be used.
* [[Observer pattern|Observer]]: Typically a controller (
* [[Strategy pattern|Strategy]]: EditParts can install and remove EditPolicies dynamically
* [[Chain-of-responsibility pattern|Chain of
Any user action
This is achieved using the [[Chain-of-responsibility pattern|Chain of responsibility]] mechanism over Editpolicies
▲=== Request, Response in GEF ===
▲Any user action can be seen as an example of request. The nature of request is understood by the context of invocation. For the discussion, one can safely say that the "context" is determined by the active "tool". Tool can be any entry in palette that is selected by user. We can say that, user using a tool, generates "Requests". The request is handed over to selected editpart, which in turn returns an "Command".
▲This is achieved using [[Chain-of-responsibility pattern|Chain of responsibility]] over Editpolicies, the editpolicies determine if they can handle the request, else pass on to the next editpolicy. The order of declaration of editpolicies determine the order in which the request is passed around. The capable editpolicy creates a command. This command is handed back to the tool which initiated the "Request". Execution of the command causes the model to be modified (Response).
▲* Factory: Creating models from palette, creating ''editparts'' and creating figures.
▲* Observer: Typically a controller (read ''editpart'') listening on Model and View.
▲* Command: To implement Undo and Redo functions.
▲* Chain of Responsibility: To decide which ''EditPolicy'' should handle a ''Request''.
==External links==
|