|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecty.base.Graph
y.layout.LayoutGraph
y.layout.DefaultLayoutGraph
com.yworks.yfiles.server.graphml.flexio.data.StyledLayoutGraph
This class extends the DefaultLayoutGraph by adding convenient methods to configure styles and labels
for nodes and edges and to access and set their user tags.
INodeHierarchy for this graph
instance which offers grouping related functionality.
| 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 | |
StyledLayoutGraph()
|
|
| Method Summary | |
void |
addLabel(Edge edge,
Label label)
Adds a label to the given edge. |
void |
addLabel(Node node,
Label label)
Adds a label to the given node. |
void |
doLayout(Layouter layouter)
Calculates a layout for the styled graph using the given layout algorithm. |
YDimension |
getDefaultNodeSize()
The default node size the is applied when a new node is created. |
java.util.List |
getLabels(Edge edge)
Returns the list of labels registered for the given edge. |
java.util.List |
getLabels(Node node)
Returns the list of labels registered for the given node. |
INodeHierarchy |
getNodeHierarchy()
Returns an INodeHierarchy for this graph that can be used for grouping related functionality. |
IEdgeStyle |
getStyle(Edge edge)
Returns the style that is currenlty registered for the given edge. |
INodeStyle |
getStyle(Node node)
Returns the style that is currently registered for the given node. |
java.lang.Object |
getUserTag(java.lang.Object item)
Returns the user tag of the provided node, edge or Label
The usertag is retrieved using the data mapper registered with key
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
|
void |
setDefaultNodeSize(YDimension defaultNodeSize)
The default node size the is applied when a new node is created. |
void |
setStyle(Edge edge,
IEdgeStyle style)
Sets an edge style for the given node. |
void |
setStyle(Node node,
INodeStyle style)
Sets a node style for the given node. |
void |
setUserTag(java.lang.Object item,
java.lang.Object tag)
Sets the user tag of the provided node, edge or Label
The usertag is set on data mapper registered with key
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
|
void |
syncLabels(Edge edge,
boolean createIfNotExisting)
Synchronizes all Label instances associated with the given
edge with the EdgeLabelLayouts of this graph.
|
void |
syncLabels(Node node,
boolean createIfNotExisting)
Synchronizes all Label instances associated with the given
node with the NodeLabelLayouts of this graph.
|
| Methods inherited from class y.layout.DefaultLayoutGraph |
createEdgeLayout, createGraphCopyFactory, 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 StyledLayoutGraph()
| Method Detail |
public INodeHierarchy getNodeHierarchy()
INodeHierarchy for this graph that can be used for grouping related functionality.
INodeHierarchy for this graph.public INodeStyle getStyle(Node node)
GraphRoundtripSupport.NODE_STYLE_DPKEY
node - The node to get the style for.
null if no style has been registered yet.
public void setStyle(Node node,
INodeStyle style)
GraphRoundtripSupport.NODE_STYLE_DPKEY
node - The nodestyle - the style to use for the given nodeGraphRoundtripSupport.NODE_STYLE_DPKEYpublic IEdgeStyle getStyle(Edge edge)
GraphRoundtripSupport.EDGE_STYLE_DPKEY
edge - The edge to get the style for.
null if no style has been registered yet.
public void setStyle(Edge edge,
IEdgeStyle style)
GraphRoundtripSupport.EDGE_STYLE_DPKEY
edge - The edgestyle - the style to use for the given edgeGraphRoundtripSupport.EDGE_STYLE_DPKEY
public void addLabel(Node node,
Label label)
GraphRoundtripSupport.NODE_LABELS_DPKEY
If no label list is registed in the corresponding data map yet, a new list is created.
Adding a label will not automatically add a label layout instance to the layout graph. Therefore,
a label that was newly added using this method will not be considered in a layout calculation.
To synchronize the labels of a node with the layout graph, use syncLabels(y.base.Node, boolean).
node - The node to add a label to.label - The label to add to the node.GraphRoundtripSupport.NODE_LABELS_DPKEY
public void addLabel(Edge edge,
Label label)
The label is added using the list found in the data mapper registered with the key GraphRoundtripSupport.EDGE_LABELS_DPKEY
If no label list is registed in the corresponding data map yet, a new label list is created.
Adding a label will not automatically add a label layout instance to the layout graph. Therefore,
a label that was newly added using this method will not be considered in a layout calculation.
To synchronize the labels of an edge with the layout graph, use syncLabels(y.base.Edge, boolean).
edge - The edge to add a label to.label - The label to add to the edge.GraphRoundtripSupport.EDGE_LABELS_DPKEYpublic java.util.List getLabels(Node node)
GraphRoundtripSupport.NODE_LABELS_DPKEY
If no label list is registed in the corresponding data map yet, a new list is created.
node - The node to get the registered labels for.
public java.util.List getLabels(Edge edge)
GraphRoundtripSupport.EDGE_LABELS_DPKEY
If no label list is registed in the corresponding data map yet, a new list is created.
edge - The edge to retrieve the labels for.
public void syncLabels(Node node,
boolean createIfNotExisting)
Label instances associated with the given
node with the NodeLabelLayouts of this graph.
This method can be called if a label was created on the server (e.g. using addLabel(y.base.Edge,
com.yworks.yfiles.server.graphml.flexio.data.Label) and a label layout calculation will be executed before the
graph is sent back to the client.
Note that either a reasonable preferred size should be set on the Label instance or a style which
implements the interface LabelSizeCalculator
(e.g. SimpleLabelStyle; in that case,
a font should be set to that style, too). If neither is set, (40,40) is used.
node - The node to update the labels from.createIfNotExisting - Whether to create new label layout instances for this graph, if there are more
Label instances associated with this node than label layouts known by the LayoutGraph.
public void syncLabels(Edge edge,
boolean createIfNotExisting)
Label instances associated with the given
edge with the EdgeLabelLayouts of this graph.
This method can be called if a label was created on the server (e.g. using addLabel(y.base.Edge,
com.yworks.yfiles.server.graphml.flexio.data.Label) and a label layout calculation will be executed before the
graph is sent back to the client.
Note that either a reasonable preferred size should be set on the Label instance or a style which
implements the interface LabelSizeCalculator
(e.g. SimpleLabelStyle; in that case,
a font should be set to that style, too). If neither is set, (40,40) is used.
edge - The edge to update the labels from.createIfNotExisting - Whether to create new label layout instances for this graph, if there are more
Label instances associated with this edge than label layouts known by the LayoutGraph.public java.lang.Object getUserTag(java.lang.Object item)
Label
The usertag is retrieved using the data mapper registered with key
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
item - The graph item to retrieve the tag for.
null if no user tag has been registered for the provided item.
public void setUserTag(java.lang.Object item,
java.lang.Object tag)
Label
The usertag is set on data mapper registered with key
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
item - The graph item to set the tag for.tag - The user object to set.public YDimension getDefaultNodeSize()
created.
public void setDefaultNodeSize(YDimension defaultNodeSize)
created.
public void doLayout(Layouter layouter)
layouter - The layout algorithm that will be applied to the styled graph.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||