Is GLSP the right choice for my project? #1106
-
Hi, Last week I started my journey with GLSP and asking some questions here. Although GLSP seems a good fit for my project, I have some doubts :( What I want to achieve:
What are my current problems? For the list of attributes, I'm using a GCompartment with an horizontal layout and three labels as children as you can see below:
I use that auxiliary method in my ModelFactory as follow
On the client I did all the configuration for the custom types as follow:
The problem is that whenever the diagram is rebuilt due to a move of another node or node itself the attributes flick. In the above demo you can see what I mean. If don't use the GCompartment and use a simple label the problem is gone, but that doesn't fit with my idea of inline editing for the name and type of an attribute.
Am I using the right approach? Is GLSP a good option for me? Any feedback? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @rhumbertgz, thank you for providing the details, this helps in understanding your goal! In general, I would say that GLSP is a good fit for your project. We implemented already quite a number of very similar use cases successfully with GLSP and there are also several others in the open-source community who've used GLSP for implementing diagram editors that roughly match your requirements. I'll try to answer your specific questions below.
Yes, this is certainly possible. The default label editing feature only provides validation, but no auto-complete. However, GLSP provides an You can also have a look at the an open-source UML editor (which btw also implements a class diagram editor with GLSP) that provides such an auto-complete feature on label editing (see https://github.com/borkdominik/bigUML/tree/main/client/packages/uml-glsp/src/features/edit-label).
By default, the GLSP server module binds the Looking at the code in the
The flickering you see is caused by unstable or missing GModelElement#ids between model updates. I see in your code that you don't assign an ID to the compartment. This is what causes the flickering, as the client thinks it is a new element and therefore applies an animation to make this element "appear". If you assign an ID to every element, the GLSP client can map every element from a previous version of your GModel to the next version after a model update and thus derive that it shouldn't apply any animation. Obviously this ID needs to be stable (ie the same) across model updates.
Yes, I'd say you are using the right approach with respect to the compartments. As mentioned above, I'd say GLSP is certainly a good option for you and several similar diagram editors to what you want to achieve have been implemented successfully. Many of them are closed-source and are used in proprietary products. But some of them are also open source, so I encourage you to also look at those open-source implementations with GLSP that did something similar for more inspiration. There are a few more I guess, but the first ones that come to my mind are the following:
|
Beta Was this translation helpful? Give feedback.
Hi @rhumbertgz,
thank you for providing the details, this helps in understanding your goal!
In general, I would say that GLSP is a good fit for your project. We implemented already quite a number of very similar use cases successfully with GLSP and there are also several others in the open-source community who've used GLSP for implementing diagram editors that roughly match your requirements.
I'll try to answer your specific questions below.