Where to Find Up-to-date yFiles Information

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.

More about the yFiles product family Close X

Layout Stages

A layout stage, as already explained in the section called “The Layout Stages Concept”, serves as a standardized container that encapsulates arbitrary layout functionality and provides a general means to string together multiple layout stages into a compound layout process. It is an implementation of interface LayoutStage and most commonly also an extension of abstract class AbstractLayoutStage.

The encapsulated layout functionality of the predefined yFiles layout stages covers special-purpose layouts (see Table 5.20, “Layout stages that provide special-purpose layout functionality”) as well as enhancements to the layout process of specific layout styles (for example, tree layout and orthogonal layout) and edge routing styles, respectively (see orthogonal edge routing).

Table 5.19, “Predefined layout stages” lists another kind of layout stages that contribute to the inner workings of a layout process itself.

Table 5.19. Predefined layout stages

Classname Description
ComponentLayouter Arranges the connected components of a graph. Part of the default compound layout process as established by class CanonicMultiStageLayouter.
CompositeLayoutStage Allows to establish a custom compound layout process consisting of multiple layout stages. See below for an example of using class CompositeLayoutStage to create a custom layout process.
FixedGroupLayoutStage Used to prevent an existing layout inside a group node from being altered when calculating a layout for a grouped graph.
LayoutMultiplexer Enables using individual layout algorithms for components (when used as the core layouter of class ComponentLayouter) or for the contents of group nodes (when used as the core layouter of class RecursiveGroupLayouter).
RecursiveGroupLayouter Provides support for recursively calculating a layout for grouped graphs.
GreedyMISLabeling, SALabeling Place labels without altering the graph layout. See also the section called “Generic Labeling”.

Purpose and usage of ComponentLayouter is described in the section called “Class ComponentLayouter”. Note that this section also shows how to use class LayoutMultiplexer in conjunction with ComponentLayouter in order to have different layout algorithms applied to the separate components of a graph.

Using class CompositeLayoutStage to create a custom layout process is shown in the following code example:

Example 5.19. Defining a custom compound layout process using CompositeLayoutStage

// 'hierarchic' is of type y.layout.hierarchic.HierarchicLayouter.

// String together a label layout process.
CompositeLayoutStage ll = new CompositeLayoutStage();
ll.appendStage(new LabelLayoutTranslator());
ll.appendStage(new LabelLayoutDataRefinement());
// Set the compound label layout process as the label layouter for 
// HierarchicLayouter.

Table 5.20, “Layout stages that provide special-purpose layout functionality” lists layout stages that provide special-purpose layout functionality.

Table 5.20. Layout stages that provide special-purpose layout functionality

Classname Description
GraphLayoutLineWrapper "Line-wraps" or "column-wraps" a graph layout. Best suited for use in conjunction with hierarchic layout.

The description of class GraphLayoutLineWrapper explains the options of this layout stage and how to use it.

Tutorial Demo Code

The following tutorial demo code has examples on how to use FixedGroupLayoutStage and RecursiveGroupLayouter:

  • RecursiveGroupLayouterDemo.java shows how RecursiveGroupLayouter can be used when calculating a layout for a grouped graph
  • OrthogonalLayoutModule.java presents the technique of prepending an orthogonal layout with an invocation of FixedGroupLayoutStage in order to avoid altering the layout of group node contents