public class InsetsGroupBoundsCalculator extends Object implements IGroupBoundsCalculator
IGroupBoundsCalculator
calculates the bounds of group nodes and allows to specify custom insets for each
group node.
Insets
are provided by a IDataProvider
that must have been registered with the graph using the
specified insets key
prior to the invocation of the layout algorithm.
Constructor and Description |
---|
InsetsGroupBoundsCalculator()
Constructs an instance of
InsetsGroupBoundsCalculator using the given IDataProvider key as group node insets key
and the given insets as default insets . |
InsetsGroupBoundsCalculator(Object insetsDataProviderKey)
Constructs an instance of
InsetsGroupBoundsCalculator using the given IDataProvider key as group node insets key
and the given insets as default insets . |
InsetsGroupBoundsCalculator(Object insetsDataProviderKey,
YInsets defaultInsets)
Constructs an instance of
InsetsGroupBoundsCalculator using the given IDataProvider key as group node insets key
and the given insets as default insets . |
Modifier and Type | Method and Description |
---|---|
Rectangle2D |
calculateBounds(LayoutGraph graph,
Node groupNode,
NodeList children)
Calculates the bounds of the given group node and enlarges the bounds by the insets associated with the group node.
|
protected Rectangle2D |
createEnlargedBounds(LayoutGraph graph,
Node groupNode,
NodeList children,
Rectangle2D bounds)
Enlarges the given graph bounds by the insets associated with the given group node.
|
YInsets |
getDefaultInsets()
Gets the default insets that will be used if the
IDataProvider registered with the insets key
does not contain a mapping for a specific node. |
Object |
getGroupNodeInsetsDpKey()
Gets the key to register a
IDataProvider that is used to access the insets for the group nodes. |
boolean |
isEdgeLabelConsiderationEnabled()
Gets whether or not the labels of edges contained in a group are considered while calculating the bounds of the group
node.
|
boolean |
isNodeHalosConsiderationEnabled()
Gets whether or not the calculation of the bounds of a group node considers the
NodeHalos
associated with the group's child nodes. |
boolean |
isNodeLabelConsiderationEnabled()
Gets whether or not the labels of nodes contained in a group are considered while calculating the bounds of the group
node.
|
void |
setDefaultInsets(YInsets value)
Sets the default insets that will be used if the
IDataProvider registered with the insets key
does not contain a mapping for a specific node. |
void |
setEdgeLabelConsiderationEnabled(boolean value)
Sets whether or not the labels of edges contained in a group are considered while calculating the bounds of the group
node.
|
void |
setGroupNodeInsetsDpKey(Object value)
Sets the key to register a
IDataProvider that is used to access the insets for the group nodes. |
void |
setNodeHalosConsiderationEnabled(boolean value)
Sets whether or not the calculation of the bounds of a group node considers the
NodeHalos
associated with the group's child nodes. |
void |
setNodeLabelConsiderationEnabled(boolean value)
Sets whether or not the labels of nodes contained in a group are considered while calculating the bounds of the group
node.
|
public InsetsGroupBoundsCalculator()
InsetsGroupBoundsCalculator
using the given IDataProvider
key as group node insets key
and the given insets as default insets
.public InsetsGroupBoundsCalculator(Object insetsDataProviderKey)
InsetsGroupBoundsCalculator
using the given IDataProvider
key as group node insets key
and the given insets as default insets
.insetsDataProviderKey
- the IDataProvider
key to use as insets key
public InsetsGroupBoundsCalculator(Object insetsDataProviderKey, YInsets defaultInsets)
InsetsGroupBoundsCalculator
using the given IDataProvider
key as group node insets key
and the given insets as default insets
.insetsDataProviderKey
- the IDataProvider
key to use as insets key
defaultInsets
- the insets to use as default insets
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
.
calculateBounds
in interface IGroupBoundsCalculator
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 nodeprotected Rectangle2D createEnlargedBounds(LayoutGraph graph, Node groupNode, NodeList children, Rectangle2D bounds)
The insets
associated with the group node will be retrieved from a IDataProvider
registered with
the graph with the current insets key
.
This method is called while calculating the group bounds
to
realize the support for custom insets. It may be overridden to change the way specific insets influence the group node
bounds.
graph
- the input graphgroupNode
- the group node whose bounds should be enlargedchildren
- the list of nodes that the given group node containsbounds
- a Rectangle2D
instance representing the bounds of the given group nodeRectangle2D
instance representing the enlarged bounds of the given group nodepublic YInsets getDefaultInsets()
IDataProvider
registered with the insets key
does not contain a mapping for a specific node.15
.setDefaultInsets(YInsets)
public Object getGroupNodeInsetsDpKey()
IDataProvider
that is used to access the insets for the group nodes.
The IDataProvider
registered with this key must provide a mapping from each group node to a YInsets
(or
YInsets
) instance.
GroupingKeys.GROUP_NODE_INSETS_DPKEY
IDataProvider
keysetGroupNodeInsetsDpKey(Object)
public boolean isEdgeLabelConsiderationEnabled()
false
. Edge labels are not considered during the group bounds calculation.true
if the labels of the edges are considered when calculating the bounds of group nodes, false
otherwisesetEdgeLabelConsiderationEnabled(boolean)
public boolean isNodeHalosConsiderationEnabled()
NodeHalos
associated with the group's child nodes.true
. NodeHalo
s are considered during the group bounds calculation.true
if NodeHalos
associated with nodes should be considered, false
otherwisesetNodeHalosConsiderationEnabled(boolean)
public boolean isNodeLabelConsiderationEnabled()
false
. Node labels are not considered during the group bounds calculation.true
if the labels of the nodes are considered when calculating the bounds of the node's parent group, false
otherwisesetNodeLabelConsiderationEnabled(boolean)
public void setDefaultInsets(YInsets value)
IDataProvider
registered with the insets key
does not contain a mapping for a specific node.15
.value
- the default insets used for group nodes without specific insetsgetDefaultInsets()
public void setEdgeLabelConsiderationEnabled(boolean value)
false
. Edge labels are not considered during the group bounds calculation.value
- true
if the labels of the edges are considered when calculating the bounds of group nodes, false
otherwiseisEdgeLabelConsiderationEnabled()
public void setGroupNodeInsetsDpKey(Object value)
IDataProvider
that is used to access the insets for the group nodes.
The IDataProvider
registered with this key must provide a mapping from each group node to a YInsets
(or
YInsets
) instance.
GroupingKeys.GROUP_NODE_INSETS_DPKEY
value
- the IDataProvider
keygetGroupNodeInsetsDpKey()
public void setNodeHalosConsiderationEnabled(boolean value)
NodeHalos
associated with the group's child nodes.true
. NodeHalo
s are considered during the group bounds calculation.value
- true
if NodeHalos
associated with nodes should be considered, false
otherwiseisNodeHalosConsiderationEnabled()
public void setNodeLabelConsiderationEnabled(boolean value)
false
. Node labels are not considered during the group bounds calculation.value
- true
if the labels of the nodes are considered when calculating the bounds of the node's parent group, false
otherwiseisNodeLabelConsiderationEnabled()