public static class Window.BeforeCloseEvent
extends java.util.EventObject
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(); } }
CloseOriginType
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Window.CloseOrigin |
closeOrigin |
protected boolean |
closePrevented |
Constructor and Description |
---|
BeforeCloseEvent(Window source,
Window.CloseOrigin closeOrigin) |
Modifier and Type | Method and Description |
---|---|
Window.CloseOrigin |
getCloseOrigin() |
Window |
getSource() |
boolean |
isClosePrevented() |
void |
preventWindowClose()
Sets closePrevented flag to true and therefore prevents window close.
|
protected boolean closePrevented
protected Window.CloseOrigin closeOrigin
public BeforeCloseEvent(Window source, Window.CloseOrigin closeOrigin)
source
- the window to be closedpublic Window getSource()
getSource
in class java.util.EventObject
public Window.CloseOrigin getCloseOrigin()
CloseOriginType
public void preventWindowClose()
public boolean isClosePrevented()
preventWindowClose()
and window will not be closed