Search this API

y.layout
Class BendConverter

java.lang.Object
  extended by y.layout.BendConverter
All Implemented Interfaces:
Layouter, LayoutStage

public class BendConverter
extends Object
implements LayoutStage

This layout stage replaces bends with dummy nodes, calls the core layout algorithm and recreates the bends. Note that not all data provider values bound to the edges will be automatically adopted be the replacement edges. The adopted values must be provided by data providers registered with one of the following known keys: PortConstraintKeys.SOURCE_GROUPID_KEY, PortConstraintKeys.TARGET_GROUPID_KEY, PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY, PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY.


Field Summary
static Object SCOPE_DPKEY
          DataProvider key used to specify the set of edges for which this stage will replace bends by nodes.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
BendConverter()
          Creates a new instance of BendConverter
BendConverter(double size)
          Creates a new instance of BendConverter using the given size as the width and height for the dummy nodes.
 
Method Summary
protected  void addedPathForEdge(LayoutGraph graph, Edge e, NodeList dummyNodes)
          Callback method that will be invoked after new elements for the given edge have been added to the given graph.
 boolean canLayout(LayoutGraph graph)
          Returns true iff the given graph can be laid out by this algorithm.
 void doLayout(LayoutGraph graph)
          Main layout routine that assigns new layout information to the given graph.
 Layouter getCoreLayouter()
          Returns the core layouter.
 Object getSelectedEdgesDpKey()
          Returns the DataProvider key to identify edges as selected.
 boolean isAdoptEdgeGroupsEnabled()
          Returns whether or not the edge group values of the original edge should be adopted by its replacement edges.
 boolean isAdoptPortConstraintsEnabled()
          Returns whether or not the port constraint values of the original edge should be adopted by its replacement edges.
 boolean isAdoptSelectionEnabled()
          Returns whether or not the selection state of the original edge should be adopted by its replacement edges.
protected  void prepare(LayoutGraph graph)
          Prepares the graph before calling the core layouter
 void setAdoptEdgeGroupsEnabled(boolean adoptEdgeGroupsEnabled)
          Sets whether or not the edge group values of the original edge should be adopted by its replacement edges.
 void setAdoptPortConstraintsEnabled(boolean adoptPortConstraintsEnabled)
          Sets whether or not the port constraint values of the original edge should be adopted by its replacement edges.
 void setAdoptSelectionEnabled(boolean adoptSelectionEnabled)
          Sets whether or not the selection state of the original edge should be adopted by its replacement edges.
 void setCoreLayouter(Layouter l)
          Sets the core layouter.
 void setSelectedEdgesDpKey(Object key)
          Specifies the DataProvider key to identify edges as selected.
protected  void unprepare(LayoutGraph graph)
          Undoes the graph changes performed by prepare(LayoutGraph) after the core layouter has finished.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPE_DPKEY

public static final Object SCOPE_DPKEY
DataProvider key used to specify the set of edges for which this stage will replace bends by nodes. If this data provider key is being used, then it must return for each edge in the input graph a boolean value indicating whether or not it should be handled by this layouter. If there is no data provider registered with this key, all edges will be handled.

Constructor Detail

BendConverter

public BendConverter()
Creates a new instance of BendConverter


BendConverter

public BendConverter(double size)
Creates a new instance of BendConverter using the given size as the width and height for the dummy nodes.

Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Description copied from interface: Layouter
Returns true iff the given graph can be laid out by this algorithm. Calling doLayout with the given graph as its argument will only success if this method returns true.

Specified by:
canLayout in interface Layouter

doLayout

public void doLayout(LayoutGraph graph)
Description copied from interface: Layouter
Main layout routine that assigns new layout information to the given graph.

Specified by:
doLayout in interface Layouter

prepare

protected void prepare(LayoutGraph graph)
Prepares the graph before calling the core layouter


unprepare

protected void unprepare(LayoutGraph graph)
Undoes the graph changes performed by prepare(LayoutGraph) after the core layouter has finished.


getCoreLayouter

public Layouter getCoreLayouter()
Returns the core layouter.

Specified by:
getCoreLayouter in interface LayoutStage

setCoreLayouter

public void setCoreLayouter(Layouter l)
Sets the core layouter.

Specified by:
setCoreLayouter in interface LayoutStage

isAdoptEdgeGroupsEnabled

public boolean isAdoptEdgeGroupsEnabled()
Returns whether or not the edge group values of the original edge should be adopted by its replacement edges.


setAdoptEdgeGroupsEnabled

public void setAdoptEdgeGroupsEnabled(boolean adoptEdgeGroupsEnabled)
Sets whether or not the edge group values of the original edge should be adopted by its replacement edges. The group node values are looked up in DataProviders registered with the keys PortConstraintKeys.SOURCE_GROUPID_KEY and PortConstraintKeys.TARGET_GROUPID_KEY.


isAdoptPortConstraintsEnabled

public boolean isAdoptPortConstraintsEnabled()
Returns whether or not the port constraint values of the original edge should be adopted by its replacement edges.


setAdoptPortConstraintsEnabled

public void setAdoptPortConstraintsEnabled(boolean adoptPortConstraintsEnabled)
Sets whether or not the port constraint values of the original edge should be adopted by its replacement edges. The group node values are looked up in DataProviders registered with the keys PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY and PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY.


isAdoptSelectionEnabled

public boolean isAdoptSelectionEnabled()
Returns whether or not the selection state of the original edge should be adopted by its replacement edges.

See Also:
setAdoptSelectionEnabled(boolean)

setAdoptSelectionEnabled

public void setAdoptSelectionEnabled(boolean adoptSelectionEnabled)
Sets whether or not the selection state of the original edge should be adopted by its replacement edges. The selection state is looked up in DataProviders registered with the key returned by getSelectedEdgesDpKey().

See Also:
isAdoptSelectionEnabled(), getSelectedEdgesDpKey(), setSelectedEdgesDpKey(Object)

addedPathForEdge

protected void addedPathForEdge(LayoutGraph graph,
                                Edge e,
                                NodeList dummyNodes)
Callback method that will be invoked after new elements for the given edge have been added to the given graph. At this point the original edge is still in the graph./


getSelectedEdgesDpKey

public Object getSelectedEdgesDpKey()
Returns the DataProvider key to identify edges as selected.

By default, Layouter.SELECTED_EDGES is used.

Returns:
the DataProvider key to mark edges as selected.
See Also:
setSelectedEdgesDpKey(Object), isAdoptSelectionEnabled(), setAdoptSelectionEnabled(boolean)

setSelectedEdgesDpKey

public void setSelectedEdgesDpKey(Object key)
Specifies the DataProvider key to identify edges as selected.

By default, Layouter.SELECTED_EDGES is used.

Throws:
IllegalArgumentException - if the specified key is null.
Parameters:
key - DataProvider key.
See Also:
getSelectedEdgesDpKey(), isAdoptSelectionEnabled(), setAdoptSelectionEnabled(boolean)

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