|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.base.Graph y.layout.LayoutGraph y.layout.DefaultLayoutGraph com.yworks.yfiles.server.graphml.flexio.data.StyledLayoutGraph com.yworks.yfiles.server.graphml.folding.FoldedLayoutGraph
A LayoutGraph
that supports folding operations.
This graph implementation supports folding through the
collapse(Node)
operation and provides access to dummy states
for nodes and edges.
Distinct layouts and styles can be assigned to dummy states.
Access to the dummy states is provided through
getEdgeViewState(DummyEdgeId)
and getNodeViewState(DummyNodeId)
.
The folded graph also supports the notion of a
local root
, which is relevant for
layout calculations
.
Field Summary |
Fields inherited from class y.layout.DefaultLayoutGraph |
edgeLabelFeatureMap, edgeLabelMap, nodeLabelFeatureMap, nodeLabelMap |
Fields inherited from class y.layout.LayoutGraph |
z |
Fields inherited from class y.base.Graph |
AFTER, BEFORE |
Constructor Summary | |
FoldedLayoutGraph()
Creates a new instance of a folded layout graph. |
Method Summary | |
void |
collapse(Node node)
Collapse a group node, hiding its children from the current view. |
EdgeViewState |
createEdgeViewState(DummyEdgeId edgeId)
Creates an edge view state instance for the provided edge id. |
protected DataMap |
createEdgeViewStateMap()
Create the DataMap that stores the EdgeViewState instances
for dummy edges.
|
protected DataMap |
createExpansionStateMap()
Create the DataMap that stores the node expansion state.
|
Node |
createNode()
Creates a new node, applying the default node size .
|
NodeViewState |
createNodeViewState(DummyNodeId nodeId)
Creates a node view state instance for the provided node id. |
protected DataMap |
createNodeViewStateMap()
Create the DataMap that stores the NodeViewState instances
for the collapsed state of group nodes.
|
PortViewState |
createPortViewState(DummyNodePortId nodePortId)
Creates a port view state instance for the provided dummy node port id. |
void |
doLayout(Layouter layouter)
Calculates a layout for the folded graph view defined by this instance. |
void |
doLayout(Layouter layouter,
Node root,
boolean recursive,
byte dummyEdgeMode)
Calculates a layout for the folded graph view defined by this instance. |
void |
expand(Node node)
Expands a collapsed group node, revealing its children in the folded graph view defined by this graph. |
EdgeViewState |
getEdgeViewState(DummyEdgeId edgeId)
Returns the view state of a dummy edge defined by the provided dummy edge id. |
Node |
getLocalRoot()
A non-leaf node that is considered the virtual root node of this graph. |
NodeViewState |
getNodeViewState(DummyNodeId nodeId)
Returns the view state of a collapsed group node. |
java.lang.Object |
getPortOwner(com.yworks.yfiles.server.graphml.folding.DummyEdgePortId dummyEdgePortId)
Returns the port owner of the port described by the provided dummy edge port id. |
PortViewState |
getPortViewState(DummyNodePortId nodePortId)
Returns the view state of a node port defined by the provided dummy node port id. |
boolean |
isExpanded(Node node)
Returns whether the provided node is currently in expanded state. |
boolean |
isReusingDummyNodePorts()
Returns whether this implementation reuses the ports of dummy nodes of this graph for dummy edges. |
boolean |
isReusingMasterPorts()
Returns whether this implementation reuses the ports of non-dummy nodes of this graph for dummy edges. |
void |
setEdgeViewState(DummyEdgeId edgeId,
EdgeViewState viewState)
Sets a view state of a dummy edge identified by the provided dummy edge id. |
void |
setLocalRoot(Node node)
A non-leaf node that is considered the virtual root node of this graph. |
void |
setNodeViewState(DummyNodeId dummyNodeId,
NodeViewState viewState)
Sets the view state of a collapsed group node. |
void |
setPortViewState(DummyNodePortId nodePortId,
PortViewState portViewState)
Sets a view state of a node port identified by the provided dummy node port id. |
void |
setReusingDummyNodePorts(boolean value)
Sets whether this implementation shall reuse the ports of dummy nodes of this graph for dummy edges. |
void |
setReusingMasterPorts(boolean value)
Sets whether this implementation shall reuse the ports of non-dummy nodes of this graph for dummy edges. |
Methods inherited from class com.yworks.yfiles.server.graphml.flexio.data.StyledLayoutGraph |
addLabel, addLabel, addPort, changeEdge, changeEdge, createEdge, createEdge, createEdge, edgesAtPort, getDefaultNodeSize, getLabels, getLabels, getNodeHierarchy, getPorts, getSourcePort, getStyle, getStyle, getTargetPort, getUserTag, getZOrder, getZOrder, removePort, reverseEdge, setDefaultNodeSize, setSourcePort, setStyle, setStyle, setTargetPort, setUserTag, setZOrder, setZOrder, syncLabels, syncLabels |
Methods inherited from class y.layout.DefaultLayoutGraph |
createEdgeLayout, createGraphCopyFactory, createLabelFactory, createNodeLayout, getFeature, getFeature, getLabelLayout, getLabelLayout, getLayout, getLayout, setLabelLayout, setLabelLayout, setLabelLayout, setLayout, setLayout |
Methods inherited from class y.layout.LayoutGraph |
getBoundingBox, getCenter, getCenterX, getCenterY, getEdgeLabelLayout, getEdgeLayout, getEdgeList, getHeight, getLocation, getNodeLabelLayout, getNodeLayout, getPath, getPathList, getPointList, getPoints, getRectangle, getSize, getSourcePointAbs, getSourcePointRel, getTargetPointAbs, getTargetPointRel, getWidth, getX, getY, moveBy, setCenter, setCenter, setEndPointsAbs, setLocation, setLocation, setPath, setPath, setPoints, setPoints, setSize, setSize, setSourcePointAbs, setSourcePointRel, setTargetPointAbs, setTargetPointRel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FoldedLayoutGraph()
Creates and registers the data providers required for maintaining the expansion state, node- and edge view states and the local root.
{@inheritDoc}
Method Detail |
public boolean isReusingMasterPorts()
If set to false
(the default), separate port instances are created for dummy edges at non-dummy nodes.
This makes it possible to assign different styles and locations to
source and target ports of dummy edges, which may be desirable if the style and geometry of dummy edges
differs a lot from the style of the master edges.
Dummy edges may of course still connect to non-dummy nodes at one of their ports. Setting this
property to true
will make the dummy edge connect to the
represented port instance.
isReusingDummyNodePorts()
public void setReusingMasterPorts(boolean value)
If set to false
(the default), separate port instances are created for dummy edges at non-dummy nodes.
This makes it possible to assign different styles and locations to
source and target ports of dummy edges, which may be desirable if the style and geometry of dummy edges
differs a lot from the style of the master edges.
Dummy edges may of course still connect to non-dummy nodes at one of their ports. Setting this
property to true
will make the dummy edge connect to the
represented port instance.
#reusingDummyNodePorts
public boolean isReusingDummyNodePorts()
If set to false
(the default), separate port instances are created for dummy edges at dummy nodes.
This makes it possible to assign different styles and locations to
source and target ports of dummy edges, which may be desirable if the style and geometry of dummy edges
differs a lot from the style of the master edges.
Dummy nodes (collapsed group nodes), will have all of their master's ports represented
in the view by PortViewStates. This property can be used to make dummy edges that connect to the master ports
connect to these PortViewStates instances instead of creating extra dummy ports for the edges.
Note that ports can only be automatically reused by dummy edges if they still connect to the same nodes. Otherwise
the view will have to create new dummy ports to let the edges connect to the representing adjacent nodes.
isReusingMasterPorts()
public void setReusingDummyNodePorts(boolean value)
If set to false
(the default), separate port instances are created for dummy edges at dummy nodes.
This makes it possible to assign different styles and locations to
source and target ports of dummy edges, which may be desirable if the style and geometry of dummy edges
differs a lot from the style of the master edges.
Dummy nodes (collapsed group nodes), will have all of their master's ports represented
in the view by PortViewStates. This property can be used to make dummy edges that connect to the master ports
connect to these PortViewStates instances instead of creating extra dummy ports for the edges.
Note that ports can only be automatically reused by dummy edges if they still connect to the same nodes. Otherwise
the view will have to create new dummy ports to let the edges connect to the representing adjacent nodes.
isReusingMasterPorts()
public void setLocalRoot(Node node)
The local root is considered when a layout is calculated for a folded graph.
node
- A group node that will be set as the virtual root node of
this graph.public Node getLocalRoot()
The local root is considered when a layout is calculated for a folded graph.
protected DataMap createExpansionStateMap()
DataMap
that stores the node expansion state.
The map will be registered as a data provider
with this graph, using the FoldedGraphKeys.EXPANSION_STATE_DPKEY
key.
protected DataMap createNodeViewStateMap()
DataMap
that stores the NodeViewState
instances
for the collapsed state of group nodes.
The map will be registered as a data provider
with this graph, using the FoldedGraphKeys.NODE_VIEW_STATES_DPKEY
key.
protected DataMap createEdgeViewStateMap()
DataMap
that stores the EdgeViewState
instances
for dummy edges.
The map will be registered as a data provider
with this graph, using the FoldedGraphKeys.EDGE_VIEW_STATES_DPKEY
key.
public NodeViewState getNodeViewState(DummyNodeId nodeId)
If no view state has been defined for the provided dummy node id yet,
a new instance will be created
and associated with the id.
public void setNodeViewState(DummyNodeId dummyNodeId, NodeViewState viewState)
dummyNodeId
- A dummy node id that identifies the collapsed state of
a group node.viewState
- The node view state that describes the appearance
of the collapsed group node.public NodeViewState createNodeViewState(DummyNodeId nodeId)
This implementation will use the current
style
and layout of the
master node
for the dummy node state.
createNodeViewState
in interface ViewStateCreator
public EdgeViewState getEdgeViewState(DummyEdgeId edgeId)
If no view state has been defined for the provided dummy edge id yet,
a new instance will be created
and associated with the id.
public void setEdgeViewState(DummyEdgeId edgeId, EdgeViewState viewState)
edgeId
- A dummy edge id that identifies a dummy state of
a master edge in a folded graph.viewState
- The edge view state that describes the visual
appearance of the dummy edge.public EdgeViewState createEdgeViewState(DummyEdgeId edgeId)
If #reusingMasterPorts
and/or #reusingDummyNodePorts
are set to true
, the
master ports resp. PortViewStates are reused if appropriate.
Otherwise this implementation will use the current style
of the
master edge
for the dummy edge state.
The source and target port of the edge view state are then set to the center
of the source and target nodes (i.e., Port
instances with
offsets (0,0)
are used).
createEdgeViewState
in interface ViewStateCreator
public PortViewState getPortViewState(DummyNodePortId nodePortId)
If no view state has been defined for the provided dummy node port id yet,
a new instance will be createPortViewState(DummyNodePortId)
created}
and associated with the id.
public void setPortViewState(DummyNodePortId nodePortId, PortViewState portViewState)
nodePortId
- A dummy node port id that identifies a dummy state of
a node port in a folded graph.portViewState
- The port view state that describes the visual appearance of the dummy node port.public PortViewState createPortViewState(DummyNodePortId nodePortId)
This implementation will use the current
Port.getStyle()
style} and offset of the
DummyNodePortId.getMasterPort()
master port}
for the dummy node port state.
createPortViewState
in interface ViewStateCreator
public java.lang.Object getPortOwner(com.yworks.yfiles.server.graphml.folding.DummyEdgePortId dummyEdgePortId)
If the port is at a collapsed node, the node's NodeViewState
dummyEdgePortId
-
public void collapse(Node node)
node
- A group node that will be collapsed.public void expand(Node node)
node
- A collapsed group node. If the group node is already expanded,
this method does nothing.public boolean isExpanded(Node node)
collapse(Node)
,
expand(Node)
public Node createNode()
default node size
.
createNode
in class StyledLayoutGraph
public void doLayout(Layouter layouter)
A FoldingLayoutStage
is used to apply the provided layout algorithm
to the folded graph view.
doLayout
in class StyledLayoutGraph
layouter
- The layout algorithm the will be applied to the folded
graph.doLayout(Layouter, Node, boolean, byte)
public void doLayout(Layouter layouter, Node root, boolean recursive, byte dummyEdgeMode)
A FoldingLayoutStage
is used to apply the provided layout algorithm
to the folded graph view.
layouter
- The layout algorithm the will be applied to the folded
graph.root
- The node that should be considered the virtual local root
for the layout calculation. A different local root than local root that
is currently set
for this graph can be used here.recursive
- Whether to apply a
recursive
layout
calculation to the inner graphs defined by collapsed group nodes.dummyEdgeMode
- The
dummy edge mode
that
should be used for dummy edges created by the folding layout stage.doLayout(Layouter)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |