|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.yworks.yfiles.server.graphml.flexio.FlexIOTools
Provides static utility methods for reading and writing graph data using the yFiles FLEX GraphML format.
| Method Summary | |
static void |
addLabel(Edge edge,
Label label)
Add a label to the given edge. |
static void |
addLabel(Node node,
Label label)
Add a label to the given node. |
static boolean |
canBeSerialized(java.lang.Object item,
GraphMLWriteContext context)
Tests and returns if item can be serialized using context i.e. an appropriate serialization
handler can be found and used. |
static void |
commitLabelLayout(ILabelModelParameter flexParameter,
EdgeLabelLayout labelLayout,
Edge edge)
Commit a single label layout to the given yFiles FLEX-compatible label model parameters. |
static void |
commitLabelLayout(ILabelModelParameter flexParameter,
NodeLabelLayout labelLayout,
Node node)
Commit a single label layout to the given yFiles FLEX-compatible label model parameters. |
static double[] |
convertAttributes(Graph graph,
Edge edge,
EdgeLabelLayout labelLayout,
FreeEdgeLabelModel.ModelParameter parameter)
|
static void |
copyLabelLayouts(LayoutGraph graph)
Copies the layout information of the yFiles Java label model parameters to the flex-compatible label models stored in the data providers GraphRoundtripSupport.NODE_LABELS_DPKEY and
GraphRoundtripSupport.EDGE_LABELS_DPKEY.
|
static java.lang.Object |
deserialize(GraphMLParseContext context,
org.w3c.dom.Node xmlNode)
Tries to delegate deserialization to the context and silently ignores GraphMLParseExceptions. |
static java.lang.String |
getARGBString(java.awt.Color c)
Create an argb hex string (e.g. |
static java.lang.Integer |
getExteriorPosition(java.lang.String positionStr)
|
static Label |
getFirstLabel(Edge edge)
Returns the first label registered with the given edge, or null if no labels are registered.
|
static Label |
getFirstLabel(Node node)
Returns the first label registered with the given node, or null if no labels are registered.
|
static java.lang.Integer |
getInteriorPosition(java.lang.String positionStr)
|
static java.util.List |
getLabels(Edge edge)
Return the list of labels registered for the given edge. |
static java.util.List |
getLabels(Node node)
Return the list of labels registered for the given node. |
static IEdgeStyle |
getStyle(Edge edge)
Returns the style that is currently registered for the given edge. |
static INodeStyle |
getStyle(Node node)
Returns the style that is currently registered for the given node. |
static java.lang.Object |
getUserTag(Edge edge)
Returns the user tag of the provided edge. |
static java.lang.Object |
getUserTag(Node node)
Returns the user tag of the provided node. |
static java.lang.Object |
getUserTag(java.lang.Object item,
Graph graph)
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
|
static java.awt.Color |
parseNamedOrARGBColor(java.lang.String colorStr)
Parses a named or argb color string, e.g. |
static void |
serialize(GraphMLWriteContext context,
java.lang.Object subject,
XmlWriter writer)
Try to serialize the given instance and silently ignores GraphMLWriteExceptions. |
static void |
setStyle(Edge edge,
IEdgeStyle style)
Set an edge style for the given node. |
static void |
setStyle(Node node,
INodeStyle style)
Set a node style for the given node. |
static void |
setUserTag(Edge edge,
java.lang.Object tag)
Sets the user tag of the provided node. |
static void |
setUserTag(Node node,
java.lang.Object tag)
Sets the user tag of the provided node. |
static void |
setUserTag(java.lang.Object item,
java.lang.Object tag,
Graph graph)
Sets the user tag of the provided node, edge or Label
The usertag is set on data mapper registered with key
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
|
static void |
syncLabels(Edge edge,
boolean createIfNotExisting)
Synchronizes all Label instances associated with the given
edge with the EdgeLabelLayouts of the LayoutGraph.
|
static void |
syncLabels(Node node,
boolean createIfNotExisting)
Synchronizes all Label instances associated with the given
node with the NodeLabelLayouts of the LayoutGraph.
|
static void |
syncLayoutBoxes(Edge edge,
GraphLayout graphLayout)
Synchronizes the oriented boxes of the edge's label layouts with their label model parameters. |
static boolean |
syncLayouts(ILabelModelParameter edgeLabelModelParameter,
EdgeLabelLayoutImpl edgeLabelLayout)
Try to find a suitable mapping from client-side label layout properties to server-side label model data that can be considered by the yFiles for Java layout algorithms. |
static boolean |
syncLayouts(ILabelModelParameter labelModelParameter,
NodeLabelLayoutImpl nodeLabelLayout)
Try to find a suitable mapping from client-side label layout properties to server-side label model data that can be considered by the yFiles for Java layout algorithms. |
static boolean |
syncLayouts(Label label,
EdgeLabelLayoutImpl layout)
Try to find a suitable mapping from client-side label layout properties to server-side label model data that can be considered by the yFiles for Java layout algorithms. |
static boolean |
syncLayouts(Label label,
NodeLabelLayoutImpl layout)
Try to find a suitable mapping from client-side label layout properties to server-side label model data that can be considered by the yFiles for Java layout algorithms. |
static boolean |
trySerialize(java.lang.Object item,
GraphMLWriteContext context)
Tries to serialize item using context and returns if the serialization was successful. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static java.lang.Object deserialize(GraphMLParseContext context,
org.w3c.dom.Node xmlNode)
GraphMLParseExceptions.
context - The current parse context.xmlNode - The xmlNode that is to be deserialized.
null if the node could not be deserialized.
public static void serialize(GraphMLWriteContext context,
java.lang.Object subject,
XmlWriter writer)
GraphMLWriteExceptions.
context - The current write context.subject - The instance that is to be serialized.writer - The XML writer
public static boolean canBeSerialized(java.lang.Object item,
GraphMLWriteContext context)
item can be serialized using context i.e. an appropriate serialization
handler can be found and used.
item - The item that shall be tested for serializability.context - The context to use for the serialization test.
false if the item is null or can't be serialized, true otherwise.
public static boolean trySerialize(java.lang.Object item,
GraphMLWriteContext context)
item using context and returns if the serialization was successful.
item - The item to serialize. If null is passed only false is returned.context - The context used for serialization.
true if the item could be serialized successfully, false otherwise.
public static void setStyle(Node node,
INodeStyle style)
GraphRoundtripSupport.NODE_STYLE_DPKEY
node - The nodestyle - the style to use for the given nodeGraphRoundtripSupport.NODE_STYLE_DPKEY
public static 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 static 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 tolabel - The label to add to the node.GraphRoundtripSupport.NODE_LABELS_DPKEYpublic static 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 static Label getFirstLabel(Node node)
null if no labels are registered.
The list of labels is retrieved using the data mapper registered with key GraphRoundtripSupport.NODE_LABELS_DPKEY
node - The node to get the label for
null
public static 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 tolabel - The label to add to the edge.GraphRoundtripSupport.EDGE_LABELS_DPKEYpublic static 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 static Label getFirstLabel(Edge edge)
null if no labels are registered.
The list of labels is retrieved using the data mapper registered with key GraphRoundtripSupport.EDGE_LABELS_DPKEY
edge - The node to get the label for
nullpublic static 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 static 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 static java.lang.Object getUserTag(java.lang.Object item,
Graph graph)
Label
The usertag is retrieved using the data mapper registered with key
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
item - The graph item to retrieve the tag for.graph - The graph which contains the item.
null if no user tag has been registered for the provided item.public static java.lang.Object getUserTag(Node node)
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
node - The node to retrieve the tag for.
null if no user tag has been registered for the provided node.public static java.lang.Object getUserTag(Edge edge)
AbstractGraphRoundtripSupport.USERTAGS_DPKEY
edge - The edge to retrieve the tag for
null if no user tag has been registered for the provided edge.
public static void setUserTag(java.lang.Object item,
java.lang.Object tag,
Graph graph)
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.graph - The graph which contains the item.
public static void setUserTag(Node node,
java.lang.Object tag)
node - The node to set the tag for.tag - The user object to set.
public static void setUserTag(Edge edge,
java.lang.Object tag)
edge - The edge to set the tag for.tag - The user object to set.public static void copyLabelLayouts(LayoutGraph graph)
GraphRoundtripSupport.NODE_LABELS_DPKEY and
GraphRoundtripSupport.EDGE_LABELS_DPKEY.
This method can be called to commit the label layouts after running a layout algorithm that changes the label
locations.
public static void syncLabels(Node node,
boolean createIfNotExisting)
Label instances associated with the given
node with the NodeLabelLayouts of the LayoutGraph.
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 the LayoutGraph, if there are more
Label instances associated with this node than label layouts known by the LayoutGraph.
public static void syncLabels(Edge edge,
boolean createIfNotExisting)
Label instances associated with the given
edge with the EdgeLabelLayouts of the LayoutGraph.
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 the LayoutGraph, if there are more
Label instances associated with this edge than label layouts known by the LayoutGraph.
public static boolean syncLayouts(Label label,
EdgeLabelLayoutImpl layout)
syncLayoutBoxes has to be called afterwards.
label - The server-side representation of a client-side labellayout - The yFiles for Java label layout
public static boolean syncLayouts(ILabelModelParameter edgeLabelModelParameter,
EdgeLabelLayoutImpl edgeLabelLayout)
edgeLabelModelParameter - The client-side edge label model parameteredgeLabelLayout - The yFiles for Java label layout
public static void syncLayoutBoxes(Edge edge,
GraphLayout graphLayout)
edge - The edge to synchronize the label layouts for.graphLayout -
public static boolean syncLayouts(Label label,
NodeLabelLayoutImpl layout)
label - The server-side representation of a client-side labellayout - The yFiles for Java label layout
public static boolean syncLayouts(ILabelModelParameter labelModelParameter,
NodeLabelLayoutImpl nodeLabelLayout)
labelModelParameter - The client-side node label model parameternodeLabelLayout - The yFiles for Java label layout
public static void commitLabelLayout(ILabelModelParameter flexParameter,
EdgeLabelLayout labelLayout,
Edge edge)
flexParameter - The yFiles FLEX compatible label model parameters.labelLayout - The yFiles Java edge label layoutedge - The edge
public static double[] convertAttributes(Graph graph,
Edge edge,
EdgeLabelLayout labelLayout,
FreeEdgeLabelModel.ModelParameter parameter)
public static void commitLabelLayout(ILabelModelParameter flexParameter,
NodeLabelLayout labelLayout,
Node node)
flexParameter - The yFiles FLEX compatible label model parameters.labelLayout - The yFiles Java node label layoutnode - The nodepublic static java.lang.String getARGBString(java.awt.Color c)
c - The color to create a String representation of.
public static java.awt.Color parseNamedOrARGBColor(java.lang.String colorStr)
Color.WHITE is returned.
colorStr - The string to be parsed.
public static java.lang.Integer getInteriorPosition(java.lang.String positionStr)
public static java.lang.Integer getExteriorPosition(java.lang.String positionStr)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||