Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public class LayeredArrangement

  1. Object
  2. LayeredArrangement

ImplementsGraphArrangement

An arrangement for flows: every edge points the same way, from one layer to the next, with as few crossings as it can find.

This is the method of Sugiyama, Tagawa and Toda in four passes. Cycles are broken by reversing the edges a depth first search finds going back; nodes are put on layers by their longest path from a source; an edge that spans several layers gets a hidden point on each so it bends around the nodes between; the order inside each layer is improved by sweeping down and up, moving each node to the median of its neighbours; and each node is then pulled towards its neighbours without overlapping the next one.

The edges get routes through their hidden points. Pinned nodes are placed like any other: a layered picture has no room for a node that stays put.

Fields

public static final int TOP_TO_BOTTOM = 0Layers run down the screen and edges point down.
public static final int LEFT_TO_RIGHT = 1Layers run across the screen and edges point right.

Constructors

public LayeredArrangement()

Methods

public int getDirection()TOP_TO_BOTTOM, the default, or LEFT_TO_RIGHT.
public void setDirection(int direction)Sets the direction edges point.
public double getLayerGap()The space between layers in world units.
public void setLayerGap(double layerGap)Sets the space between layers.
public double getNodeGap()The space between nodes on one layer in world units.
public void setNodeGap(double nodeGap)Sets the space between nodes on one layer.
public ArrangementResult arrange(GraphModel model)Computes a position for every node, and a route for edges the arrangement bends.

Inherited methods

Field details

TOP_TO_BOTTOM

public static final int TOP_TO_BOTTOM = 0
Layers run down the screen and edges point down.

LEFT_TO_RIGHT

public static final int LEFT_TO_RIGHT = 1
Layers run across the screen and edges point right.

Constructor details

LayeredArrangement

public LayeredArrangement()

Method details

getDirection

public int getDirection()
TOP_TO_BOTTOM, the default, or LEFT_TO_RIGHT.

setDirection

public void setDirection(int direction)
Sets the direction edges point.

getLayerGap

public double getLayerGap()
The space between layers in world units.

setLayerGap

public void setLayerGap(double layerGap)
Sets the space between layers.

getNodeGap

public double getNodeGap()
The space between nodes on one layer in world units.

setNodeGap

public void setNodeGap(double nodeGap)
Sets the space between nodes on one layer.

arrange

public ArrangementResult arrange(GraphModel model)
Computes a position for every node, and a route for edges the arrangement bends.