How do I detect an afterCloseEvent when using screenBuilders.editor

I am editing an entity by clicking on a button in a screen using the following code:

screenBuilders.editor(Customer.class, this)
            .editEntity(entity)
            .build()
            .show();

I would now like to run some code once the user closes the Editor window.
How do I do that ?
I noticed that there is no “afterCloseEvent”

In case you do not specify screen class you can add listener to the screen produced by build:

@Inject
private ScreenBuilders screenBuilders;

private void openOtherScreen() {
    Screen screen = screenBuilders.editor(User.class, this)
            .editEntity(user)
            .build();
    screen.addAfterCloseListener(e -> {

    });
    screen.show();
}
1 Like

Thank you Yuriy. It works - Exactly what I was looking for !