"Floating" nodes - implementation hints or suggestions? #1417
Replies: 2 comments
-
Interesting! I don't have first-hand experiences with such a use case, especially if it is supposed to be a fully editable diagram overlay. In addition to the options you mentioned, you could also just try to go with two separate GLSP diagrams (main and supplementary), which may connect to the same GLSP server, but happen to be rendered in different parts of the UI (e.g. as a side panel). We did something similar by extending the GLSP Diagram Widget, e.g. in Theia, to render more widgets than just the GLSP diagram widget in the editor. In your case, it would then be two separate GLSP diagram widgets rendered in the same editor. How you arrange those two widget is up to you, but obviously easier if they are side-by-side horizontally or vertically. With a separate GLSP diagram widget and a separate request-model-call cycle (as if it would be a completely independent editor), using the same model factory, include connectables, and using client side layout would work out of the box. Publishing the selection to the tool platform and implementing drag&drop would work by adding some event handlers for drop-events in the respective "independent" GLSP widgets. I don't know how both of these views are logically connected, but this syncing would have to be handled in the server, as the server would get two separate clients and would itself have to figure out that those are actually connected in some way (e.g. via a common id). So with this approach you move the complexity of syncing the state (if it is complex in your use case) to the server. Consequently, this approach is straightforward if there is no complex syncing between the two view states needed. Alternatively, if above seems infeasible, I lean towards approach 1 or 2. Whether 1 or 2 is better depends imho on whether the supplementary view needs full editing support or is rather static. If it is static, approach 2 feels rather straightforward, you could obtain the model state, which contains the nodes to be rendered (and hidden in main) and call the rendering from the GLSP client yourself from the UI extension. You wouldn't need to worry about viewport changes (panning and zooming). If editing support is key, there may be focus issues and tool state issues with that approach. In that case, approach 1 may be better, because then you'd just need to counteract the viewport changes, which seems ugly, but should work technically. Approaches 3 and 4 seem like risky to break some assumptions in the code (now or in future versions). I'm sorry that I can't give a clearer indication, but it very much depends on:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for your thoughts and comments. I will try my luck with approach 2 first and see how far I get. There are actually a couple of different use cases so I'll work my way from easy to hard: Of course, at most one of these is present in any given diagram, or the visual clutter would be terrible :-) The main thing in common is that there is no need for a free form or persisted layout in the sidebar (VBOX would be sufficient), and that editing is typically limited to interactions and to the main diagram. Currently, the diagram editor is targeted at eclipse RCP, with the intention to pivot to a full browser environment when the editing coverage is sufficient. We'll see if the standalone diagram editor covers everything or if embedding in Theia makes more sense (there will still be a java backend running, so presumably a lot of overlap with the benefits of Theia. |
Beta Was this translation helpful? Give feedback.
-
I have some use-cases where I want elements displayed in an overlay and/or sidebar. Typically, that could be realized with an UIExtension.
However, I'd also like to use some of the node/view amenities with these elements:
It seems that these should be full blown nodes, but simply positioned outside the regular diagram (in their own background or layout).
My thoughts on how this could be implemented:
I am not sure what additional steps each approach would need so the lookup of SModelElement from VNode still works in each approach.
I'd be grateful for some experiences or hints on this subject.
Beta Was this translation helpful? Give feedback.
All reactions