Skip to main content
Jump to: navigation, search

VE Graphical Viewer / Java Beans Tree

Revision as of 12:32, 18 October 2007 by (Talk | contribs) (Graphical Viewer / Java Beans Tree)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Graphical Viewer and Java Beans Tree are provided by Eclipse's Graphical Editing Framework (GEF) and are based on a Model-View-Controller (MVC) architecture – see illustration 5.

Illustration 5:MVC model used by GEF

Eclipse VE uses the EMF 'VE' model as the model. The controllers are GEF EditParts of which there are two different types, GraphicalEditParts for the Graphical Viewer and TreeEditParts for the Java Beans Tree. The views or EditPartViewers are either figures from the Draw2D plug-in for the Graphical Viewer or SWT Trees for the Java Beans Tree.

GEF allows users to specify the mappings between the EditParts, EditPartViewers and model elements. In Eclipse VE though there is a one-to-one mapping between them. Relationships between elements in the Eclipse 'VE' model are reflected in the EditParts and EditPartViewers – see illustration 7.

Illustration 7:Relationship between EditParts, EditPartViewers and IJavaInstances in the VE Model

Not all elements in the Eclipse VE model are represented in the Graphical Viewer / Java Beans Tree. On the Graphical Viewer only the IJavaObjectInstances representing the visual components such as JFrame, JPanel, JButton etc. are represented. In the Java Beans Tree these components are shown as well as any events declared on the components. User actions are handled by a GEF Tool. This tool requests a Command from the appropriate EditPart. The EditPart delegates the building of the Command to EditPolicies. These policies can decide if the request for a Command is valid or not and produce the appropriate command if it is. For invalid requests feedback is provided to the user through the cursor. Once built the Command is run using the GEF CommandStack. Illustration 8 shows the interaction between the GEF components.

Illustration 8:Interaction of GEF Tools, EditParts, EditPolicies and the CommandStack

In order to get accurate images of what the model objects will look like, Eclipse VE instantiates proxy instances in a separate VM, invokes the methods on these proxies that are in the source code and then retrieves the images of the proxies. These images are placed in the EditPartViewer figures in the Graphical Viewer. In this way the Graphical Viewer is an accurate preview of the GUI being built.

Back to the top