diff --git a/headless-services/commons/commons-util/pom.xml b/headless-services/commons/commons-util/pom.xml index 76f704dd5..55f06e9df 100644 --- a/headless-services/commons/commons-util/pom.xml +++ b/headless-services/commons/commons-util/pom.xml @@ -35,6 +35,11 @@ + + org.apache.commons + commons-text + ${commons-text-version} + com.google.guava guava diff --git a/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/HtmlBuffer.java b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/HtmlBuffer.java index 1a237639a..29c6b57be 100644 --- a/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/HtmlBuffer.java +++ b/headless-services/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/HtmlBuffer.java @@ -13,6 +13,8 @@ package org.springframework.ide.vscode.commons.util; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import org.apache.commons.text.StringEscapeUtils; + /** * Helper class to make it a little easier to create simple html page. * @@ -118,6 +120,12 @@ public class HtmlBuffer { raw(""); } + public void code(String string) { + raw(""); + text(string); + raw(""); + } + /** * Escapes reserved HTML characters in the given string. *

@@ -127,30 +135,6 @@ public class HtmlBuffer { * @return the string with escaped characters */ public static String convertToHTMLContent(String content) { - content= replace(content, '&', "&"); //$NON-NLS-1$ - content= replace(content, '"', """); //$NON-NLS-1$ - content= replace(content, '<', "<"); //$NON-NLS-1$ - return replace(content, '>', ">"); //$NON-NLS-1$ + return StringEscapeUtils.escapeHtml4(content); } - - private static String replace(String text, char c, String s) { - - int previous= 0; - int current= text.indexOf(c, previous); - - if (current == -1) - return text; - - StringBuffer buffer= new StringBuffer(); - while (current > -1) { - buffer.append(text.substring(previous, current)); - buffer.append(s); - previous= current + 1; - current= text.indexOf(c, previous); - } - buffer.append(text.substring(previous)); - - return buffer.toString(); - } - } diff --git a/headless-services/commons/pom.xml b/headless-services/commons/pom.xml index 0b1af8663..465195076 100644 --- a/headless-services/commons/pom.xml +++ b/headless-services/commons/pom.xml @@ -104,23 +104,24 @@ + UTF-8 4.12 3.5.2 - 1.7.25 + 3.8.0.RELEASE + 1.11 + 2.4 + 1.7 + 0.6.0-SNAPSHOT 19.0 1.10.19 2.5.0 2.10 0.7.2 - - 3.8.0.RELEASE 3.1.5.RELEASE 0.7.5.RELEASE - 2.4 - 1.11 + 1.7.25 0.7.0-SNAPSHOT - 0.6.0-SNAPSHOT diff --git a/headless-services/sprotty-si-view/client/css/diagram.css b/headless-services/sprotty-si-view/client/css/diagram.css index 5f788467a..8a7376d2d 100644 --- a/headless-services/sprotty-si-view/client/css/diagram.css +++ b/headless-services/sprotty-si-view/client/css/diagram.css @@ -53,4 +53,22 @@ font-family: SansSerif; font-size: 14pt; text-anchor: middle; +} + +#sprotty-popup { + max-width: 600px; +} + +.sprotty-popup table { + font-size: 8pt; + font-family: 'Courier New', Courier, monospace; + word-wrap: break-word; + word-break: break-all; +} + +.sprotty-popup table td { + vertical-align: top; + text-align: left; + border: 1px dotted gray; + white-space: pre-wrap; } \ No newline at end of file diff --git a/headless-services/sprotty-si-view/client/index.html b/headless-services/sprotty-si-view/client/index.html index f47553772..c22a3cfa5 100644 --- a/headless-services/sprotty-si-view/client/index.html +++ b/headless-services/sprotty-si-view/client/index.html @@ -3,7 +3,7 @@ - sprotty Circles Example + Spring Integration Graph @@ -13,10 +13,9 @@

-

sprotty Circles Example

+

Spring Integration Graph

-

@@ -32,7 +31,6 @@
- diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/GraphDataProvider.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/GraphDataProvider.java index 5d2f6922a..f8838ebe4 100644 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/GraphDataProvider.java +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/GraphDataProvider.java @@ -1,7 +1,30 @@ package org.springframework.ide.si.view; -import org.springframework.ide.si.view.json.SpringIntegrationGraph; +import java.net.URL; +import org.apache.commons.io.IOUtils; +import org.springframework.ide.si.view.json.SpringIntegrationGraphJson; +import org.springframework.util.Assert; + +import com.google.gson.Gson; + +@FunctionalInterface public interface GraphDataProvider { - SpringIntegrationGraph getGraph() throws Exception; + SpringIntegrationGraphJson getGraph() throws Exception; + + static GraphDataProvider fromClasspathResource(String path) { + if (!path.startsWith("/")) { + path = "/"+path; + } + URL url = GraphDataProvider.class.getResource(path); + Assert.notNull(url, "Resource not found: "+path); + return fromUrl(GraphDataProvider.class.getResource(path)); + } + + static GraphDataProvider fromUrl(URL resource) { + return () -> { + String jsonString = IOUtils.toString(resource); + return new Gson().fromJson(jsonString, SpringIntegrationGraphJson.class); + }; + } } diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/IntegrationConfiguration.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/IntegrationConfiguration.java deleted file mode 100644 index ac589ef40..000000000 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/IntegrationConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.springframework.ide.si.view; - -import org.eclipse.elk.alg.layered.options.LayeredOptions; -import org.eclipse.elk.core.options.PortConstraints; -import org.eclipse.elk.core.options.PortSide; -import org.eclipse.elk.graph.properties.IPropertyHolder; -import org.eclipse.sprotty.layout.SprottyLayoutConfigurator; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class IntegrationConfiguration { - - @Bean - public SprottyLayoutConfigurator integrationLayoutConfigurator() { - SprottyLayoutConfigurator configurator = new SprottyLayoutConfigurator(); - - IPropertyHolder holder = configurator.configureByType(SIDiagramGenerator.TYPE_INTEGRATION_GRAPH); - holder.setProperty(LayeredOptions.SPACING_COMPONENT_COMPONENT, 80.0); - holder.setProperty(LayeredOptions.SPACING_NODE_NODE_BETWEEN_LAYERS, 80.0); - - holder = configurator.configureByType("output-port"); - holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.EAST); - - holder = configurator.configureByType("input-port"); - holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.WEST); - - holder = configurator.configureByType("error-port"); - holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.SOUTH); - - holder = configurator.configureByType("node:channel"); - holder.setProperty(LayeredOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); - - holder = configurator.configureByType("node:integration_node"); - holder.setProperty(LayeredOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); - - return configurator; - } - -} diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/IntegrationPopupFactory.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/IntegrationPopupFactory.java deleted file mode 100644 index 39b701601..000000000 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/IntegrationPopupFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.springframework.ide.si.view; - -import java.util.ArrayList; - -import org.eclipse.sprotty.IDiagramServer; -import org.eclipse.sprotty.IPopupModelFactory; -import org.eclipse.sprotty.PreRenderedElement; -import org.eclipse.sprotty.RequestPopupModelAction; -import org.eclipse.sprotty.SGraph; -import org.eclipse.sprotty.SModelElement; -import org.eclipse.sprotty.SModelRoot; -import org.springframework.stereotype.Component; - -@Component -public class IntegrationPopupFactory implements IPopupModelFactory { - - @Override - public SModelRoot createPopupModel(SModelElement element, RequestPopupModelAction request, IDiagramServer server) { - SGraph popup = new SGraph(); - popup.setType("html"); - popup.setId("popup"); - popup.setCanvasBounds(request.getBounds()); - - ArrayList children = new ArrayList<>(); - popup.setChildren(children); - - PreRenderedElement content = new PreRenderedElement(); - children.add(content); - content.setId("popup-title"); - content.setCode("
Hello World!
"); - - return popup; - } - -} diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/MockGraphData.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/MockGraphData.java index 752d9273e..91b4872b2 100644 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/MockGraphData.java +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/MockGraphData.java @@ -2,11 +2,10 @@ package org.springframework.ide.si.view; import java.io.IOException; -import org.apache.commons.io.IOUtils; -import org.springframework.ide.si.view.json.SpringIntegrationGraph; -import org.springframework.stereotype.Component; +import org.springframework.ide.si.view.json.SpringIntegrationGraphJson; import com.google.gson.Gson; +import com.google.gson.JsonObject; public class MockGraphData implements GraphDataProvider { @@ -325,12 +324,10 @@ public class MockGraphData implements GraphDataProvider { "}"; @Override - public SpringIntegrationGraph getGraph() throws IOException { -// Gson gson = new Gson().newBuilder().setPrettyPrinting().create(); -// JsonObject json = gson.fromJson(data, JsonObject.class); -// System.out.println(gson.toJson(json)); - - String data = IOUtils.toString(getClass().getResource("/static/sample.json")); - return new Gson().fromJson(data, SpringIntegrationGraph.class); + public SpringIntegrationGraphJson getGraph() throws IOException { + Gson gson = new Gson().newBuilder().setPrettyPrinting().create(); + JsonObject json = gson.fromJson(data, JsonObject.class); + System.out.println(gson.toJson(json)); + return gson.fromJson(json, SpringIntegrationGraphJson.class); } } diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SIDiagramGenerator.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SIDiagramGenerator.java index 6af681ca2..ab627a5b5 100644 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SIDiagramGenerator.java +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SIDiagramGenerator.java @@ -23,9 +23,9 @@ import org.eclipse.sprotty.SShapeElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.ide.si.view.json.SpringIntegrationEdge; -import org.springframework.ide.si.view.json.SpringIntegrationGraph; -import org.springframework.ide.si.view.json.SpringIntegrationNode; +import org.springframework.ide.si.view.json.SpringIntegrationEdgeJson; +import org.springframework.ide.si.view.json.SpringIntegrationGraphJson; +import org.springframework.ide.si.view.json.SpringIntegrationNodeJson; import org.springframework.ide.vscode.commons.sprotty.api.DiagramGenerator; import org.springframework.ide.vscode.commons.util.Assert; import org.springframework.ide.vscode.commons.util.StringUtil; @@ -62,10 +62,21 @@ public class SIDiagramGenerator implements DiagramGenerator { Gson gson = new GsonBuilder().setPrettyPrinting().create(); + Map nodesById = new HashMap<>(); + + /** + * Fetch node data for given node id. This data is retrieved from the + * model produced the last time 'generateModel' was called. + */ + public synchronized SpringIntegrationNodeJson getNodeData(String nodeId) { + return nodesById.get(nodeId); + } + @Override - public SModelRoot generateModel(String clientId, RequestModelAction modelRequest) { + public synchronized SModelRoot generateModel(String clientId, RequestModelAction modelRequest) { + nodesById.clear(); try { - SpringIntegrationGraph jsonData = graphDataProvider.getGraph(); + SpringIntegrationGraphJson jsonData = graphDataProvider.getGraph(); return toSprottyGraph(jsonData); } catch (Exception e) { log.error("", e); @@ -73,7 +84,7 @@ public class SIDiagramGenerator implements DiagramGenerator { } } - private SGraph toSprottyGraph(SpringIntegrationGraph json) throws Exception { + private SGraph toSprottyGraph(SpringIntegrationGraphJson json) throws Exception { SGraph graph = new SGraph(); graph.setId("root"); graph.setType(TYPE_INTEGRATION_GRAPH); @@ -81,13 +92,11 @@ public class SIDiagramGenerator implements DiagramGenerator { List children = new ArrayList<>(); graph.setChildren(children); - Map nodeIds = new HashMap<>(); - - for (SpringIntegrationNode node : json.getNodes()) { + for (SpringIntegrationNodeJson node : json.getNodes()) { String id = node.getNodeId()+""; String name = node.getName(); - Assert.isLegal(!nodeIds.containsKey(id)); - nodeIds.put(id, node); + Assert.isLegal(!nodesById.containsKey(id)); + nodesById.put(id, node); String type = visualType(node.getComponentType()); switch (type) { case "channel": @@ -99,13 +108,13 @@ public class SIDiagramGenerator implements DiagramGenerator { } int linkId = 0; - for (SpringIntegrationEdge link : json.getLinks()) { + for (SpringIntegrationEdgeJson link : json.getLinks()) { String id = "l"+(linkId++); String sourceId = link.getFrom()+""; String targetId = link.getTo()+""; - SEdge e = createEdge(id, sourceId, targetId, getEdgeLabel(nodeIds.get(sourceId)), link.getType()); + SEdge e = createEdge(id, sourceId, targetId, getEdgeLabel(nodesById.get(sourceId)), link.getType()); children.add(e); } // @@ -122,7 +131,7 @@ public class SIDiagramGenerator implements DiagramGenerator { return graph; } - private String getEdgeLabel(SpringIntegrationNode springIntegrationNode) { + private String getEdgeLabel(SpringIntegrationNodeJson springIntegrationNode) { JsonElement json = gson.toJsonTree(springIntegrationNode); for (String prop : labelProperty.split("\\.")) { if (json instanceof JsonObject) { @@ -161,15 +170,6 @@ public class SIDiagramGenerator implements DiagramGenerator { label.setType("node:label"); label.setText(labelText); centerNode(label); - - compartment.getChildren().add(label); - - label = new SLabel(); - label.setId(id + "-lanbel1"); - label.setType("node:label"); - label.setText("s"); - centerNode(label); - compartment.getChildren().add(label); node.getChildren().add(compartment); @@ -218,7 +218,7 @@ public class SIDiagramGenerator implements DiagramGenerator { private static SNode createChannelNode(String id, String labelText) { SNode node = createNode(id, labelText, "channel"); LayoutOptions layoutOptions = new LayoutOptions(); - layoutOptions.setMinHeight(CHANNEL_HEIGHT); +// layoutOptions.setMinHeight(CHANNEL_HEIGHT); layoutOptions.setMinWidth(MIN_WIDTH); node.setLayoutOptions(layoutOptions); diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SpringIntegrationPopupFactory.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SpringIntegrationPopupFactory.java new file mode 100644 index 000000000..4b00317e7 --- /dev/null +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SpringIntegrationPopupFactory.java @@ -0,0 +1,106 @@ +package org.springframework.ide.si.view; + +import java.util.ArrayList; +import java.util.Map.Entry; + +import org.eclipse.sprotty.IDiagramServer; +import org.eclipse.sprotty.IPopupModelFactory; +import org.eclipse.sprotty.PreRenderedElement; +import org.eclipse.sprotty.RequestPopupModelAction; +import org.eclipse.sprotty.SGraph; +import org.eclipse.sprotty.SModelElement; +import org.eclipse.sprotty.SModelRoot; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.ide.si.view.json.SpringIntegrationNodeJson; +import org.springframework.ide.vscode.commons.util.HtmlBuffer; +import org.springframework.stereotype.Component; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +@Component +public class SpringIntegrationPopupFactory implements IPopupModelFactory { + + @Autowired SIDiagramGenerator siDiagram; + + @Override + public SModelRoot createPopupModel(SModelElement element, RequestPopupModelAction request, IDiagramServer server) { + SpringIntegrationNodeJson nodeData = siDiagram.getNodeData(request.getElementId()); + if (nodeData!=null) { + SGraph popup = new SGraph(); + popup.setType("html"); + popup.setId("popup"); + popup.setCanvasBounds(request.getBounds()); + + ArrayList children = new ArrayList<>(); + popup.setChildren(children); + + addHtmlChild(children, "popup-title", createTitle(nodeData)); + addHtmlChild(children, "popup-body", createBody(nodeData)); + + return popup; + } + return SModelRoot.EMPTY_ROOT; + } + + private void addHtmlChild(ArrayList children, String id, HtmlBuffer html) { + PreRenderedElement content = new PreRenderedElement(); + content.setId(id); + content.setCode(html.toString()); + children.add(content); + } + + protected HtmlBuffer createTitle(SpringIntegrationNodeJson nodeData) { + HtmlBuffer html = new HtmlBuffer(); + html.bold("Full Json Data"); + return html; + } + protected HtmlBuffer createBody(SpringIntegrationNodeJson _nodeData) { + JsonObject nodeData = (JsonObject) new Gson().toJsonTree(_nodeData); + HtmlBuffer html = new HtmlBuffer(); + +// html.raw(""); +// html.raw(""); +// html.raw(""); +// html.raw(""); +// html.raw(""); +// html.raw(""); +// html.raw(""); +// html.raw(""); +// html.raw(""); +// html.raw("
ab
ccde
"); + + html.raw(""); + for (Entry e : nodeData.entrySet()) { + String key = e.getKey(); + dumpProperty(html, key, nodeData.get(key)); + } + html.raw("
"); + return html; + } + + private void dumpProperty(HtmlBuffer html, String key, JsonElement jsonElement) { + if (jsonElement.isJsonPrimitive()) { + String value = jsonElement.getAsString(); + html.raw(""); + html.raw(""); + html.text(key); + html.raw(""); + html.raw(""); + html.text(value); + html.raw(""); + html.raw(""); + } else if (jsonElement.isJsonArray()) { + JsonArray array = (JsonArray) jsonElement; + for (int i = 0; i < array.size(); i++) { + dumpProperty(html, key+"["+i+"]", array.get(i)); + } + } else if (jsonElement.isJsonObject()) { + for (Entry e : jsonElement.getAsJsonObject().entrySet()) { + dumpProperty(html, key+"."+e.getKey(), e.getValue()); + } + } + } +} diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SprottySiViewApplication.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SprottySiViewApplication.java index 1c2c6afa5..6142a5ae0 100644 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SprottySiViewApplication.java +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/SprottySiViewApplication.java @@ -1,5 +1,10 @@ package org.springframework.ide.si.view; +import org.eclipse.elk.alg.layered.options.LayeredOptions; +import org.eclipse.elk.core.options.PortConstraints; +import org.eclipse.elk.core.options.PortSide; +import org.eclipse.elk.graph.properties.IPropertyHolder; +import org.eclipse.sprotty.layout.SprottyLayoutConfigurator; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @@ -8,14 +13,36 @@ import org.springframework.context.annotation.Bean; public class SprottySiViewApplication { @Bean - GraphDataProvider mockGraphDataProvider() { - return new MockGraphData(); + GraphDataProvider graphDataProvider() { +// return new MockGraphData(); + return GraphDataProvider.fromClasspathResource("/sample.json"); + } + + @Bean + public SprottyLayoutConfigurator integrationLayoutConfigurator() { + SprottyLayoutConfigurator configurator = new SprottyLayoutConfigurator(); + + IPropertyHolder holder = configurator.configureByType(SIDiagramGenerator.TYPE_INTEGRATION_GRAPH); + holder.setProperty(LayeredOptions.SPACING_COMPONENT_COMPONENT, 40.0); + holder.setProperty(LayeredOptions.SPACING_NODE_NODE_BETWEEN_LAYERS, 40.0); + + holder = configurator.configureByType("output-port"); + holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.EAST); + + holder = configurator.configureByType("input-port"); + holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.WEST); + + holder = configurator.configureByType("error-port"); + holder.setProperty(LayeredOptions.PORT_SIDE, PortSide.SOUTH); + + holder = configurator.configureByType("node:channel"); + holder.setProperty(LayeredOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); + + holder = configurator.configureByType("node:integration_node"); + holder.setProperty(LayeredOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); + + return configurator; } - -// @Bean -// GraphDataProvider graphDataProvider() { -// -// } public static void main(String[] args) { SpringApplication.run(SprottySiViewApplication.class, args); diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationEdge.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationEdgeJson.java similarity index 86% rename from headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationEdge.java rename to headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationEdgeJson.java index 90bdc71ab..d82952ca5 100644 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationEdge.java +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationEdgeJson.java @@ -1,6 +1,6 @@ package org.springframework.ide.si.view.json; -public class SpringIntegrationEdge extends PrettyJson { +public class SpringIntegrationEdgeJson extends PrettyJson { private int from; private int to; diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationGraph.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationGraphJson.java similarity index 52% rename from headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationGraph.java rename to headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationGraphJson.java index 71b4268a9..9bd309ff7 100644 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationGraph.java +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationGraphJson.java @@ -1,13 +1,12 @@ package org.springframework.ide.si.view.json; -import com.google.gson.JsonArray; import com.google.gson.JsonObject; -public class SpringIntegrationGraph extends PrettyJson { +public class SpringIntegrationGraphJson extends PrettyJson { private JsonObject contentDescriptor; - private SpringIntegrationNode[] nodes; - private SpringIntegrationEdge[] links; + private SpringIntegrationNodeJson[] nodes; + private SpringIntegrationEdgeJson[] links; public JsonObject getContentDescriptor() { return contentDescriptor; @@ -15,16 +14,16 @@ public class SpringIntegrationGraph extends PrettyJson { public void setContentDescriptor(JsonObject contentDescriptor) { this.contentDescriptor = contentDescriptor; } - public SpringIntegrationNode[] getNodes() { + public SpringIntegrationNodeJson[] getNodes() { return nodes; } - public void setNodes(SpringIntegrationNode[] nodes) { + public void setNodes(SpringIntegrationNodeJson[] nodes) { this.nodes = nodes; } - public SpringIntegrationEdge[] getLinks() { + public SpringIntegrationEdgeJson[] getLinks() { return links; } - public void setLinks(SpringIntegrationEdge[] links) { + public void setLinks(SpringIntegrationEdgeJson[] links) { this.links = links; } } diff --git a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationNode.java b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationNodeJson.java similarity index 93% rename from headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationNode.java rename to headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationNodeJson.java index 1e3ae8769..2d3d965f8 100644 --- a/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationNode.java +++ b/headless-services/sprotty-si-view/src/main/java/org/springframework/ide/si/view/json/SpringIntegrationNodeJson.java @@ -2,7 +2,7 @@ package org.springframework.ide.si.view.json; import com.google.gson.JsonObject; -public class SpringIntegrationNode extends PrettyJson { +public class SpringIntegrationNodeJson extends PrettyJson { private int nodeId; private String name; diff --git a/headless-services/sprotty-si-view/src/main/resources/static/sample.json b/headless-services/sprotty-si-view/src/main/resources/sample.json similarity index 99% rename from headless-services/sprotty-si-view/src/main/resources/static/sample.json rename to headless-services/sprotty-si-view/src/main/resources/sample.json index 0e5b4d167..0183edd87 100644 --- a/headless-services/sprotty-si-view/src/main/resources/static/sample.json +++ b/headless-services/sprotty-si-view/src/main/resources/sample.json @@ -281,6 +281,11 @@ } ], "links": [ + { + "from": 5, + "to": 4, + "type": "error" + }, { "from": 5, "to": 1, @@ -305,11 +310,6 @@ "from": 4, "to": 8, "type": "input" - }, - { - "from": 5, - "to": 4, - "type": "error" } ] } \ No newline at end of file