Search this API

y.layout
Class GraphLayoutLineWrapper

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

public class GraphLayoutLineWrapper
extends AbstractLayoutStage

A layout stage that can be used to "line-wrap" or "column-wrap" a graph layout. This stage both supports wrapping a layout at a given width (height) or wrapping the layout at a specific width (height) automatically so that the overall resulting aspect ratio will be close to a specifiable value.

See Also:
setFixedWidthLineBreaks(boolean), setFixedWidth(double), setTargetRatio(double), setColumnMode(boolean)

Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
GraphLayoutLineWrapper()
           
 
Method Summary
 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.
 double getEdgeSpacing()
          Returns the space between edges that should be used for the additional routing.
 double getFixedWidth()
          Returns the desired width of the lines to use if setFixedWidthLineBreaks(boolean) is set to true.
 double getSpacing()
          Gets the space between adjacent lines of the wrapped graph layout.
 double getTargetRatio()
          Gets the desired target aspect ratio the algorithm should try to generate.
 boolean isColumnMode()
          Determines whether this algorithm should not wrap lines or rows, but columns.
 boolean isFixedWidthLineBreaks()
          Returns whether the algorithm should use the fixed width to determine line breaks.
 boolean isMirroringEnabled()
          Returns whether lines should be going from left to right and right to left in an alternating fashion.
 void setColumnMode(boolean columnMode)
          Sets whether this algorithm should not wrap lines or rows, but columns.
 void setEdgeSpacing(double edgeSpacing)
          Sets the space between edges that should be used for the additional routing.
 void setFixedWidth(double fixedWidth)
          Sets the desired width of the lines to use if setFixedWidthLineBreaks(boolean) is set to true.
 void setFixedWidthLineBreaks(boolean fixedWidthLineBreaks)
          Determines whether the algorithm should use the fixed width to determine line breaks.
 void setMirroringEnabled(boolean mirroringEnabled)
          Determines whether lines should be going from left to right and right to left in an alternating fashion.
 void setSpacing(double spacing)
          Sets the space between adjacent lines of the wrapped graph layout.
 void setTargetRatio(double targetRatio)
          Sets the desired target aspect ratio the algorithm should try to generate.
 
Methods inherited from class y.layout.AbstractLayoutStage
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphLayoutLineWrapper

public GraphLayoutLineWrapper()
Method Detail

getEdgeSpacing

public double getEdgeSpacing()
Returns the space between edges that should be used for the additional routing. The default is 5.

Returns:
The space between edges.

setEdgeSpacing

public void setEdgeSpacing(double edgeSpacing)
Sets the space between edges that should be used for the additional routing. The default is 5.

Parameters:
edgeSpacing - The space between edges.

isColumnMode

public boolean isColumnMode()
Determines whether this algorithm should not wrap lines or rows, but columns. If set to true, the layout will be wrapped vertically and new columns will be appended to the right of the first column. The setFixedWidth(double) property will be interpreted as a fixed height, in that case, of course. The default is false.

Returns:
whether to use a column wrapping mode instead of a row wrapping.

setColumnMode

public void setColumnMode(boolean columnMode)
Sets whether this algorithm should not wrap lines or rows, but columns. If set to true, the layout will be wrapped vertically and new columns will be appended to the right of the first column. The setFixedWidth(double) property will be interpreted as a fixed height, in that case, of course. The default is false.

Parameters:
columnMode - whether to use a column wrapping mode instead of a row wrapping.

getSpacing

public double getSpacing()
Gets the space between adjacent lines of the wrapped graph layout. The default is 10.

Returns:
the space between the lines.

setSpacing

public void setSpacing(double spacing)
Sets the space between adjacent lines of the wrapped graph layout. The default is 10.

Parameters:
spacing - the new space between the lines.

isMirroringEnabled

public boolean isMirroringEnabled()
Returns whether lines should be going from left to right and right to left in an alternating fashion. If set to true every second line will be rotated 180 degrees and ports will be adjusted correspondingly. The default is true

Returns:
Whether to rotate every second line.

isFixedWidthLineBreaks

public boolean isFixedWidthLineBreaks()
Returns whether the algorithm should use the fixed width to determine line breaks. The default is false.

Returns:
whether to use a fixed line width.
See Also:
setFixedWidth(double), setTargetRatio(double)

setFixedWidthLineBreaks

public void setFixedWidthLineBreaks(boolean fixedWidthLineBreaks)
Determines whether the algorithm should use the fixed width to determine line breaks. The default is false.

Parameters:
fixedWidthLineBreaks - whether to use a fixed line width.
See Also:
setFixedWidth(double), setTargetRatio(double)

getTargetRatio

public double getTargetRatio()
Gets the desired target aspect ratio the algorithm should try to generate. This setting only affects the outcome if setFixedWidthLineBreaks(boolean) is set to false. The default is 1.0d.

Returns:
The desired target aspect ratio in terms of width/height.

setTargetRatio

public void setTargetRatio(double targetRatio)
Sets the desired target aspect ratio the algorithm should try to generate. This setting only affects the outcome if setFixedWidthLineBreaks(boolean) is set to false. The default is 1.0d.

Parameters:
targetRatio - The desired target aspect ratio in terms of width/height.

getFixedWidth

public double getFixedWidth()
Returns the desired width of the lines to use if setFixedWidthLineBreaks(boolean) is set to true. Note that the algorithm will not necessarily be able to satisfy very small values since the nodes need to fit into a line completely.

The default is 500

Returns:
the width of the lines to use.
See Also:
setFixedWidthLineBreaks(boolean)

setFixedWidth

public void setFixedWidth(double fixedWidth)
Sets the desired width of the lines to use if setFixedWidthLineBreaks(boolean) is set to true. Note that the algorithm will not necessarily be able to satisfy very small values since the nodes need to fit into a line completely.

The default is 500

Parameters:
fixedWidth - the width of the lines.
See Also:
setFixedWidthLineBreaks(boolean)

setMirroringEnabled

public void setMirroringEnabled(boolean mirroringEnabled)
Determines whether lines should be going from left to right and right to left in an alternating fashion. If set to true every second line will be rotated 180 degrees and ports will be adjusted correspondingly. The default is true

Parameters:
mirroringEnabled - Whether to rotate every second line by 180 degrees.

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.


doLayout

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


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