|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.grouping.InsetsGroupBoundsCalculator y.layout.grouping.MinimumSizeGroupBoundsCalculator
public class MinimumSizeGroupBoundsCalculator
This GroupBoundsCalculator
allows custom insets for group nodes and guarantees that their
provided minimum sizes will be maintained.
As a subclass of InsetsGroupBoundsCalculator
, this class supports custom insets for
each group node. Furthermore, it guarantees that a desired minimum size is maintained. The minimum sizes
are provided by a DataProvider
registered with the graph using the specified
minimum node size key
.
RecursiveGroupLayouter
and assumes
that the graph given to method calculateBounds(LayoutGraph, Node, NodeList)
only contains the content of the specified group
(which is always true if it is called within the RecursiveGroupLayouter
).Constructor Summary | |
---|---|
MinimumSizeGroupBoundsCalculator()
Creates a new instance of MinimumSizeGroupBoundsCalculator with default settings. |
|
MinimumSizeGroupBoundsCalculator(java.lang.Object minSizeDataProviderKey)
Creates a new instance of MinimumSizeGroupBoundsCalculator with the given key as
minimum node size key . |
Method Summary | |
---|---|
java.awt.geom.Rectangle2D |
calculateBounds(LayoutGraph graph,
Node groupNode,
NodeList children)
Calculates the bounds of the given group node, enlarges the bounds by the insets associated with the group node and makes sure that the size of the group node obeys the associated minimum size. |
YDimension |
getDefaultMinimumNodeSize()
Returns the default minimum size (width and height) for group nodes. |
java.lang.Object |
getMinimumNodeSizeDPKey()
Returns the key to register a DataProvider that is used to access the minimum sizes for the group nodes. |
double |
getXAlignment()
Returns how the nodes are resized horizontally if the calculated width is smaller than the preferred minimum width of a group node. |
double |
getYAlignment()
Returns how the nodes are resized vertically if the calculated height is smaller than the preferred minimum height of a group node. |
void |
setDefaultMinimumNodeSize(YDimension minSize)
Specifies the default minimum size (width and height) for group nodes. |
void |
setMinimumNodeSizeDPKey(java.lang.Object minimumNodeSizeDPKey)
Specifies the key to register a DataProvider that is used to access the minimum sizes for the group nodes. |
void |
setXAlignment(double xAlignment)
Specifies how the nodes are resized horizontally if the calculated width is smaller than the preferred minimum width of a group node. |
void |
setYAlignment(double yAlignment)
Specifies how the nodes are resized vertically if the calculated height is smaller than the preferred minimum height of a group node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MinimumSizeGroupBoundsCalculator()
MinimumSizeGroupBoundsCalculator
with default settings.
public MinimumSizeGroupBoundsCalculator(java.lang.Object minSizeDataProviderKey)
MinimumSizeGroupBoundsCalculator
with the given key as
minimum node size key
.
minSizeDataProviderKey
- the DataProvider
key to use as minimum size key
Method Detail |
---|
public java.awt.geom.Rectangle2D calculateBounds(LayoutGraph graph, Node groupNode, NodeList children)
The insets
associated with the group node will be retrieved from a DataProvider
registered with the graph with the current insets key
.
The minimum sizes associated with the group node will be retrieved from a DataProvider
registered with
the graph with the current minimum size key
.
calculateBounds
in interface GroupBoundsCalculator
calculateBounds
in class InsetsGroupBoundsCalculator
RecursiveGroupLayouter
and assumes
that the graph given to method calculateBounds(LayoutGraph, Node, NodeList)
only contains the content of the specified group
(which is always true if it is called within the RecursiveGroupLayouter
).graph
- the input graphgroupNode
- the group node whose bounds will be calculatedchildren
- a NodeList
containing the nodes that reside inside the group node
Rectangle2D
instance that describes the bounds of the group nodepublic double getXAlignment()
The alignment is defined to be a value between 0
and 1
, such that:
0
means that the nodes grow to the right while the left border remains unchanged.1
means that the nodes grow to the left while the right border remains unchanged.
[0,1]
setXAlignment(double)
public void setXAlignment(double xAlignment)
The alignment is defined to be a value between 0
and 1
, such that:
0
means that the nodes grow to the right while the left border remains unchanged.1
means that the nodes grow to the left while the right border remains unchanged.
xAlignment
- a horizontal alignment value from the interval [0,1]
java.lang.IllegalArgumentException
- if the given value does not lie within [0,1]
X-alignment 0 when minimum group node size is 200 x 200 | X-alignment 0.5 when minimum group node size is 200 x 200 | X-alignment 1.0 when minimum group node size is 200 x 200 |
public double getYAlignment()
The alignment is defined to be a value between 0
and 1
, such that:
0
means that the nodes grow downwards while the top border remains unchanged.1
means that the nodes grow upwards while the bottom border remains unchanged.
[0,1]
setYAlignment(double)
public void setYAlignment(double yAlignment)
The alignment is defined to be a value between 0
and 1
, such that:
0
means that the nodes grow downwards while the top border remains unchanged.1
means that the nodes grow upwards while the bottom border remains unchanged.
yAlignment
- a vertical alignment value from the interval [0,1]
java.lang.IllegalArgumentException
- if the given value does not lie within [0,1]
Y-alignment 0 when minimum group node size is 200 x 200 | Y-alignment 0.5 when minimum group node size is 200 x 200 | Y-alignment 1.0 when minimum group node size is 200 x 200 |
public java.lang.Object getMinimumNodeSizeDPKey()
DataProvider
that is used to access the minimum sizes for the group nodes.
The DataProvider
registered with this key must provide a mapping from each group node to a
YDimension
object defining the minimum width and height of the group node.
If no provider is registered, the key is null
or if the provider yields no value for a group node,
then the default minimum size is applied
.
DataProvider
key for minimum node sizessetMinimumNodeSizeDPKey(Object)
,
setDefaultMinimumNodeSize(YDimension)
public void setMinimumNodeSizeDPKey(java.lang.Object minimumNodeSizeDPKey)
DataProvider
that is used to access the minimum sizes for the group nodes.
The DataProvider
registered with this key must provide a mapping from each group node to a
YDimension
object defining the minimum width and height of the group node.
If no provider is registered, the key is null
or if the provider yields no value for a group node,
then the default minimum size is applied
.
GroupingKeys.MINIMUM_NODE_SIZE_DPKEY
minimumNodeSizeDPKey
- the DataProvider
key for minimum node sizessetDefaultMinimumNodeSize(YDimension)
public void setDefaultMinimumNodeSize(YDimension minSize)
The default minimum size is used if the DataProvider
registered with the
minimum size key
does not contain a mapping for a group node.
YDimension
object with width and height set to 0
.minSize
- a YDimension
instance representing the default minimum width and height
java.lang.IllegalArgumentException
- if the given YDimension
is null
setMinimumNodeSizeDPKey(Object)
Minimum group node size 50 x 50 | Minimum group node size 200 x 200 |
public YDimension getDefaultMinimumNodeSize()
The default minimum size is used if the DataProvider
registered with the
minimum size key
does not contain a mapping for a group node.
YDimension
instance representing the default minimum width and heightsetDefaultMinimumNodeSize(YDimension)
,
setMinimumNodeSizeDPKey(Object)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |