theia-ide / sprotty

A next-gen web-based graphics framework
Apache License 2.0
138 stars 23 forks source link

[Server] Only recently opened diagram gets updated properly in case of multiple diagram servers #231

Open sainirijul opened 6 years ago

sainirijul commented 6 years ago

I am using the Theia-Yangster frontend extension in a way that it can open multiple widgets( diagram servers) based on one Xtext model. Now, while updating, it will collect URIs of different diagram widgets and then for each URI, it will call the updateDiagram method on the server side.

Now, this is updating the widgets (like labels of Nodes, edges) according to the changes I am making in Xtext model. However, the size and alignment of Node are updated only for the recently opened widget(diagram server).

I believe this is due to copyLayoutData method of class LayoutUtil which copies the layout of one model instance to another. Since the currentRoot is available for the recently opened diagram server hence it is able to copy the layout from currentRoot to newRoot without creating a new model. But the currentRoot is lost for other widgets(diagramServers). Because of this, the size of Node (Height, Width) as well as alignment (Point x,y) becomes zero.

In the given below screenshot, we first generate two diagram widgets which are the result of two different diagram servers. We open the widget one by one and both of them generate their diagrams nicely. image

Next, we try to update our diagrams by just editing our Xtext model. This causes the most recently opened widget to gets updated properly while the old widget has the size and alignment of Nodes as Null. image

for the Xtext model(grl_sample2.turn), Substudent widget was opened recently hence the size and alignment of node gets intact however for the other widgets for example Student, the size and alignment of the nodes become zero.

Please advice.