|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.AbstractLayoutStage
y.layout.ComponentLayouter
public class ComponentLayouter
This layout stage arranges the connected components of a graph.
It is possible to specify a core layout algorithm that will be invoked on all connected components of the graph before this layouter arranges the components themselves. ComponentLayouter will handle hierarchically grouped graphs in a special way. The contents of a group node will always belong to the same component as the group node itself.
![]() |
![]() |
![]() |
![]() |
| Field Summary | |
|---|---|
static Object |
GIVEN_COMPONENT_ID_DPKEY
DataProvider key that can be used to determine components by hand. |
static Object |
LAYOUT_NODE_DPKEY
DataProvider key that can be used to determine which nodes should be laid out. |
static byte |
STYLE_MASK
Use this constant for masking actual styles constants from style modifiers |
static byte |
STYLE_MODIFIER_AS_IS
Modifier constant that can be added to the normal style constant to indicate that the arrangement strategy should take the initial positions of the components into account. |
static byte |
STYLE_MODIFIER_NO_OVERLAP
Modifier constant that can be added to the normal style constant to indicate that the arrangement strategy should produce a non-overlapping component layout. |
static byte |
STYLE_NONE
Style specification constant describing no special component arrangement at all. |
static byte |
STYLE_PACKED_CIRCLE
Style specification constant describing a component arrangement strategy that tries to place components like in a cloud around the biggest component. |
static byte |
STYLE_PACKED_COMPACT_CIRCLE
Style specification constant describing a component arrangement strategy that tries to place components like in a cloud around the biggest component. |
static byte |
STYLE_PACKED_COMPACT_RECTANGLE
Style specification constant describing a component arrangement strategy that tries to place components like in a rectangular cloud around the biggest component. |
static byte |
STYLE_PACKED_RECTANGLE
Style specification constant describing a component arrangement strategy that tries to place components like in a rectangular cloud around the biggest component. |
static byte |
STYLE_ROWS
Style specification constant describing a component arrangement strategy that tries to place components in multiple rows so that the overall aspect ratio of all components gets as close to the ratio of the preferred layout size as possible. |
static byte |
STYLE_SINGLE_COLUMN
Style specification constant describing a component arrangement strategy that places components above each other in a single column. |
static byte |
STYLE_SINGLE_ROW
Style specification constant describing a component arrangement strategy that places components next to each other in a single rows. |
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
ComponentLayouter()
Instantiates a ComponentLayouter. |
|
ComponentLayouter(Layouter coreLayouter)
Instantiates a ComponentLayouter. |
|
| Method Summary | |
|---|---|
protected void |
arrangeComponents(LayoutGraph graph,
NodeList[] nodes,
EdgeList[] edges,
YRectangle[] bbox,
Rectangle2D[] boxes)
Produces a non-overlapping component graph layout. |
protected void |
arrangeFields(LayoutGraph graph,
NodeList[] nodes,
EdgeList[] edges,
YRectangle[] bbox,
Rectangle2D[] boxes,
boolean circular,
boolean fill,
boolean fromSketch)
|
protected Rectangle2D |
calcBoundingBox(LayoutGraph graph)
Calculates and returns the bounding box of a graph component. |
boolean |
canLayout(LayoutGraph graph)
Determines if the preconditions for the graph layout algorithm are fullfilled, by applying them to the connected components. |
void |
doLayout(LayoutGraph graph)
Calculate the layout. |
protected int |
findGraphComponents(LayoutGraph graph,
NodeMap compNumber)
Determines which nodes will belong to the same graph component. |
double |
getComponentSpacing()
Getter for property componentSpacing. |
double |
getGridSpacing()
Getter for property gridSpacing. |
YDimension |
getPreferredLayoutSize()
Gets the preferred layout size for this layouter. |
byte |
getStyle()
Returns the current style of the component arrangement. |
boolean |
isComponentArrangementEnabled()
Returns whether or not the separately laid out components of the input graph should be arranged by this class. |
boolean |
isGroupingActive()
Returns whether grouping information bound to the graph will be used to calculate the components. |
boolean |
isLabelAwarenessEnabled()
Returns whether or not to take node and edge labels into account when calculating the bounding box of the graph components. |
void |
setComponentArrangementEnabled(boolean enabled)
Sets whether or not the separately laid out components of the input graph should be arranged by this class. |
void |
setComponentSpacing(double componentSpacing)
Setter for property componentSpacing. |
void |
setGridSpacing(double gridSpacing)
Setter for property gridSpacing. |
void |
setGroupingActive(boolean groupingActive)
Determines whether grouping information bound to the graph should be used to determine the connectedness of the graph structure. |
void |
setLabelAwarenessEnabled(boolean enabled)
Sets whether or not to take node and edge labels into account when calculating the bounding box of the graph components. |
protected void |
setOrigin(LayoutGraph graph,
NodeList nl,
EdgeList el,
YPoint org,
YRectangle r)
Sets the origin for a subgraph. |
void |
setPreferredLayoutSize(double width,
double height)
Sets the preferred layout size for this layouter. |
void |
setStyle(byte style)
Sets the style of the component arrangement for this instance. |
| 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 |
| Field Detail |
|---|
public static final Object LAYOUT_NODE_DPKEY
true if queried through the
DataProvider instance. If no such instance is registered with the graph,
all components will be laid out by the core layout algorithm.
public static final Object GIVEN_COMPONENT_ID_DPKEY
DataProvider.get(Object) method to query for
object instances that will be used to determine components:
If null is returned for a node that node's component will be determined as usual.
If non-null values are returned, they will be compared using the comparator instance
to determine the component order.
public static final byte STYLE_NONE
STYLE_MODIFIER_NO_OVERLAP
components might get moved so that they don't overlap after the layout.
public static final byte STYLE_ROWS
public static final byte STYLE_SINGLE_ROW
STYLE_MODIFIER_AS_IS
components will be placed in the same order as they were placed before the layout.
public static final byte STYLE_SINGLE_COLUMN
STYLE_MODIFIER_AS_IS
components will be placed in the same order as they were placed before the layout.
public static final byte STYLE_PACKED_RECTANGLE
public static final byte STYLE_PACKED_COMPACT_RECTANGLE
STYLE_PACKED_RECTANGLE components might even be placed in emtpy spaces inside other components.
public static final byte STYLE_PACKED_CIRCLE
public static final byte STYLE_PACKED_COMPACT_CIRCLE
STYLE_PACKED_CIRCLE components might even be placed in emtpy spaces inside other components.
public static final byte STYLE_MODIFIER_AS_IS
public static final byte STYLE_MASK
public static final byte STYLE_MODIFIER_NO_OVERLAP
| Constructor Detail |
|---|
public ComponentLayouter(Layouter coreLayouter)
public ComponentLayouter()
| Method Detail |
|---|
public void setPreferredLayoutSize(double width,
double height)
public YDimension getPreferredLayoutSize()
public boolean canLayout(LayoutGraph graph)
protected int findGraphComponents(LayoutGraph graph,
NodeMap compNumber)
graph - the input graphcompNumber - return value that will hold the zero-based number
of the component that it belongs to. The component number of
Node v is compNum.getInt(v).
public void doLayout(LayoutGraph graph)
protected Rectangle2D calcBoundingBox(LayoutGraph graph)
labelAwarenessEnabled the returned bounding box will
also take node and edge labels into account.
public void setLabelAwarenessEnabled(boolean enabled)
calcBoundingBox(LayoutGraph graph)public boolean isLabelAwarenessEnabled()
protected void arrangeComponents(LayoutGraph graph,
NodeList[] nodes,
EdgeList[] edges,
YRectangle[] bbox,
Rectangle2D[] boxes)
graph - the layout graph.nodes - array of type NodeList. The i-th NodeList contains all nodes of the i-th graph component.edges - array of type EdgeList. The i-th NodeList contains all edges of the i-th graph component.bbox - array of type YRectangle. The i-th YRectangle contains the current bounding box of the i-th graph component.boxes - array of type Rectangle2D. The i-th Rectangle2D contains the extended bounding box of the i-th graph component.
The method arrange these boxes in such a way that they do not overlap. Then the i-th graph component must be placed
inside the i-th box.public void setComponentArrangementEnabled(boolean enabled)
public boolean isComponentArrangementEnabled()
protected void setOrigin(LayoutGraph graph,
NodeList nl,
EdgeList el,
YPoint org,
YRectangle r)
public double getGridSpacing()
public void setGridSpacing(double gridSpacing)
gridSpacing - New value of property gridSpacing.public double getComponentSpacing()
public void setComponentSpacing(double componentSpacing)
componentSpacing - New value of property componentSpacing.public boolean isGroupingActive()
true.
public void setGroupingActive(boolean groupingActive)
public byte getStyle()
STYLE_ROWS.
STYLE_MASK to mask out the basic style without the
modifier bits.setStyle(byte)public void setStyle(byte style)
STYLE_ROWS.
style - New value of property style. One of STYLE_NONE, STYLE_ROWS,
STYLE_SINGLE_ROW, STYLE_SINGLE_COLUMN, STYLE_PACKED_RECTANGLE,
STYLE_PACKED_COMPACT_RECTANGLE, STYLE_PACKED_CIRCLE, or STYLE_PACKED_COMPACT_CIRCLE,
possibly bitwise combined using STYLE_MODIFIER_AS_IS and/or STYLE_MODIFIER_NO_OVERLAP.
protected void arrangeFields(LayoutGraph graph,
NodeList[] nodes,
EdgeList[] edges,
YRectangle[] bbox,
Rectangle2D[] boxes,
boolean circular,
boolean fill,
boolean fromSketch)
|
© Copyright 2000-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||