public class LayoutGraphAdapter extends Object implements com.yworks.yfiles.layout.IGraphLayout, com.yworks.yfiles.algorithms.IGraphInterface
LayoutGraph
from an IGraph
.
Typically, this class is not used directly but through the convenience class LayoutExecutor
or the convenience
methods IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
and
GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
This class will use the provided SelectionModel
to register corresponding
IDataProvider
s for the data provider keys LayoutKeys.AFFECTED_NODES_DPKEY
and LayoutKeys.AFFECTED_EDGES_DPKEY
to the layout graph. Moreover, it will automatically convert IMapper
instances registered with the IMapperRegistry
of the AdaptedGraph
into corresponding IDataProvider
instances of the layout graph.
In addition, this class supports IGraph
s with edge to edge connections, i.e., edges that are adjacent to other
edges. Since such edges are not allowed in an LayoutGraph
, the property HidingEdgesAtEdgesEnabled
specifies whether these edges shouldn't be converted into the layout graph at all or converted into a corresponding
structure with dummy nodes.
The chapter Applying an Automatic Layout describes how automatic layout and graph analysis algorithms from the yFiles Layout and yFiles Basic library components can be accessed from @COMPONENT_NAME@.
CopiedLayoutGraph
,
ILayoutAlgorithm
Modifier and Type | Field and Description |
---|---|
static IEdgeLabelLayoutDpKey<PreferredPlacementDescriptor> |
EDGE_LABEL_LAYOUT_PREFERRED_PLACEMENT_DESCRIPTOR_DPKEY
An
IMapperRegistry tag for an IMapper that provides for the edge ILabel s in the AdaptedGraph
a PreferredPlacementDescriptor instance. |
static EdgeDpKey<IEdge> |
ORIGINAL_EDGE_DPKEY
|
static IEdgeLabelLayoutDpKey<ILabel> |
ORIGINAL_EDGE_LABEL_DPKEY
A data provider key that can be used to look up the original
ILabel of an IEdgeLabelLayout . |
static NodeDpKey<INode> |
ORIGINAL_NODE_DPKEY
|
static INodeLabelLayoutDpKey<ILabel> |
ORIGINAL_NODE_LABEL_DPKEY
A data provider key that can be used to look up the original
ILabel of an INodeLabelLayout . |
static EdgeDpKey<IPort> |
ORIGINAL_SOURCE_PORT_DPKEY
|
static EdgeDpKey<IPort> |
ORIGINAL_TARGET_PORT_DPKEY
|
static NodeDpKey<IEdge> |
PORT_DUMMY_NODE_DPKEY
This key is used to provide information about dummy nodes that have been inserted into the graph to model edges at
edges.
|
static GraphObjectDpKey<Iterable<IPort>> |
UNCONNECTED_PORTS_DPKEY
A data provider key that can be used to look up the original unconnected
ports of the original IPortOwner
of an Node or, in the case of edge-to-edge connections, an
Edge . |
Constructor and Description |
---|
LayoutGraphAdapter()
Creates the adapter with no initial
IGraph and no ISelectionModel . |
LayoutGraphAdapter(IGraph graph)
Creates the adapter using a given
IGraph and ISelectionModel . |
LayoutGraphAdapter(IGraph graph,
ISelectionModel<IModelItem> selectionModel)
Creates the adapter using a given
IGraph and ISelectionModel . |
Modifier and Type | Method and Description |
---|---|
<K,V> IDataProvider |
addDataProvider(Object dataKey,
IMapper<K,V> mapper)
Registers a data provider with the graph using the given look-up key and wrapping the given mapper.
|
static void |
applyLayout(IGraph graph,
ILayoutAlgorithm layout)
Static convenience method that applies a
layout algorithm to an IGraph . |
static void |
applyLayout(IGraph graph,
ILayoutAlgorithm layout,
LayoutData layoutData)
Static convenience method that applies a
layout algorithm to an IGraph . |
void |
applyLayout(ILayoutAlgorithm layout)
Convenience method that applies a
layout algorithm to an IGraph . |
void |
applyLayout(ILayoutAlgorithm layout,
LayoutData layoutData)
Convenience method that applies a
layout algorithm to an IGraph . |
protected IEdgeStyle |
copyStyle(IEdgeStyle style)
Creates a copy of an
IEdgeStyle instance that is used during the layout for path calculations and the like. |
protected INodeStyle |
copyStyle(INodeStyle style)
Creates a copy of an
INodeStyle instance that is used during the layout. |
CopiedLayoutGraph |
createCopiedLayoutGraph()
Creates a
CopiedLayoutGraph for this instance. |
protected EdgeLabelCandidate |
createEdgeLabelCandidate(ILabel originalLabel,
ILabel dummyLabel,
ILabelModelParameter layoutParameter,
IEdgeLabelLayout labelLayout)
Creates the
EdgeLabelCandidate for a given label and ILabelModelParameter combination. |
protected IEdgeLayout |
createEdgeLayout(IEdge edge)
Factory method that creates an
IEdgeLayout implementation that wraps the given IEdge . |
protected INodeLayout |
createEdgePortLayout(IPort port)
Callback factory method that creates the
INodeLayout for the given IPort that is used as a dummy to
represent the port at the IEdge that owns port . |
protected NodeLabelCandidate |
createNodeLabelCandidate(ILabel originalLabel,
ILabel dummyLabel,
ILabelModelParameter layoutParameter,
INodeLabelLayout ownerLayout)
Creates a
NodeLabelCandidate for a given label and ILabelModelParameter combination. |
protected INodeLayout |
createNodeLayout(INode node)
Factory method that creates a
INodeLayout implementation that wraps the given INode . |
Iterable<Object> |
edgeObjects() |
IGraph |
getAdaptedGraph()
Gets or yields the original
IGraph instance that is adapted by this instance. |
Rectangle2D |
getBoundingBox() |
IDataProvider |
getDataProvider(Object dataKey) |
Object[] |
getDataProviderKeys() |
IEdgeLabelLayout[] |
getEdgeLabelLayout(Object edge) |
IEdgeLayout |
getEdgeLayout(Object edge) |
SizeD |
getEdgePortNodeSize()
|
protected ILabelCandidateDescriptor |
getLabelCandidateDescriptor(ILabel originalLabel,
ILabel dummyLabel,
ILabelModelParameter layoutParameter)
Callback that retrieves the label candidate descriptor for the given label and parameter.
|
protected ILabelCandidateDescriptorProvider |
getLabelCandidateDescriptorProvider(IGraph graph)
Callback method that gets the label candidate descriptor provider for the given
IGraph . |
INodeLabelLayout[] |
getNodeLabelLayout(Object node) |
INodeLayout |
getNodeLayout(Object o) |
ISelectionModel<IModelItem> |
getSelectionModel()
Gets the
ISelectionModel to use for the automatically registered IDataProvider instances for the keys LayoutKeys.AFFECTED_NODES_DPKEY
and LayoutKeys.AFFECTED_EDGES_DPKEY . |
Object |
getSource(Object edgeObject) |
Object |
getTarget(Object edgeObject) |
boolean |
isAutomaticEdgeGrouping()
Controls whether edge groups are automatically created for edges that are connected to the same port.
|
boolean |
isCopyingStylesEnabled()
Controls whether node and edge styles should be copied during creation of the layout graph, or if the original instances
should be used.
|
boolean |
isFixPorts()
Controls whether strong port constraints are automatically created.
|
boolean |
isHidingEdgesAtEdgesEnabled()
Determines whether edges at other edges will be hidden from the layout graph or included.
|
Iterable<Object> |
nodeObjects() |
void |
setAdaptedGraph(IGraph value)
Sets or yields the original
IGraph instance that is adapted by this instance. |
void |
setAutomaticEdgeGrouping(boolean value)
Controls whether edge groups are automatically created for edges that are connected to the same port.
|
void |
setCopyingStylesEnabled(boolean value)
Controls whether node and edge styles should be copied during creation of the layout graph, or if the original instances
should be used.
|
protected void |
setEdgePortLocation(IPort port,
PointD newLocation)
Callback method that assigns a new location that matches
newLocation to port . |
void |
setEdgePortNodeSize(SizeD value)
|
void |
setFixPorts(boolean value)
Controls whether strong port constraints are automatically created.
|
void |
setHidingEdgesAtEdgesEnabled(boolean value)
Determines whether edges at other edges will be hidden from the layout graph or included.
|
protected void |
setRelativePortLocation(IPort port,
PointD newRelativeLocation)
Callback method that assigns a new relative location to
port . |
void |
setSelectionModel(ISelectionModel<IModelItem> value)
Sets the
ISelectionModel to use for the automatically registered IDataProvider instances for the keys LayoutKeys.AFFECTED_NODES_DPKEY
and LayoutKeys.AFFECTED_EDGES_DPKEY . |
public static final IEdgeLabelLayoutDpKey<PreferredPlacementDescriptor> EDGE_LABEL_LAYOUT_PREFERRED_PLACEMENT_DESCRIPTOR_DPKEY
IMapperRegistry
tag for an IMapper
that provides for the edge ILabel
s in the AdaptedGraph
a PreferredPlacementDescriptor
instance.
If there is a IMapper
in the MapperRegistry
it will be queried for each edge
label
to set the PreferredPlacementDescriptor
property of the adapted implementation.
public static final EdgeDpKey<IEdge> ORIGINAL_EDGE_DPKEY
IEdge
of an
Edge
.
This data provider is created automatically for a CopiedLayoutGraph
that is created as a copy of an IGraph
with the help of a LayoutGraphAdapter
. Especially, it is available if the layout is run with a LayoutExecutor
or the convenience methods GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
and IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
.
public static final IEdgeLabelLayoutDpKey<ILabel> ORIGINAL_EDGE_LABEL_DPKEY
ILabel
of an IEdgeLabelLayout
.
This data provider is created automatically for a CopiedLayoutGraph
that is created as a copy of an IGraph
with the help of a LayoutGraphAdapter
. Especially, it is available if the layout is run with a LayoutExecutor
or the convenience methods GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
and IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
.
public static final NodeDpKey<INode> ORIGINAL_NODE_DPKEY
INode
of a
Node
.
This data provider is created automatically for a CopiedLayoutGraph
that is created as a copy of an IGraph
with the help of a LayoutGraphAdapter
. Especially, it is available if the layout is run with a LayoutExecutor
or the convenience methods GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
and IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
.
public static final INodeLabelLayoutDpKey<ILabel> ORIGINAL_NODE_LABEL_DPKEY
ILabel
of an INodeLabelLayout
.
This data provider is created automatically for a CopiedLayoutGraph
that is created as a copy of an IGraph
with the help of a LayoutGraphAdapter
. Especially, it is available if the layout is run with a LayoutExecutor
or the convenience methods GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
and IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
.
public static final EdgeDpKey<IPort> ORIGINAL_SOURCE_PORT_DPKEY
source port
of the original IEdge
of an
Edge
.
This data provider is created automatically for a CopiedLayoutGraph
that is created as a copy of an IGraph
with the help of a LayoutGraphAdapter
. Especially, it is available if the layout is run with a LayoutExecutor
or the convenience methods GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
and IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
.
public static final EdgeDpKey<IPort> ORIGINAL_TARGET_PORT_DPKEY
target port
of the original IEdge
of an
Edge
.
This data provider is created automatically for a CopiedLayoutGraph
that is created as a copy of an IGraph
with the help of a LayoutGraphAdapter
. Especially, it is available if the layout is run with a LayoutExecutor
or the convenience methods GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
and IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
.
public static final NodeDpKey<IEdge> PORT_DUMMY_NODE_DPKEY
This key can be used to query an IDataProvider
that yields true
for IDataProvider.getBool(Object)
for nodes that are actually representatives of IPort
s at IEdge
s. Also the IDataProvider.get(Object)
method will yield the corresponding original IEdge
.
public static final GraphObjectDpKey<Iterable<IPort>> UNCONNECTED_PORTS_DPKEY
ports
of the original IPortOwner
of an Node
or, in the case of edge-to-edge connections, an
Edge
.
You can access all (connected and unconnected) ports through the Ports
property of
the original IGraph
elements, which can be retrieved through the ORIGINAL_NODE_DPKEY
and ORIGINAL_EDGE_DPKEY
data providers. The information about whether a port is connected or not is not readily accessible from there, though.
You can use this data provider to specifically find these port, e.g. to create additional
PortCandidate
s or just reserve space for them.
This data provider is created automatically for a CopiedLayoutGraph
that is created as a copy of an IGraph
with the help of a LayoutGraphAdapter
. Especially, it is available if the layout is run with a LayoutExecutor
or the convenience methods GraphControl.morphLayout(ILayoutAlgorithm, java.time.Duration, com.yworks.yfiles.utils.IEventHandler)
and IGraph.applyLayout(ILayoutAlgorithm, LayoutData)
.
public LayoutGraphAdapter()
IGraph
and no ISelectionModel
.
Before this instance can be used for automatic layouts, you mus assign a value to the AdaptedGraph
property.
public LayoutGraphAdapter(IGraph graph)
IGraph
and ISelectionModel
.NullPointerException
- graph
is null.graph
- The graph to build an adapter for.public LayoutGraphAdapter(IGraph graph, ISelectionModel<IModelItem> selectionModel)
IGraph
and ISelectionModel
.NullPointerException
- graph
is null.graph
- The graph to build an adapter for.selectionModel
- The optional selection model to use by the LayoutKeys.AFFECTED_NODES_DPKEY
and LayoutKeys.AFFECTED_EDGES_DPKEY
IDataProvider
instances that are automatically bound to this adapter.public <K,V> IDataProvider addDataProvider(Object dataKey, IMapper<K,V> mapper)
If a mapper is already registered under the given key, it is overwritten.
K
- The type of the key to use.V
- The type of the value to use.dataKey
- The look-up key to register the data provider with.mapper
- The mapper wrapped as data provider.public static final void applyLayout(IGraph graph, ILayoutAlgorithm layout)
layout algorithm
to an IGraph
.graph
- The graph to compute the layout on.layout
- The layout algorithm to apply.public static final void applyLayout(IGraph graph, ILayoutAlgorithm layout, LayoutData layoutData)
layout algorithm
to an IGraph
.layout
- The layout algorithm to apply.graph
- The graph to compute the layout on.layoutData
- The layout data.public final void applyLayout(ILayoutAlgorithm layout)
layout algorithm
to an IGraph
.layout
- The layout algorithm to apply.public final void applyLayout(ILayoutAlgorithm layout, LayoutData layoutData)
layout algorithm
to an IGraph
.layout
- The layout algorithm to apply.layoutData
- The layout data.protected IEdgeStyle copyStyle(IEdgeStyle style)
IEdgeStyle
instance that is used during the layout for path calculations and the like.
This method creates suitable copies of style
for the following IEdgeStyle
implementations:
All other style implementations are replaced by instances of
PolylineEdgeStyle
. If you use a custom style where the edge path calculation depends on the style, you
should overwrite this method and create a copy of your style instance.
style
- The style to copy.style
that is used during layout calculation.protected INodeStyle copyStyle(INodeStyle style)
INodeStyle
instance that is used during the layout.
This method creates suitable copies of style
for the following INodeStyle
implementations:
All other style implementations are replaced by instances of
ShapeNodeStyle
. If you use a custom style where the layout calculation depends on the style, you should
overwrite this method and create a copy of your style instance.
style
- The style to copy.style
that is used during layout calculation.public final CopiedLayoutGraph createCopiedLayoutGraph()
CopiedLayoutGraph
for this instance.CopiedLayoutGraph.commitLayoutToOriginalGraph()
will update this instance.protected EdgeLabelCandidate createEdgeLabelCandidate(ILabel originalLabel, ILabel dummyLabel, ILabelModelParameter layoutParameter, IEdgeLabelLayout labelLayout)
EdgeLabelCandidate
for a given label and ILabelModelParameter
combination.originalLabel
- The original label.dummyLabel
- The dummy label that describes the current laid out label.layoutParameter
- The parameter to create a candidate for.labelLayout
- The IEdgeLabelLayout
of the label to pass to the candidate.null
.protected IEdgeLayout createEdgeLayout(IEdge edge)
IEdgeLayout
implementation that wraps the given IEdge
.edge
- The edge to wrap.protected INodeLayout createEdgePortLayout(IPort port)
INodeLayout
for the given IPort
that is used as a dummy to
represent the port at the IEdge
that owns port
.port
- The port to create the layout for.INodeLayout
that uses the port's location
as the center
of the node.getEdgePortNodeSize()
,
isHidingEdgesAtEdgesEnabled()
protected NodeLabelCandidate createNodeLabelCandidate(ILabel originalLabel, ILabel dummyLabel, ILabelModelParameter layoutParameter, INodeLabelLayout ownerLayout)
NodeLabelCandidate
for a given label and ILabelModelParameter
combination.originalLabel
- The original label.dummyLabel
- The dummy label that describes the current laid out label.layoutParameter
- The parameter to create a candidate for.ownerLayout
- The INodeLabelLayout
of the label to pass to the candidate.null
.protected INodeLayout createNodeLayout(INode node)
INodeLayout
implementation that wraps the given INode
.node
- The node to wrap.public final Iterable<Object> edgeObjects()
edgeObjects
in interface com.yworks.yfiles.algorithms.IGraphInterface
public final IGraph getAdaptedGraph()
IGraph
instance that is adapted by this instance.
Before performing a layout, this property must be set or the adapter must have been created with
LayoutGraphAdapter(IGraph, ISelectionModel)
. Note that this property cannot be assigned again if its value
is already non null
.
IllegalArgumentException
- if the value of this property is already non null
setAdaptedGraph(IGraph)
public final Rectangle2D getBoundingBox()
getBoundingBox
in interface com.yworks.yfiles.layout.IGraphLayout
public final IDataProvider getDataProvider(Object dataKey)
getDataProvider
in interface com.yworks.yfiles.algorithms.IGraphInterface
public final Object[] getDataProviderKeys()
getDataProviderKeys
in interface com.yworks.yfiles.algorithms.IGraphInterface
public final IEdgeLabelLayout[] getEdgeLabelLayout(Object edge)
getEdgeLabelLayout
in interface com.yworks.yfiles.layout.IGraphLayout
public final IEdgeLayout getEdgeLayout(Object edge)
getEdgeLayout
in interface com.yworks.yfiles.layout.IGraphLayout
public final SizeD getEdgePortNodeSize()
IEdge
s that are connected at
other IEdge
s.
If this instance is configured to create dummy nodes for ports at edges, this will be the initial size of the dummy
nodes with the center of the node always being the location of the port. The default is 3x3
.
isHidingEdgesAtEdgesEnabled()
,
setEdgePortNodeSize(SizeD)
protected ILabelCandidateDescriptor getLabelCandidateDescriptor(ILabel originalLabel, ILabel dummyLabel, ILabelModelParameter layoutParameter)
originalLabel
- The original label to which a parameter will be applied.dummyLabel
- The dummy label to which the parameter will be applied.layoutParameter
- The parameter to apply.null
.createNodeLabelCandidate(ILabel, ILabel, ILabelModelParameter, INodeLabelLayout)
,
createEdgeLabelCandidate(ILabel, ILabel, ILabelModelParameter, IEdgeLabelLayout)
,
getLabelCandidateDescriptorProvider(IGraph)
protected ILabelCandidateDescriptorProvider getLabelCandidateDescriptorProvider(IGraph graph)
IGraph
.
This implementation uses the IGraph
's ILookup
to find an implementation of the
ILabelCandidateDescriptorProvider
.
graph
- The graph.ILookup.lookup(Class)
query on graph
for the ILabelCandidateDescriptorProvider
type.public final INodeLabelLayout[] getNodeLabelLayout(Object node)
getNodeLabelLayout
in interface com.yworks.yfiles.layout.IGraphLayout
public final INodeLayout getNodeLayout(Object o)
getNodeLayout
in interface com.yworks.yfiles.layout.IGraphLayout
public final ISelectionModel<IModelItem> getSelectionModel()
ISelectionModel
to use for the automatically registered IDataProvider
instances for the keys LayoutKeys.AFFECTED_NODES_DPKEY
and LayoutKeys.AFFECTED_EDGES_DPKEY
.setSelectionModel(ISelectionModel)
public final Object getSource(Object edgeObject)
getSource
in interface com.yworks.yfiles.algorithms.IGraphInterface
public final Object getTarget(Object edgeObject)
getTarget
in interface com.yworks.yfiles.algorithms.IGraphInterface
public final boolean isAutomaticEdgeGrouping()
If this property is enabled and no edge groups are explicitly created (PortConstraintKeys.SOURCE_GROUP_ID_DPKEY
and PortConstraintKeys.TARGET_GROUP_ID_DPKEY
), for all ports with multiple outgoing resp. incoming edges these
edges will be assigned to the same edge group. The necessary IDataProvider
s will be created automatically.
This features requires edge group support from the ILayoutAlgorithm
.
Default value is true
PortConstraintKeys.SOURCE_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_GROUP_ID_DPKEY
,
LayoutExecutor.isAutomaticEdgeGrouping()
,
isFixPorts()
,
setAutomaticEdgeGrouping(boolean)
public final boolean isCopyingStylesEnabled()
Using the original instances can lead to race conditions if the layout is calculated on a different thread. If
true
, node and edge styles are copied, otherwise, the original instances are used. Default value is
false
.
copyStyle(IEdgeStyle)
,
copyStyle(INodeStyle)
,
setCopyingStylesEnabled(boolean)
public final boolean isFixPorts()
If this property is enabled and no port constraints are explicitly created (PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DPKEY
and PortConstraintKeys.TARGET_PORT_CONSTRAINT_DPKEY
), for all edges strong source and target point constraints
with PortSide.ANY
are created. The necessary IDataProvider
s will be created automatically.
This ensures that view IPort
s are not moved during the layout, if the ILayoutAlgorithm
supports port
constraints.
Default value is false
PortConstraintKeys.SOURCE_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_GROUP_ID_DPKEY
,
LayoutExecutor.isFixPorts()
,
isAutomaticEdgeGrouping()
,
setFixPorts(boolean)
public final boolean isHidingEdgesAtEdgesEnabled()
If this property is set to true
, edges at other edges are simply ignored and not part of the layout graph. The
default is false
in which case dummy nodes are inserted into the layout graph for each source and target port of
an IEdge
that is owned
by an IEdge
.
getEdgePortNodeSize()
,
setHidingEdgesAtEdgesEnabled(boolean)
public final Iterable<Object> nodeObjects()
nodeObjects
in interface com.yworks.yfiles.algorithms.IGraphInterface
public final void setAdaptedGraph(IGraph value)
IGraph
instance that is adapted by this instance.
Before performing a layout, this property must be set or the adapter must have been created with
LayoutGraphAdapter(IGraph, ISelectionModel)
. Note that this property cannot be assigned again if its value
is already non null
.
IllegalArgumentException
- if the value of this property is already non null
value
- The AdaptedGraph to set.getAdaptedGraph()
public final void setAutomaticEdgeGrouping(boolean value)
If this property is enabled and no edge groups are explicitly created (PortConstraintKeys.SOURCE_GROUP_ID_DPKEY
and PortConstraintKeys.TARGET_GROUP_ID_DPKEY
), for all ports with multiple outgoing resp. incoming edges these
edges will be assigned to the same edge group. The necessary IDataProvider
s will be created automatically.
This features requires edge group support from the ILayoutAlgorithm
.
Default value is true
value
- The AutomaticEdgeGrouping to set.PortConstraintKeys.SOURCE_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_GROUP_ID_DPKEY
,
LayoutExecutor.isAutomaticEdgeGrouping()
,
isFixPorts()
,
isAutomaticEdgeGrouping()
public final void setCopyingStylesEnabled(boolean value)
Using the original instances can lead to race conditions if the layout is calculated on a different thread. If
true
, node and edge styles are copied, otherwise, the original instances are used. Default value is
false
.
value
- The CopyingStylesEnabled to set.copyStyle(IEdgeStyle)
,
copyStyle(INodeStyle)
,
isCopyingStylesEnabled()
protected void setEdgePortLocation(IPort port, PointD newLocation)
newLocation
to port
.
This method is called only for ports which are owned by edges. These are represented by dummy nodes during the layout,
and newLocation
is the position of the dummy node after the layout.
port
- The edge port that should be placed.newLocation
- The new location of the port as calculated by the layout algorithm.public final void setEdgePortNodeSize(SizeD value)
IEdge
s that are connected at
other IEdge
s.
If this instance is configured to create dummy nodes for ports at edges, this will be the initial size of the dummy
nodes with the center of the node always being the location of the port. The default is 3x3
.
value
- The EdgePortNodeSize to set.isHidingEdgesAtEdgesEnabled()
,
getEdgePortNodeSize()
public final void setFixPorts(boolean value)
If this property is enabled and no port constraints are explicitly created (PortConstraintKeys.SOURCE_PORT_CONSTRAINT_DPKEY
and PortConstraintKeys.TARGET_PORT_CONSTRAINT_DPKEY
), for all edges strong source and target point constraints
with PortSide.ANY
are created. The necessary IDataProvider
s will be created automatically.
This ensures that view IPort
s are not moved during the layout, if the ILayoutAlgorithm
supports port
constraints.
Default value is false
value
- The FixPorts to set.PortConstraintKeys.SOURCE_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_GROUP_ID_DPKEY
,
LayoutExecutor.isFixPorts()
,
isAutomaticEdgeGrouping()
,
isFixPorts()
public final void setHidingEdgesAtEdgesEnabled(boolean value)
If this property is set to true
, edges at other edges are simply ignored and not part of the layout graph. The
default is false
in which case dummy nodes are inserted into the layout graph for each source and target port of
an IEdge
that is owned
by an IEdge
.
value
- The HidingEdgesAtEdgesEnabled to set.getEdgePortNodeSize()
,
isHidingEdgesAtEdgesEnabled()
protected void setRelativePortLocation(IPort port, PointD newRelativeLocation)
port
.
The default implementation calls IGraph.setRelativePortLocation(IPort, PointD)
with
newRelativeLocation
. Depending on the port location model, the actual resulting port location may be
different.
port
- The port that should be placed.newRelativeLocation
- The new coordinate offsets relative to the center of the node's Layout
's center.public final void setSelectionModel(ISelectionModel<IModelItem> value)
ISelectionModel
to use for the automatically registered IDataProvider
instances for the keys LayoutKeys.AFFECTED_NODES_DPKEY
and LayoutKeys.AFFECTED_EDGES_DPKEY
.value
- The SelectionModel to set.getSelectionModel()