Package io.jmix.ui.screen
Class Screen.BeforeCloseEvent
java.lang.Object
java.util.EventObject
io.jmix.ui.screen.Screen.BeforeCloseEvent
- All Implemented Interfaces:
 Serializable
- Enclosing class:
 - Screen
 
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();
         }
     }
 - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CloseActionprotected booleanprotected OperationResultFields inherited from class java.util.EventObject
source - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanclosedWith(StandardOutcome outcome) Checks that screen was closed with the givenoutcome.booleanvoidPrevents closing of the screen.voidpreventWindowClose(OperationResult closeResult) Prevents closing of the screen.Methods inherited from class java.util.EventObject
toString 
- 
Field Details
- 
closeAction
 - 
closePrevented
protected boolean closePrevented - 
closeResult
 
 - 
 - 
Constructor Details
- 
BeforeCloseEvent
 
 - 
 - 
Method Details
- 
getSource
- Overrides:
 getSourcein classEventObject
 - 
getCloseAction
- Returns:
 - action passed to the 
Screen.close(CloseAction)method of the screen. 
 - 
preventWindowClose
public void preventWindowClose()Prevents closing of the screen. - 
preventWindowClose
Prevents closing of the screen.- Parameters:
 closeResult- result object returned from theScreen.close(CloseAction)method
 - 
getCloseResult
- Returns:
 - result passed to the 
preventWindowClose(OperationResult)method 
 - 
isClosePrevented
public boolean isClosePrevented()- Returns:
 - whether the closing was prevented by invoking 
preventWindowClose()method 
 - 
closedWith
Checks that screen was closed with the givenoutcome. 
 -