Search this API

y.layout
Class SequentialLayouter

java.lang.Object
  extended by y.layout.SequentialLayouter
All Implemented Interfaces:
Layouter

public class SequentialLayouter
extends java.lang.Object
implements Layouter

A SequentialLayouter allows for chaining multiple layout algorithms.

The layout algorithms are invoked one after the other in the order in which they were added to the chain. They all run independently of each other, i.e., they only influence each other by the changed input graph. Hence, the sequence determines the result.

One possible application would be to bundle several layout algorithms and pass a single Layouter instance to a BufferedLayouter.

 
Your browser does not support SVG content.

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
SequentialLayouter()
          Creates a new SequentialLayouter instance with an empty chain of layout algorithms.
 
Method Summary
 void appendLayouter(Layouter layouter)
          Appends the given layout algorithm to the end of the chain.
 void appendLayouters(java.util.List layouters)
          Appends the specified list of layout algorithms to the end of the chain.
 boolean canLayout(LayoutGraph graph)
          Accepts all graphs that are accepted by each layout algorithm in the current chain.
 void clearLayouterChain()
          Clears the current chain of layout algorithms and therefore removes all layout algorithms.
 void doLayout(LayoutGraph graph)
          Executes all layout algorithms in the chain, one after the other.
 java.util.List getLayouters()
          Returns the chain of layout algorithms.
 void setLayouters(java.util.List layouters)
          Specifies the chain of layout algorithms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequentialLayouter

public SequentialLayouter()
Creates a new SequentialLayouter instance with an empty chain of layout algorithms.

Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Accepts all graphs that are accepted by each layout algorithm in the current chain.

Specified by:
canLayout in interface Layouter
Parameters:
graph - the input graph
Returns:
true if all layout algorithms independently can handle this graph, false otherwise
See Also:
Layouter.doLayout(LayoutGraph)

doLayout

public void doLayout(LayoutGraph graph)
Executes all layout algorithms in the chain, one after the other.

The order of the layout algorithms is defined by the order in which they were appended.

Specified by:
doLayout in interface Layouter
Parameters:
graph - the input graph
See Also:
Layouter.canLayout(LayoutGraph)

appendLayouter

public void appendLayouter(Layouter layouter)
Appends the given layout algorithm to the end of the chain.

Parameters:
layouter - the layout algorithm to append

appendLayouters

public void appendLayouters(java.util.List layouters)
Appends the specified list of layout algorithms to the end of the chain.

Parameters:
layouters - the list of layout algorithms to append
Throws:
java.lang.IllegalArgumentException - if there aren't only Layouter instances in the list

getLayouters

public java.util.List getLayouters()
Returns the chain of layout algorithms.

Returns:
the list of layout algorithms that are invoked one after the other
See Also:
appendLayouter(Layouter), appendLayouters(List), setLayouters(List)

setLayouters

public void setLayouters(java.util.List layouters)
Specifies the chain of layout algorithms.

 
The current chain is replaced by the specified layout algorithms.
Parameters:
layouters - the list of layout algorithms that should be invoked one after the other
See Also:
appendLayouter(Layouter), appendLayouters(List)

clearLayouterChain

public void clearLayouterChain()
Clears the current chain of layout algorithms and therefore removes all layout algorithms.


© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.