Mapping Between Business Layer and Presentation Layer
Applies to: yFiles 2.5, yFiles 2.4, yFiles 2.3, yFiles 2.2, yFiles 2.1, yFiles 2.0 print article email article

Type: Tips & Tricks

The yFiles library provides direct support for mapping from nodes and edges to corresponding business objects.

When the yFiles graph visualization library is used in an application to present some graph structure to the user, there often is also a business model involved that holds data relating to the objects from the graph structure. The graph structure is simply the application's presentation layer for the data (or part of the data) from the business layer.

When it comes to map between these two layers, the yFiles library provides support for the direction from presentation layer to business layer by means of so-called data accessors, most prominently implementations for interfaces NodeMap and EdgeMap.
The concept of data accessors is explained in the yFiles Developer's Guide in Binding Data to Graph Elements .

Conveniently provided by class Graph are the default implementations of the aforementioned interfaces. These can be created using the Graph.createNodeMap() and Graph.createEdgeMap() methods, respectively.
More information on the default implementations can be found in the yFiles Developer's Guide in the section Default Map Implementations .

To map from an application's business layer to the presentation layer, i.e., in particular to the nodes and edges of a graph, possible solutions would be to

  • use a field in the business object that holds the corresponding node or edge
  • use a map implementation that does the mapping, e.g., an implementation of interface java.util.Map


Keywords: business - model - presentation - layer - NodeMap - EdgeMap - map - mapping - node - edge - createNodeMap - default - data - accessor

Provide feedback:
How useful was this article?    less 1 2 3 4 5 more
Email address (optional):
COPYRIGHT © 2008 yWorks · ALL RIGHTS RESERVED imprint | top | home