Chapter 1. What Is GEF?

The Eclipse Graphical Editing Framework (GEF) facilitates rich graphics such as charts, graphs, and interactive diagrams on a Standard Widget Toolkit (SWT) canvas. This complements the SWT framework, providing developers much more freedom in how their application displays information for their customers.

1.1 GEF Overview

The GEF Eclipse project is composed of three principal frameworks: Draw2D, Zest, and GEF (yes, you read that correctly; the Eclipse project and one framework within that project share the same name: GEF). Draw2D is a lightweight drawing framework for displaying graphical information on an SWT canvas but provides no interactive behavior. Zest is built on top of Draw2D, providing a JFace-like interface for easily binding a Java model with a Draw2D diagram. GEF is also built on top of Draw2D, providing a very rich API for producing interactive diagrams with advanced features, including a palette, drag-and-drop support, a command stack for undoing and redoing commands, support for printing, and much more (see Figure 1–1).

Figure 1–1. GEF Eclipse project structure.

image

We start in Chapter 2 with a simple Draw2D example to get you familiar with the code, then step back in Chapter 3 with an overall look at the Draw2D architecture. Subsequent chapters in the first half of the book walk through concepts such as figures, layouts, connections, and routing algorithms. In the second half of the book, we introduce the Zest and GEF frameworks and cover each of the major concepts therein. Throughout the book, we apply each new concept toward building a genealogy example so that by the end of the book you have a dynamic, interactive, GEF-based diagram.

1.2 GEF Example Applications

The GEF project has four examples leveraging the GEF framework: the Shapes, Flow, Logic, and Text examples. The GEF update site (see Section 11.1.1 on page 185) can be used to download this collection of examples, which can be run through their courses. Being familiar with these examples will give you a good feel for the capabilities and limitations of the GEF framework. With all of the sample programs, the commands such as figure creation, resizing, moving, and connection changes are undoable and redoable on the command stack. The source code is all open source, which may come in handy when you implement your own GEF applications and tools.

1.2.1 Shapes Example

The Shapes editor allows the user to add and remove ellipses and rectangles from the canvas. Also, shapes can be connected with directed connections that are either a solid line or a dotted line (see Figure 1–2).

Figure 1–2. Shapes Example.

image

1.2.2 Flow Example

The Flow example allows the user to design a flow diagram made of sequential and parallel activities (see Figure 1–3).

Figure 1–3. Flow Example.

image

1.2.3 Logic Example

The Logic editor is used to lay out circuits. The palette includes OR, XOR, and AND gates, along with other tools to lay out and test a full circuit. To get started, or as part of a larger circuit example, a complete Half Adder or Full Adder can be added to the canvas directly from the palette (see Figure 1–4).

Figure 1–4. Logic Example.

image

1.2.4 Text Example

This example is a WYSIWYG text editor. Since changes are made with keyboard entries, this editor does not have a palette (see Figure 1–5).

Figure 1–5. Text Example.

image

1.2.5 XMind

XMind is an open source brainstorming and mind-mapping software with both free and paid versions. This software allows its users to create content in the form of Topics and Subtopics and then have the content displayed with various structures, including a map, organization chart, tree, and spreadsheet (see Figure 1–6). This software won the “Best Commercial RCP Application” at EclipseCon in 2008. For more, see www.xmind.net.

Figure 1–6. XMind RCP Application.

image

1.2.6 WindowBuilder

WindowBuilder is a bidirectional WYSIWYG editor for quickly designing SWT, Swing, Google Web Toolkit (GWT) and eRCP Java GUI applications. WindowBuilder allows developers to drag and drop components from a palette to quickly design the graphical part of their application. The editor is full featured, allowing designers to easily modify and add event handlers onto components in the application and to modify all properties with property editors, and it even includes tooling to easily internationalize the application (see Figure 1–7). For more on WindowBuilder see www.eclipse.org/wb.

Figure 1–7. WindowBuilder’s SWT Designer.

image

In 2009, this product won “Best Commercial Eclipse-Based Developer Tool” at EclipseCon. WindowBuilder was acquired by Google in 2010, and the non-GWT tools were donated to the Eclipse Foundation in 2011.

1.3 Summary

This chapter provided a high-level overview of GEF and a number of examples of GEF-based applications. The next chapter will start with a simple Draw2D example on which we will expand throughout the course of the book.

References

Clayberg, Eric, and Dan Rubel, Eclipse Plug-ins, Third Edition. Addison-Wesley, Boston, 2009.

Eclipse-Overview.pdf (available from the eclipse.org Web site).

Eclipse Wiki (see wiki.eclipse.org).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.82.4