-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Routingpoint information for newly created edges is not present on server side #738
Comments
After having a more detailed look into this, it seems this is not straight-forward to fix since the responsibilities between the server and client are shared during edge creation:
Since there is no way for the client to know about the router kind before the edge has actually been created, we cannot send the routing points with the edge creation. Therefore we end up with a similar problem as we do with the computed bounds. However, in this case, I think it would be sufficient to provide a mechanism on the client that listens for the next model update and sends the routing point update after the edge creation. We could provide a custom action, e.g., |
That's an interesting problem! :-) I might not have the full picture, but maybe my initial thoughts help:
Please consider these as rather uninformed thoughts as I haven't spent too much time on it. I'm just not quite sure if this is really a bug or rather a requirement that is quite specific to make it a default behavior or introduce another mechansim. |
I see it form a user perspective more like this:
The default route computed form the GLSP client should be fine for the most cases and of course I want to store this valuable information in my model. (In fact, I plan to invest more time in optimizing the route for Manhattan routing to refine the default result.) In BPMN the routing points (named waypoints there) are an important part of the model. It is not just the logical connection between two elements. And to be able to exchange the model (BPMN is of course a general standard) it is important to have this information in the model. Have you seen my second point in #730 that I would suggest to also re-calculate all routings after moving elements? |
Thank you very much for your feedback @rsoika! I get your points and we need to ensure that GLSP eventually supports those use cases. Given that GLSP is a framework though (and not a concrete editor), I think we need to distinguish between whether the framework should do something (by default or optionally), or whether it should "just" enable adopters to do implement it by adding something on top. Since many of those things tend to be quite specific in the detail, I often tend to prefer the latter: enable adopters to implement either case with GLSP, but let it to the adopters of GLSP to implement it in detail.
I understand the reason that one may want to store the derived routes in the model (and not just the routing points manually set by the user), but I don't think it should be something that GLSP does or decides whether it be done or not. I know that many adopters of GLSP explicitly wouldn't want to store or even consider auto-computed routes as it is derived information and subsequent behavior is in certain editors different whether it is an auto-layouted routing point or a manually set routing point. For node sizes, it is a similar issue. Unless manually set, the size of nodes is usually not persisted, also to avoid redundancy and the need to propagate changes across the diagram (e.g. after label change that requires the containing node to become larger, requiring a shift in the center point to which an edge is anchored, etc.). However, GLSP should certainly enable adopters who need to store or process this kind of information to do so. I suggest to let the glsp-client add the computed routing information to the
Yeah, given that's the case for BPMN (and likely several other diagram types), GLSP should support that. But I think with my proposal above, GLSP would support that. BPMN could handle the set computed bounds action and transfer the routing points into the model state and eventually store it into the source model, similar to how it is also done for the node sizes, right? I'm just a little bit wary to add a completely new generic mechanism with the
Yes, this is certainly a common feature. Some editors prefer to re-compute, for others manually set waypoints must stay in tact... this is really diagram-specific. |
I agree, handling this with an approach similar to the
I agree, that the
I personally think it would be better if this would be configurable on the client side. E.g. that there is configuration flag that defines whether routes should be recomputed on move or not. This flag could even be set dynamically. The main advantage of this is that ensures that the client side feedback is consistent with final route after the server update. If we would only adapt the handling of the In addition, we could also cover both usecases on a tool level. e.g. Normal moving-> keep existing route. Move + key press (e.g. shift) - >recompute route. |
Very good objection! I didn't consider client-side visual feedback. Since the client doesn't know what the server is going to do, the client will need to be made aware of whether the routes are going to be thrown away or not to provider proper feedback. |
Hi, Can you please give me a jump start on how to go? I understand that the routing need to be done on the client. So should I start writing my own router and refer the new kind from my server code. Can you give me a short example how to start? At the end I understand I just need to register my own new router type on the server - right?: public class SequenceFlowGNodeBuilder extends AbstractGEdgeBuilder<SequenceFlowGNode, SequenceFlowGNodeBuilder> {
...
@Override
protected void setProperties(final SequenceFlowGNode edge) {
super.setProperties(edge);
edge.setRouterKind(BPMNTypes.DEFAULT_ROUTER);
....
} Do you expect that I can solve the problems discussed here or are there more components I need to consider? I fear that the result will be very specific to BPMN and not have much potential for reusability. But I also don't want to go in the wrong direction.... |
Hi, To follow your thoughts in this discussion I figured out, that in the
is that one I am interested in. Concrete line 60 is the moment where the client has what I am interested in. So it looks not to complicated to me. It should be possible to send out the existing The only thing which make me feel unsure is the fact, that the But anyway: please let me know if you all agree with my idea to send out the Again I have the big problem, that not a single line has been commented in the sprotty project. That makes it so damn hard to contribute to this project. I always feel like a fool asking only stupid questions.... |
I figured out that when I send out a new action at the end of the route(edge: SRoutableElement): RoutedPoint[] {
.........
......
const action=ChangeRoutingPointsOperation.create([{ elementId:edge.id,newRoutingPoints:routedPoints}]);
this.actionDispatcher.dispatch(action);
return routedPoints;
} I get the server side |
My final working solution looks now like this: export class BPMNEdgeRouter extends AbstractEdgeRouter {
.....
route(edge: SRoutableElement): RoutedPoint[] {
if (!edge.source || !edge.target) {
return [];
}
// do we have already routing points or is this the first time..
const initRoutingPoints=(edge.routingPoints.length===0);
// compute route...
....
......
// send a ChangeRoutingPointsOperation in case the routing points were computed the first time
if (initRoutingPoints) {
const action=ChangeRoutingPointsOperation.create([{ elementId:edge.id,newRoutingPoints:routedPoints}]);
this.actionDispatcher.dispatch(action);
}
return routedPoints;
}
.....
} As you can see, I test in the beginning if the But this works only because I am now implementing my own router. So the solution may be not usable for a generic solution... |
Sorry for polluting this thread but it is not working after all. The fact is, that the routing points computed by the Manhattan router, are never reaching the server. The anchor points (which should of course be part of the way-points) are never included in the Since I just can't figure out who actually creates this event and when, it's not possible for me to work on the problem somehow. I give up frustrated at this point and wait until you are back from EclipseCon ;-) |
Implement routing points support for the node glsp server and ensure that the API mirrors the latest changes of the java glsp server (eclipse-glsp/glsp-server#181) Fixes eclipse-glsp/glsp#738
Implement routing points support for the node glsp server and ensure that the API mirrors the latest changes of the java glsp server (eclipse-glsp/glsp-server#181) Fixes eclipse-glsp/glsp#738
Implement routing points support for the node glsp server and ensure that the API mirrors the latest changes of the java glsp server (eclipse-glsp/glsp-server#181) Fixes eclipse-glsp/glsp#738
Implement routing points support for the node glsp server and ensure that the API mirrors the latest changes of the java glsp server (eclipse-glsp/glsp-server#181) Fixes eclipse-glsp/glsp#738
See also: #730
If new edges created with the edge creation tool contain additional routing points, these routing points are only present on the client side but not on the server side (and therefore they are also not persisted into the source model).
Once the new edge is moved the server receives a
ChangeRoutingPoints
update is triggered and the server is updated with the correct routing information.The text was updated successfully, but these errors were encountered: