Layout issue when graph generated using GModel #454
-
|
I am using GLSP's vscode extension(https://github.com/eclipse-glsp/glsp-vscode-integration) and language server which extends GLSP server. I am creating graph using below code/GModel instead of GSON parser. Code: Using below code to generate GGraph in the org.eclipse.glsp.server.features.core.model.JsonFileGModelLoader class. Issue: Initially label "Parent" will be at left corner when we load the graph and when we perform layout operation(alt + L) then "Parent" label will be moved to center of the containing node. I added vertical alignment, horizontal alignment to the parent and child nodes but still I faced left alignment issue(gNodeChild.getLayoutOptions().put(GLayoutOptions.KEY_V_ALIGN, GConstants.VAlign.CENTER); Requirement: Labels should be aligned to center of the containing node when we load the graph. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
I debugged little and I found that org.eclipse.glsp.graph.impl.GPointImpl will not be same for nodes which will be calculated at client side(for GLabelImpl and GCompartmentImpl). When we call layout operation, we will get different boundary values (X and Y) for these nodes/labels. org.eclipse.glsp.server.utils.LayoutUtil.applyBounds(GModelRoot, ComputedBoundsAction, GModelState) here we are copying boundaries generated at client side into graph model. |
Beta Was this translation helpful? Give feedback.
-
|
Hi, I tested your code sample and to me this looks like an issue with nested GNodes. If I change the implementation of GCompartmentImpl gNodeChild = new GCompartmentImpl();
gNodeChild.setParent(compartmentNode);
gNodeChild.setId("nodeChild");
gNodeChild.setType("comp:comp");
gNodeChild.setLayout(GConstants.Layout.VBOX);@CamilleLetavernier You recently worked on improving the support of structured nodes in GLSP. Are you aware of that issue and/or have an idea why it occurs? @sathya-1994 FYI: If you want to you can also use your fluent Builder API for creating new GModel elements e.g: GNode gNodeParent = new GNodeBuilder()
.id("nodeParent")
.type(DefaultTypes.NODE)
.layout(GConstants.Layout.VBOX)
.layoutOptions(new GLayoutOptions()
.paddingBottom(7d)
.paddingTop(7d)
.paddingLeft(7d)
.paddingRight(7d))
.build(); |
Beta Was this translation helpful? Give feedback.


Hi, I tested your code sample and to me this looks like an issue with nested GNodes. If I change the implementation of
gNodeChildto a compartment everything works as expected.@CamilleLetavernier You recently worked on improving the support of structured nodes in GLSP. Are you aware of that issue and/or have an idea why it occurs?
@sathya-1994 FYI: If you want to you can also use your fluent Builder API for creating new GModel elements e.g: