|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.NodePortLayoutConfigurator
public class NodePortLayoutConfigurator
Convenience class that adjusts NodePort
positions for ports
that are connected to edges according to the calculated edge connection
points. Alternatively, this class can be used to automatically translate
NodePort
connected to edges into port constraints.
isAutomaticEdgeGroupsEnabled()
,
isAutomaticPortGroupsEnabled()
,
isAutomaticPortConstraintsEnabled()
,
PortConstraint
Field Summary | |
---|---|
static java.lang.Object |
EDGE2D_DPKEY
Data provider key that identifies a data provider which allows access to the edge instances of the Graph2D for a new graph
layout is calculated. |
Constructor Summary | |
---|---|
NodePortLayoutConfigurator()
Initializes an new NodePortLayoutConfigurator instance. |
Method Summary | |
---|---|
LayoutStage |
createPortConsistencyStage()
Creates a layout stage that calculates edge connection points that are consistent with the supported node port locations of the node ports associated to the edges. |
protected byte |
getEdgeDirection(NodePort port)
Determines the preferred direction from which an edge should connect to the specified node port. |
boolean |
isAutomaticEdgeGroupsEnabled()
Returns true if this configurator will group edges by node
port and false otherwise. |
boolean |
isAutomaticPortConstraintsEnabled()
Returns true if this configurator will translate node ports
into port constraints and false otherwise. |
boolean |
isAutomaticPortGroupsEnabled()
Returns true if this configurator will assign edges connected
to shared node ports to corresponding port groups and false
otherwise. |
boolean |
isStrongGroupConstraintsEnabled()
Returns true if this configurator will create strong
constraints automatically translating node ports at group nodes into port
constraints and false otherwise. |
void |
prepareAll(Graph2D graph)
Performs all necessary layout preparations for the specified graph. |
protected void |
prepareEdgeGroups(Graph2D graph)
Groups edges by connected node port. |
protected void |
preparePortConstraints(Graph2D graph)
Translates NodePort positions into strong port constraints. |
protected void |
preparePortGroups(Graph2D graph)
Assigns edges connected to shared node ports to corresponding port groups. |
void |
restoreAll(Graph2D graph)
Performs all necessary resource cleanup and data translation after a layout calculation. |
protected void |
restoreEdgeGroups(Graph2D graph)
Restores saved edge group data. |
protected void |
restorePortConstraints(Graph2D graph)
Restores saved port constraints data. |
protected void |
restorePortGroups(Graph2D graph)
Restores saved port group data. |
protected void |
restorePortPositions(Graph2D graph)
Restores node port positions according to the corresponding edge connection points. |
void |
setAutomaticEdgeGroupsEnabled(boolean enabled)
Specifies whether or not this configurator will group edges by node port. |
void |
setAutomaticPortConstraintsEnabled(boolean enabled)
Specifies whether or not this configurator will translate node ports into port constraints. |
void |
setAutomaticPortGroupsEnabled(boolean enabled)
Specifies whether or not this configurator will assign edges connected to shared node ports to corresponding port groups. |
void |
setStrongGroupConstraintsEnabled(boolean enabled)
Specifies whether this configurator will create strong or weak constraints when automatically translating node ports at group nodes into port constraints. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object EDGE2D_DPKEY
Graph2D
for a new graph
layout is calculated.
createPortConsistencyStage()
Constructor Detail |
---|
public NodePortLayoutConfigurator()
NodePortLayoutConfigurator
instance.
Method Detail |
---|
public boolean isAutomaticPortConstraintsEnabled()
true
if this configurator will translate node ports
into port constraints and false
otherwise.
For normal nodes and folder nodes, a strong port constraint is created for
each node port that is bound to an edge.
For group nodes, method isStrongGroupConstraintsEnabled()
determines whether a strong or a weak port constraint is created for each
node port that is bound to an edge.
Defaults to false
.
true
if this configurator will translate node ports
into port constraints and false
otherwise.setAutomaticPortConstraintsEnabled(boolean)
public void setAutomaticPortConstraintsEnabled(boolean enabled)
For normal nodes and folder nodes, a strong port constraint is created for
each node port that is bound to an edge.
For group nodes, method isStrongGroupConstraintsEnabled()
determines whether a strong or a weak port constraint is created for each
node port that is bound to an edge.
Defaults to false
.
enabled
- if true
this configurator will translate node
ports into port constraints.isAutomaticPortConstraintsEnabled()
public boolean isAutomaticPortGroupsEnabled()
true
if this configurator will assign edges connected
to shared node ports to corresponding port groups and false
otherwise.
Defaults to false
.
isAutomaticEdgeGroupsEnabled()
. However edges in an edge group
share the same port location and (a part of the) edge path, while edges in
a port group share only the same port location.true
if this configurator will assign edges connected
to shared node ports to corresponding port groups and false
otherwise.setAutomaticPortGroupsEnabled(boolean)
,
PortConstraintKeys.SOURCE_PORT_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_PORT_GROUP_ID_DPKEY
,
isAutomaticEdgeGroupsEnabled()
public void setAutomaticPortGroupsEnabled(boolean enabled)
Defaults to false
.
isAutomaticEdgeGroupsEnabled()
. However edges in an edge group
share the same port location and (a part of the) edge path, while edges in
a port group share only the same port location.enabled
- if true
this configurator will assign edges
connected to shared node ports to corresponding port groups.isAutomaticPortGroupsEnabled()
,
isAutomaticEdgeGroupsEnabled()
public boolean isAutomaticEdgeGroupsEnabled()
true
if this configurator will group edges by node
port and false
otherwise.
Defaults to true
.
isAutomaticPortGroupsEnabled()
. However edges in a port group
share only the same port location, while edges in an edge group
share the same port location and (a part of the) edge path.true
if this configurator will group edges by node
port and false
otherwise.setAutomaticEdgeGroupsEnabled(boolean)
,
PortConstraintKeys.SOURCE_GROUPID_KEY
,
PortConstraintKeys.TARGET_GROUPID_KEY
,
isAutomaticPortGroupsEnabled()
public void setAutomaticEdgeGroupsEnabled(boolean enabled)
Defaults to true
.
isAutomaticPortGroupsEnabled()
. However edges in a port group
share only the same port location, while edges in an edge group
share the same port location and (a part of the) edge path.enabled
- if true
this configurator will group edges by
node port.isAutomaticEdgeGroupsEnabled()
,
isAutomaticPortGroupsEnabled()
public boolean isStrongGroupConstraintsEnabled()
true
if this configurator will create strong
constraints automatically translating node ports at group nodes into port
constraints and false
otherwise.
Strong port constraints should be used for edge routing algorithms, because routing algorithms do not rearrange nodes and therefore do not resize group nodes. Weak port constraints should be used for layout algorithms that rearrange nodes and therefore usually have to resize group nodes.
Defaults to true
.
true
if this configurator will translate node ports
at group nodes into strong port constraints and false
otherwise.setStrongGroupConstraintsEnabled(boolean)
,
isAutomaticPortConstraintsEnabled()
public void setStrongGroupConstraintsEnabled(boolean enabled)
Strong port constraints should be used for edge routing algorithms, because routing algorithms do not rearrange nodes and therefore do not resize group nodes. Weak port constraints should be used for layout algorithms that rearrange nodes and therefore usually have to resize group nodes.
Defaults to true
.
enabled
- if true
this configurator will translate node
ports at group nodes into strong port constraints.isStrongGroupConstraintsEnabled()
,
isAutomaticPortConstraintsEnabled()
public void prepareAll(Graph2D graph)
graph
- the Graph2D
instance that is prepared for
automated layout calculation.restoreAll(Graph2D)
protected void prepareEdgeGroups(Graph2D graph)
restoreEdgeGroups(Graph2D)
).
graph
- the Graph2D
whose edges have to be grouped by
node port.restoreEdgeGroups(Graph2D)
protected void preparePortGroups(Graph2D graph)
restorePortGroups(Graph2D)
).
graph
- the Graph2D
whose edges have to be assigned to
port groups.restorePortGroups(Graph2D)
,
PortConstraintKeys.SOURCE_PORT_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_PORT_GROUP_ID_DPKEY
protected void preparePortConstraints(Graph2D graph)
NodePort
positions into strong port constraints.
Existing port constraint data is saved for later restoration (see
restorePortPositions(Graph2D)
).
graph
- the Graph2D
whose node ports have to be
translated into strong port constraints.restorePortConstraints(Graph2D)
protected byte getEdgeDirection(NodePort port)
port
- the NodePort
for which the direction of connecting
edges is determined.
public void restoreAll(Graph2D graph)
graph
- the Graph2D
instance that was previously
prepared for automated layout calculation.prepareAll(Graph2D)
protected void restoreEdgeGroups(Graph2D graph)
graph
- the Graph2D
whose edges were grouped by
node port.prepareEdgeGroups(Graph2D)
protected void restorePortGroups(Graph2D graph)
graph
- the Graph2D
whose edges were assigned to port
groups.prepareEdgeGroups(Graph2D)
protected void restorePortConstraints(Graph2D graph)
graph
- the Graph2D
whose node ports were
translated into strong port constraints.preparePortConstraints(Graph2D)
protected void restorePortPositions(Graph2D graph)
The layout stage created by createPortConsistencyStage()
can be
used to ensure that the connection points of edges connecting to a common
node port do not differ from each other.
graph
- the Graph2D
whose node port positions are
adjusted.public LayoutStage createPortConsistencyStage()
Note: The stage created by this method relies on information
registered with the EDGE2D_DPKEY
data provider key.
Methods prepareAll(Graph2D)
and restoreAll(Graph2D)
will
automatically registered said information.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |