This page is from the outdated yFiles for Java 2.13 documentation. You can find the most up-to-date documentation for all yFiles products on the yFiles documentation overview page.
Please see the following links for more information about the yFiles product family of diagramming programming libraries and corresponding yFiles products for modern web apps, for cross-platform Java(FX) applications, and for applications for the Microsoft .NET environment.
Table of Contents
This chapter shows how to render a graph in a so-called "view." It presents the classes that are responsible for the visual representation of graph elements and explains their contribution to the "look and feel" of an application. Furthermore, it shows how user interaction with both graph elements and the view containing a graph is handled.
Package y.view bundles the yFiles classes that provide user interface (UI) functionality. UI functionality comprises two main aspects, namely the representation of a graph structure to the user and the interaction of a user with the graph structure.
The classes from package y.view reflect the Model-View-Controller (MVC) paradigm, i.e., conceptually they can be divided into three types, each having specific responsibilities:
In terms of MVC then, class Graph2D together with classes NodeRealizer and EdgeRealizer make up the model which holds the data and its state. Class Graph2DView defines the view which presents the information to the user. Finally, class ViewMode and its descendants tie together model and view.
The respective parts of MVC are further described in the following sections:
Figure 6.1, “Model-View-Controller paradigm in package y.view” depicts the interdependencies of the three parts. The view (a Graph2DView instance) renders the model (an object of type Graph2D); it also propagates user interface events to the controller (class ViewMode and its descendants). According to these events, the controller then changes state on either view or model.
Copyright ©2004-2016, yWorks GmbH. All rights reserved. |