public class MinimumSizeGroupBoundsCalculator extends InsetsGroupBoundsCalculator
IGroupBoundsCalculator
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 IDataProvider
registered with the graph using the specified minimum node size key
.
Constructor and Description |
---|
MinimumSizeGroupBoundsCalculator()
Creates a new instance of
MinimumSizeGroupBoundsCalculator with default settings. |
MinimumSizeGroupBoundsCalculator(Object minSizeDataProviderKey)
Creates a new instance of
MinimumSizeGroupBoundsCalculator with the given key as
minimum node size key . |
Modifier and Type | Method and Description |
---|---|
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()
Gets the default minimum size (width and height) for group nodes.
|
Object |
getMinimumNodeSizeDpKey()
Gets the key to register a
IDataProvider that is used to access the minimum sizes for the group nodes. |
double |
getXAlignment()
Gets how the nodes are resized horizontally if the calculated width is smaller than the preferred minimum width of a
group node.
|
double |
getYAlignment()
Gets how the nodes are resized vertically if the calculated height is smaller than the preferred minimum height of a
group node.
|
void |
setDefaultMinimumNodeSize(YDimension value)
Sets the default minimum size (width and height) for group nodes.
|
void |
setMinimumNodeSizeDpKey(Object value)
Sets the key to register a
IDataProvider that is used to access the minimum sizes for the group nodes. |
void |
setXAlignment(double value)
Sets how the nodes are resized horizontally if the calculated width is smaller than the preferred minimum width of a
group node.
|
void |
setYAlignment(double value)
Sets how the nodes are resized vertically if the calculated height is smaller than the preferred minimum height of a
group node.
|
createEnlargedBounds, getDefaultInsets, getGroupNodeInsetsDpKey, isEdgeLabelConsiderationEnabled, isNodeHalosConsiderationEnabled, isNodeLabelConsiderationEnabled, setDefaultInsets, setEdgeLabelConsiderationEnabled, setGroupNodeInsetsDpKey, setNodeHalosConsiderationEnabled, setNodeLabelConsiderationEnabled
public MinimumSizeGroupBoundsCalculator()
MinimumSizeGroupBoundsCalculator
with default settings.public MinimumSizeGroupBoundsCalculator(Object minSizeDataProviderKey)
MinimumSizeGroupBoundsCalculator
with the given key as
minimum node size key
.minSizeDataProviderKey
- the IDataProvider
key to use as minimum size key
public Rectangle2D calculateBounds(LayoutGraph graph, Node groupNode, NodeList children)
The insets
associated with the group node will be retrieved from a IDataProvider
registered with
the graph with the current insets key
.
The minimum sizes associated with the group node will be retrieved from a IDataProvider
registered with the
graph with the current minimum size key
.
calculateBounds
in interface IGroupBoundsCalculator
calculateBounds
in class InsetsGroupBoundsCalculator
graph
- the input graphgroupNode
- the group node whose bounds will be calculatedchildren
- a NodeList
containing the nodes that reside inside the group nodeRectangle2D
instance that describes the bounds of the group nodepublic YDimension getDefaultMinimumNodeSize()
The default minimum size is used if the IDataProvider
registered with the minimum size key
does not contain a mapping for a group node.
IllegalArgumentException
- if the given YDimension
is null
YDimension
object with width and height set to 0
.YDimension
instance representing the default minimum width and heightsetMinimumNodeSizeDpKey(Object)
,
setDefaultMinimumNodeSize(YDimension)
public Object getMinimumNodeSizeDpKey()
IDataProvider
that is used to access the minimum sizes for the group nodes.
The IDataProvider
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.
GroupingKeys.MINIMUM_NODE_SIZE_DPKEY
IDataProvider
key for minimum node sizessetDefaultMinimumNodeSize(YDimension)
,
setMinimumNodeSizeDpKey(Object)
public 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.IllegalArgumentException
- if the given value does not lie within [0,1]
[0,1]
setXAlignment(double)
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.IllegalArgumentException
- if the given value does not lie within [0,1]
[0,1]
setYAlignment(double)
public void setDefaultMinimumNodeSize(YDimension value)
The default minimum size is used if the IDataProvider
registered with the minimum size key
does not contain a mapping for a group node.
IllegalArgumentException
- if the given YDimension
is null
YDimension
object with width and height set to 0
.value
- a YDimension
instance representing the default minimum width and heightsetMinimumNodeSizeDpKey(Object)
,
getDefaultMinimumNodeSize()
public void setMinimumNodeSizeDpKey(Object value)
IDataProvider
that is used to access the minimum sizes for the group nodes.
The IDataProvider
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.
GroupingKeys.MINIMUM_NODE_SIZE_DPKEY
value
- the IDataProvider
key for minimum node sizessetDefaultMinimumNodeSize(YDimension)
,
getMinimumNodeSizeDpKey()
public void setXAlignment(double value)
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.IllegalArgumentException
- if the given value does not lie within [0,1]
value
- a horizontal alignment value from the interval [0,1]
getXAlignment()
public void setYAlignment(double value)
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.IllegalArgumentException
- if the given value does not lie within [0,1]
value
- a vertical alignment value from the interval [0,1]
getYAlignment()