Managing the views
Describes the components of
JViews Diagrammer that play a part in the management of the
views.
Describes the working principle of the Styling and Data Mapping (SDM) engine.
Gives a short explanation of what the SDM data model is.
Gives a short explanation of what a renderer is.
Gives a short explanation of what a grapher is.
Gives a short explanation of what an interactor is.
The SDM engine
The Styling and Data Mapping (SDM) engine is one of the most important pieces of JViews Diagrammer as it controls the data-to-graphics mapping. There are four key elements in the data-to-graphics mapping process:
A data model that interfaces to the data to display or edit. This data model is completely independent of the GUI, and refers only to the business objects of your application.
Renderers that style the diagram as a whole and the graphic objects in it. Renderers apply the styles specified in the style sheets.
A grapher in which the graphic objects representing the data model are created as nodes and
links. It provides the infrastructure that is minimally necessary to draw a diagram.
Interactors that permit user actions on graphic objects. Common requirements are for zoom, pan, select, and object creation functions.
The SDM engine and the data-to-graphics mapping
As shown in the figure above, the mapping between the data model and the graphical representation is bidirectional:
Data model to graphics: the rendering process is controlled by the style sheet, which lets you tell the SDM engine how you want each particular kind of data object to be displayed in the grapher. The rendering process is performed by specialized renderers.
When the data model is loaded, the SDM engine explores it and creates graphic objects representing the nodes and links defined by the data model in the grapher.
When the state of an object in the data model changes, the SDM engine updates the graphic object representing the modified data object.
Graphics to data model: the editing process relies on built-in editing facilities that act directly on the underlying data model. The actions in an editing application are implemented by interactors. For example:
When the user moves a graphic object (for example, in an editor), the SDM engine updates the geometric properties of the object in the data model.
When the user expands or collapses a node (for example, in a navigation application), the SDM engine updates the expand/collapse status of the object in the data model.
The data model interface
The SDM data model is the interface that tells the SDM engine how to get the data to be displayed. The SDM data model is an abstract description of a set of nodes and links between nodes. Nodes and links have a user-defined type (also called the “tag”), and a set of named properties.
JViews Diagrammer provides prebuilt data models, and you can implement the data model interface to connect your data.
The renderers
A renderer is a Java™ class that helps to manage the graphical representation of your business data. JViews Diagrammer supplies many predefined renderers. Several renderers are usually active at the same time.
The StyleSheet renderer is responsible for creating and customizing graphical objects and is always active. The GraphLayout renderer applies a layout algorithm and is often active (only available if you have purchased a full JViews Diagrammer license).
Predefined renderers are supplied for displaying info balloons, a legend, subgraphs, and swimlanes. There are also predefined renderers to assign a random color to nodes, to assign a specific
interactor to nodes, and many more. The SDK lets you define new renderers for your application needs.
The grapher
The
grapher is a Java™ class responsible for storing and managing the graphics objects that are displayed by JViews Diagrammer. The grapher not only manages nodes and links; it also manages any graphics objects used to display a background and any decorations around the diagram like a legend.
The grapher can contain hundreds of thousands of graphics, and yet refresh them instantly. Its spatial data structure is optimized to retrieve the graphic objects located in an area rapidly.
The grapher belongs to Rogue Wave® JViews Framework, and a comprehensive API is available to finely tune its behavior.
The graphical objects contained in the grapher are drawn in the
views connected to the grapher. The user of your application can zoom and pan in the views, and can interact with the objects in the views using the mouse.
The interactors
An interactor is a Java™ class that manages the behavior of an object in response to an event, for example, a mouse click. JViews Diagrammer supplies various predefined interactors.
View interactors affect the display in general. The view interactors are typically used to manage the zoom and pan facilities, and the selection and creation of nodes and links. It is important to remember that when a node is added or modified with an interactor on a view, the corresponding action is performed in the data model.
An object interactor is local to a graphic object. It handles the action to perform when an event is received by a particular object, for example, double-click to open a list of related alarms.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.