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
|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. hierarchic.setLabelLayouter(ll); hierarchic.setLabelLayouterEnabled(true);
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
|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.
The following tutorial demo code has examples on how to use FixedGroupLayoutStage and RecursiveGroupLayouter:
Copyright ©2004-2016, yWorks GmbH. All rights reserved.