Replies: 2 comments
-
Even with a implementation like this I can't avoid setting the isDirty flag: public class BPMNChangeBoundsOperationHandler extends GModelOperationHandler<ChangeBoundsOperation> {
@Inject
protected BPMNGModelState modelState;
/**
* Update the bounds for all selected elements in the GModel and also in the
* BPMNModel.
*/
@Override
public Optional<Command> createCommand(ChangeBoundsOperation operation) {
return commandOf(() -> {
boolean changesMade = executeChanges(operation);
// If no changes were made, do nothing (return early)
if (!changesMade) {
return; // Early return from the Runnable
}
// Otherwise, proceed with the command execution
// Assuming the commandOf method handles the creation of the Command object
});
}
// update the source model if needed
private boolean executeChanges(ChangeBoundsOperation operation) {
....
return result;
}
..
} |
Beta Was this translation helpful? Give feedback.
-
Hi @rsoika, I have opened #1477 to track this. Regarding your reworked implementation. If you do the check for changes inside of the */
@Override
public Optional<Command> createCommand(ChangeBoundsOperation operation) {
boolean changesMade = executeChanges(operation);
if (!changesMade) {
return Optional.empty();
}
return commandOf(() -> {
// ...
});
} However, I'm afraid that this currently would not work because the We have to look at this and find a generic fix. At the moment there is unfortunately no easy workaround for this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a situation in my GLSP client/server code that I do not understand regarding the isDirty state:
When I move a BPMN element only a little bit (e.g. 1 px) my custom
GModelOperationHandler<ChangeBoundsOperation>
is called.In this handler I recognize that the change is not relevant because of a snap-grid size of 5px. So I do not update my source model.
As a result the element snaps back into the origin position. This is all fine.
But for some reason the isDirty flag is set and indicated on the client side. Means the user is forced to save the model even if nothing has changed at all. I wonder why this is happening.
From another discussion around the isDirty flag I understand that the diry state is only updated automatically if I send (& handle) an Operation from the client to the server.
But means this that a operation like the following is forcing the isDrity Flag?
Can I do something in this method to signal the client that the event was not relevant at all?
Beta Was this translation helpful? Give feedback.
All reactions