Package io.jmix.ui.component
Class Window.BeforeCloseEvent
java.lang.Object
java.util.EventObject
io.jmix.ui.component.Window.BeforeCloseEvent
- All Implemented Interfaces:
Serializable
- Enclosing interface:
- Window
Event sent right before the window is closed by an external (relative to the window content) action,
like the button in the window tab or by the Esc keyboard shortcut.
The way the window is closing can be obtained via getCloseOrigin()
. Closing can be prevented by
invoking preventWindowClose()
, for example:
For example:
@Subscribe(target = Target.FRAME) protected void onBeforeCloseFrame(Window.BeforeCloseEvent event) { if (event.getCloseOrigin() == CloseOriginType.BREADCRUMBS) { event.preventWindowClose(); } }
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
void
Sets closePrevented flag to true and therefore prevents window close.Methods inherited from class java.util.EventObject
toString
-
Field Details
-
closePrevented
protected boolean closePrevented -
closeOrigin
-
-
Constructor Details
-
BeforeCloseEvent
- Parameters:
source
- the window to be closed
-
-
Method Details
-
getSource
- Overrides:
getSource
in classEventObject
-
getCloseOrigin
- Returns:
- value that describes the event type: close by shortcut / using close button / from breadcrumbs
- See Also:
-
preventWindowClose
public void preventWindowClose()Sets closePrevented flag to true and therefore prevents window close. -
isClosePrevented
public boolean isClosePrevented()- Returns:
- true if at least one event handler called
preventWindowClose()
and window will not be closed
-