Package io.jmix.flowui.view
Class View.BeforeCloseEvent
java.lang.Object
java.util.EventObject
com.vaadin.flow.component.ComponentEvent<View<?>>
io.jmix.flowui.view.View.BeforeCloseEvent
- All Implemented Interfaces:
Serializable
The first event in the view closing process.
The view is still displayed and fully functional.
In this event listener, you can check any conditions and prevent closing using the
preventClose()
method of the event, for example:
@Subscribe protected void onBeforeClose(BeforeCloseEvent event) { if (Strings.isNullOrEmpty(textField.getTypedValue())) { notifications.show("Input required"); event.preventClose(); } }
-
Field Summary
Modifier and TypeFieldDescriptionprotected final CloseAction
protected boolean
protected OperationResult
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
closedWith
(StandardOutcome outcome) Checks that view was closed with the givenoutcome
.boolean
void
Prevents closing of the view.void
preventClose
(OperationResult closeResult) Prevents closing of the view.Methods inherited from class com.vaadin.flow.component.ComponentEvent
getSource, isFromClient, unregisterListener
Methods inherited from class java.util.EventObject
toString
-
Field Details
-
closeAction
-
closeResult
-
closePrevented
protected boolean closePrevented
-
-
Constructor Details
-
BeforeCloseEvent
-
-
Method Details
-
getCloseAction
- Returns:
- action passed to the
View.close(CloseAction)
method orNavigateCloseAction
-
preventClose
public void preventClose()Prevents closing of the view. -
preventClose
Prevents closing of the view.- Parameters:
closeResult
- result object returned from theView.close(CloseAction)
method
-
isClosePrevented
public boolean isClosePrevented()- Returns:
- whether the closing was prevented by invoking
preventClose()
method
-
getCloseResult
- Returns:
- result passed to the
preventClose(OperationResult)
method
-
closedWith
Checks that view was closed with the givenoutcome
.
-