public static class Screen.BeforeCloseEvent
extends java.util.EventObject
Screen.close(CloseAction)
method. The screen is still
displayed and fully functional. Component settings are not saved yet.
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(); } }
Modifier and Type | Field and Description |
---|---|
protected CloseAction |
closeAction |
protected boolean |
closePrevented |
protected OperationResult |
closeResult |
Constructor and Description |
---|
BeforeCloseEvent(Screen source,
CloseAction closeAction) |
Modifier and Type | Method and Description |
---|---|
CloseAction |
getCloseAction() |
OperationResult |
getCloseResult() |
Screen |
getScreen() |
Screen |
getSource() |
boolean |
isClosePrevented() |
void |
preventWindowClose()
Prevents closing of the screen.
|
void |
preventWindowClose(OperationResult closeResult)
Prevents closing of the screen.
|
protected final CloseAction closeAction
protected boolean closePrevented
protected OperationResult closeResult
public BeforeCloseEvent(Screen source, CloseAction closeAction)
public Screen getSource()
getSource
in class java.util.EventObject
public Screen getScreen()
public CloseAction getCloseAction()
Screen.close(CloseAction)
method of the screen.public void preventWindowClose()
public void preventWindowClose(OperationResult closeResult)
closeResult
- result object returned from the Screen.close(CloseAction)
method@Nullable public OperationResult getCloseResult()
preventWindowClose(OperationResult)
methodpublic boolean isClosePrevented()
preventWindowClose()
method