|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.AbstractLayoutStage y.layout.GraphLayoutLineWrapper
public class GraphLayoutLineWrapper
GraphLayoutLineWrapper
can line-wrap or column-wrap a graph layout.
This LayoutStage
supports both wrapping a layout at a given width (height) and wrapping
a layout automatically at some width (height) such that the resulting overall
aspect ratio is close to a desired target ratio
.
The GraphLayoutLineWrapper
can be used on an existing graph layout or on the result of the
core layout algorithm
.
Field Summary |
---|
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
GraphLayoutLineWrapper()
Creates a new GraphLayoutLineWrapper instance with default settings. |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Accepts all graphs that can be handled by the core layout algorithm . |
void |
doLayout(LayoutGraph graph)
Cuts the layout resulting from the core layout algorithm at a specified width/height
and shifts the remaining graph into the next row/column until the layout has the desired width/height. |
double |
getEdgeSpacing()
Returns the space that should be kept between edges. |
double |
getFixedWidth()
Returns the desired width of the lines. |
double |
getSpacing()
Returns the space between adjacent lines of the wrapped graph layout. |
double |
getTargetRatio()
Returns the desired target aspect ratio for the layout. |
boolean |
isColumnMode()
Returns whether this LayoutStage wraps lines/rows or columns. |
boolean |
isFixedWidthLineBreaks()
Returns whether the algorithm should use the fixed width or
target aspect ratio to determine line breaks. |
boolean |
isMirroringEnabled()
Returns whether or not every other line is mirrored. |
void |
setColumnMode(boolean columnMode)
Specifies whether this LayoutStage wraps lines/rows or columns. |
void |
setEdgeSpacing(double edgeSpacing)
Specifies the space that should be kept between edges. |
void |
setFixedWidth(double fixedWidth)
Specifies the desired width of the lines. |
void |
setFixedWidthLineBreaks(boolean fixedWidthLineBreaks)
Specifies whether the algorithm should use the fixed width or
target aspect ratio to determine line breaks. |
void |
setMirroringEnabled(boolean mirroringEnabled)
Specifies whether or not every other line is mirrored. |
void |
setSpacing(double spacing)
Specifies the space between adjacent lines of the wrapped graph layout. |
void |
setTargetRatio(double targetRatio)
Specifies the desired target aspect ratio for the layout. |
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 |
---|
public GraphLayoutLineWrapper()
GraphLayoutLineWrapper
instance with default settings.
Method Detail |
---|
public double getEdgeSpacing()
The spacing must be non-negative.
setEdgeSpacing(double)
public void setEdgeSpacing(double edgeSpacing)
The spacing must be non-negative.
public boolean isColumnMode()
LayoutStage
wraps lines/rows or columns.
If this mode is enabled, the layout is wrapped vertically and new columns are appended to the right of the first column. Otherwise, the layout is wrapped horizontally and new rows are appended below the first row.
Also, the setFixedWidth(double)
property will be interpreted as a fixed height if this
mode is enabled.
true
for column wrapping mode, false
for row wrappingsetColumnMode(boolean)
,
setFixedWidth(double)
public void setColumnMode(boolean columnMode)
LayoutStage
wraps lines/rows or columns.
If this mode is enabled, the layout is wrapped vertically and new columns are appended to the right of the first column. Otherwise, the layout is wrapped horizontally and new rows are appended below the first row.
Also, the setFixedWidth(double)
property will be interpreted as a fixed height if this
mode is enabled.
columnMode
- true
for column wrapping mode, false
for row wrappingsetFixedWidth(double)
public double getSpacing()
If the column mode
is enabled, this spacing defines the distance between adjacent columns.
The spacing should be non-negative.
setSpacing(double)
public void setSpacing(double spacing)
If the column mode
is enabled, this spacing defines the distance between adjacent columns.
The spacing should be non-negative.
public boolean isMirroringEnabled()
When breaking a line and placing the remaining line below, this remainder can be rotated by 180
degrees. Then, the edges connecting both lines stay short. In case the remainder is not rotated,
the edges are routed between the two lines to connect to the front of the non-mirrored line.
true
if every second line is rotated by 180
degrees,
false
otherwisesetMirroringEnabled(boolean)
public boolean isFixedWidthLineBreaks()
fixed width
or
target aspect ratio
to determine line breaks.
true
if a fixed line width is used, false
otherwisesetFixedWidthLineBreaks(boolean)
,
setFixedWidth(double)
,
setTargetRatio(double)
public void setFixedWidthLineBreaks(boolean fixedWidthLineBreaks)
fixed width
or
target aspect ratio
to determine line breaks.
fixedWidthLineBreaks
- true
if a fixed line width should be used, false
otherwisesetFixedWidth(double)
,
setTargetRatio(double)
public double getTargetRatio()
The aspect ratio needs to be greater than 0
.
isFixedWidthLineBreaks()
returns
false
.width/height
setTargetRatio(double)
,
setFixedWidthLineBreaks(boolean)
public void setTargetRatio(double targetRatio)
The aspect ratio needs to be greater than 0
.
isFixedWidthLineBreaks()
returns
false
.targetRatio
- the desired target aspect ratio in terms of width/height
java.lang.IllegalArgumentException
- if the target ratio is 0
or lesssetFixedWidthLineBreaks(boolean)
0.5 | 1 | 2 |
public double getFixedWidth()
The GraphLayoutLineWrapper
breaks the lines at the specified width.
In column mode
, the fixed width is interpreted as fixed height for a column.
isFixedWidthLineBreaks()
returns
true
.setFixedWidth(double)
,
setFixedWidthLineBreaks(boolean)
,
setColumnMode(boolean)
public void setFixedWidth(double fixedWidth)
The GraphLayoutLineWrapper
breaks the lines at the specified width.
In column mode
, the fixed width is interpreted as fixed height for a column.
isFixedWidthLineBreaks()
returns
true
.fixedWidth
- the width of the linessetFixedWidthLineBreaks(boolean)
,
setColumnMode(boolean)
500 | 300 |
public void setMirroringEnabled(boolean mirroringEnabled)
When breaking a line and placing the remaining line below, this remainder can be rotated by 180
degrees. Then, the edges connecting both lines stay short. In case the remainder is not rotated,
the edges are routed between the two lines to connect to the front of the non-mirrored line.
public boolean canLayout(LayoutGraph graph)
core layout algorithm
.
If there is no core layout algorithm
, all graphs are accepted.
graph
- the input graph
true
if there is no core layout algorithm or the core layout algorithm accepts the graph,
false
otherwiseLayouter.doLayout(LayoutGraph)
public void doLayout(LayoutGraph graph)
core layout algorithm
at a specified width/height
and shifts the remaining graph into the next row/column until the layout has the desired width/height.
graph
- the input graphLayouter.canLayout(LayoutGraph)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |