NodeRealizer Idiosyncrasies
Applies to: yFiles for Java 2.7, 2.6, 2.5 print article email article

Type: Troubleshooting

Considerations regarding a node's size and its location when working with NodeRealizer.

Working with NodeRealizer

Abstract class NodeRealizer serves as the basis for node realizer implementations. Among other user interface aspects, a node realizer defines the way a graph element is rendered, i.e., it provides and manages all visual aspects of a node in a Graph2D.
When working with node realizers, some aspects regarding a node's size and its location should be kept in mind.

Setting the node size also changes the coordinates of the node's upper left corner

Abstract class NodeRealizer follows a node center-centric scheme with regard to node size changes, i.e., the coordinates of a node's center stay the same when changing the node's size. As a matter of fact, when calling the NodeRealizer.setSize method, the coordinates of the node's upper left corner change, i.e., the node's location changes.
Consequently, whenever you need to set both size and location of a node (realizer), either first set the size, then the location or use one of NodeRealizer's setFrame methods.


Keywords: NodeRealizer - node - realizer - Graph2D - setSize - size - coordinates - upper - left - layout - center - setLocation

Provide feedback:
How useful was this article?    less 1 2 3 4 5 more
Email address (optional):
COPYRIGHT © 2012 yWorks · ALL RIGHTS RESERVED imprint | terms of use | privacy policy | home