Skip to content

Migration guide v1.5.0

Florian Dupuy edited this page Jul 24, 2020 · 1 revision

Graph.substitue(node1, node2) is deprecated

The Graph.substitue(node1, node2) is deprecated (spelling mistake) and Graph.substitute(node1, node2) should be used instead.

Graph node replacement

Graph.replace(oldNode, newNode) is a shortcut for adding and substituting a node in the graph. The line graph.add(newNode) followed by graph.substitute(oldNode, newNode) can thus be replaced by graph.replace(oldNode, newNode).

Migrate from NodeLabelConfiguration/DiagramInitialValueProvider to DiagramLabelProvider

At this release, the NodeLabelConfiguration and DiagramInitialValueProvider classes have been merged into a class named DiagramLabelProvider. In previous releases, the labels of a given node were defined in both files:

  • the labels themselves, that is the String, through the method DiagramInitialValueProvider.getNodeLabelValue(node), which returned a List<String>,
  • the label positions through the method NodeLabelConfiguration.getLabelsPosition(node), which returned a List<LabelPosition>.

Starting from this release, the label is defined only through the method DiagramLabelProvider.getNodeLabels(node), which should return a List<NodeLabel>. The NodeLabel class is the POJO containing the label String and label position LabelPosition.

API

DiagramLabelProvider

The DiagramLabelProvider contains the following methods:

  • InitialValue getInitialValue(node), which was before in DiagramInitialValueProvider,
  • List<NodeLabel> getNodeLabels(node), which concatenates the previous methods DiagramInitialValueProvider.getNodeLabelValue(node) and NodeLabelConfiguration.getLabelsPosition(node),
  • List<NodeDecorator> getNodeDecorators(node), which adds the node decorator feature.

SVGWriter

As a consequence, all the SVGWriter.write() methods

  • do not expect the NodeLabelConfiguration parameter,
  • expect a DiagramLabelProvider parameter instead of the DiagramInitialValueProvider parameter.

For instance:

  • SVGWriter.write(prefixId, graph, initProvider, styleProvider, nodeLabelConfiguration, svgPath) becomes SVGWriter.write(prefixId, graph, labelProvider, styleProvider, svgPath)
  • SVGWriter.write(prefixId, substationGraph, initProvider, styleProvider, nodeLabelConfiguration, svgPath) becomes SVGWriter.write(prefixId, substationGraph, labelProvider, styleProvider, svgPath)