Class Screen.BeforeCloseEvent

java.lang.Object
java.util.EventObject
io.jmix.ui.screen.Screen.BeforeCloseEvent
All Implemented Interfaces:
Serializable
Enclosing class:
Screen

public static class Screen.BeforeCloseEvent extends EventObject
Event sent right before the screen is closed by its Screen.close(CloseAction) method. The screen is still displayed and fully functional.

In this event listener, you can check any conditions and prevent screen closing using the preventWindowClose() method of the event, for example:

     @Subscribe
     protected void onBeforeClose(BeforeCloseEvent event) {
         if (Strings.isNullOrEmpty(textField.getValue())) {
             notifications.create().withCaption("Input required").show();
             event.preventWindowClose();
         }
     }
 
See Also:
  • Field Details

    • closeAction

      protected final CloseAction closeAction
    • closePrevented

      protected boolean closePrevented
    • closeResult

      protected OperationResult closeResult
  • Constructor Details

    • BeforeCloseEvent

      public BeforeCloseEvent(Screen source, CloseAction closeAction)
  • Method Details