Flylib.com

Books Software

 
 
 

Chapter 3: Introduction to GEF

 < Day Day Up > 


Chapter 3: Introduction to GEF

Overview

In this chapter, we provide an introduction to GEF and Draw2D. You can read about the basics of the frameworks and get some first tips about using them.

After the introduction, we show you how to build a graphical editor skeleton using our step-by-step instructions, and then explain how to map your model into GEF edit parts .

Note 

The sample code we describe in this chapter is available as part of the redbook additional material. See Appendix A, "Additional material" on page 225 for details on how to obtain and work with the additional material. The sample code for this chapter is provided as Eclipse projects that can be imported into your Eclipse workbench. Each major section of this chapter has a matching Eclipse project in the additional material.



 < Day Day Up > 
 < Day Day Up > 


3.1 What is the Graphical Editing Framework?

The Graphical Editing Framework allows us to easily develop graphical representations for existing models. It is possible to develop feature rich graphical editors using GEF.

All graphical visualization is done via the Draw2D framework, which is a standard 2D drawing framework based on SWT from eclipse.org.

The editing possibilities of the Graphical Editing Framework allow you to build graphical editors for nearly every model. With these editors, it is possible to do simple modifications to your model, like changing element properties or complex operations like changing the structure of your model in different ways at the same time.

All these modifications to your model can be handled in a graphical editor using very common functions like drag and drop, copy and paste, and actions invoked from menus or toolbars .

For our demonstration code and for explanations of the GEF API, we used the latest code releases that were available during the creation of this redbook: Eclipse 2.1.1 and GEF 2.1.1.

3.1.1 Additional documents and resources

Basically there are two kinds of additional resources available — one that ships with the Graphical Editing Framework and other freely available on the Internet.

Integrated Eclipse help

The Graphical Editing Framework SDK provides online help that is integrated into Eclipse. This should be used as a starting point. It is available by clicking Help -> Help Contents and then clicking the topic Draw2D Developers Guide or GEF Developer Guide on the left side of the new window.

Note 

Only the GEF SDK is shipped with the developer documentation of GEF and Draw2D.

Resources on the Web

The GEF Web site provides access to a wide range of resources related to the Graphical Editing Framework, including code releases, examples, and documentation:

  • http://www.eclipse.org/gef

Any questions and topics not answered by the frequently asked questions (FAQ) feature, available at the GEF Web site, can be discussed in the GEF newsgroup ( eclipse.tools.gef ), which is available at the Eclipse news server ( news.eclipse.org ).

A public community driven pool is available at:

  • http://eclipsewiki.swiki.net

The Eclipse Wiki also has a section for GEF related topics, which provides an additional list of answers for frequently asked questions and additional examples and other resources.

3.1.2 Applications suitable for GEF

We found numerous applications developed with GEF. Thanks to the authors of these applications, we are able to show you the following screen captures of sample applications using GEF. As you will see, there is no limit on using a graphical editor for nearly every case.

The most common case might be a modelling application. You can build graphical editors for modelling nearly every kind of situation (for example, business processes, application models, or even UI screens).

There are also graphical editors available for designing documents such as reports , Web sites, or forms. You can develop graphical editors for modifying environments (for example, configuration files of applications, servers, or deployment descriptors for enterprise applications — or even for routing trains).

The possibilities are only limited by your imagination !

MDE for Struts

Available as an Eclipse-based IDE or plug-in, MDE for Struts (Figure 3-1) enables model-driven development of Struts 1.1 applications using standard UML. From simple class diagrams, MDE for Struts creates JSPs, Java classes, struts-config.xml, validator.xml, Application Resource, ANT build scripts and J2EE deployment files. You can take control of the architecture by changing Java MetaPrograms that translate the model to code. A free evaluation version is available at:

  • http://www.metanology.com

click to expand
Figure 3-1: Struts MDE

AcmeStudio

AcmeStudio (Figure 3-2) is a customizable editing environment and visualization tool for software architecture designs based on the Acme architectural description language (ADL). With AcmeStudio, you can define new Acme families for specific domains and customize the environment to work with those families by defining new diagram styles. AcmeStudio is an adaptable front-end that may be used in a variety of modeling and analysis applications. Written as an Eclipse plug-in, AcmeStudio provides the opportunity to integrate third-party architectural analysis tools.

click to expand
Figure 3-2: AcmeStudio

AcmeStudio is being developed at the School of Computer Science at Carnegie Mellon University. This work is supported in part by DARPA under Grants N66001-99-2-8918 and F30602-00-2-0616, and by the High Dependability Computing Program from NASA Ames, cooperative agreement NCC-2-11298.

EclipseDesigner

EclipseDesigner (Figure 3-3) is a two-way visual designer for SWT. Design editing can be done in Java editor or visually on a design page using property tables and mouse manipulations in a GEF editor. It is freely available at:

  • http://eclipsedesigner. sourceforge .net

click to expand
Figure 3-3: EclipseDesigner

Jeez Report Designer

Jeez Report Designer (Figure 3-4) allows visual designing of reports that can be executed using a report engine. It is freely available at:

  • http://jeez.sourceforge.net

click to expand
Figure 3-4: Jeez Report Designer



 < Day Day Up >