mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
Дважды срабатывает CloseListener при програмном закрытии диалоговых окон #PL-2166 Fixed
This commit is contained in:
parent
b9f4dd8d76
commit
39793f96fa
@ -751,6 +751,7 @@ public class WebWindowManager extends WindowManager {
|
|||||||
getCurrentWindowData().windows.clear();
|
getCurrentWindowData().windows.clear();
|
||||||
|
|
||||||
for (com.vaadin.ui.Window win : new ArrayList<>(AppUI.getCurrent().getWindows())) {
|
for (com.vaadin.ui.Window win : new ArrayList<>(AppUI.getCurrent().getWindows())) {
|
||||||
|
removeCloseListeners(win);
|
||||||
AppUI.getCurrent().removeWindow(win);
|
AppUI.getCurrent().removeWindow(win);
|
||||||
Component currentView = AppUI.getCurrent().getContent();
|
Component currentView = AppUI.getCurrent().getContent();
|
||||||
if (currentView instanceof AppWindow)
|
if (currentView instanceof AppWindow)
|
||||||
@ -758,6 +759,13 @@ public class WebWindowManager extends WindowManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeCloseListeners(com.vaadin.ui.Window win) {
|
||||||
|
Collection listeners = win.getListeners(com.vaadin.ui.Window.CloseEvent.class);
|
||||||
|
for (Object listener : listeners) {
|
||||||
|
win.removeCloseListener((com.vaadin.ui.Window.CloseListener) listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void closeWindow(Window window, WindowOpenMode openMode) {
|
private void closeWindow(Window window, WindowOpenMode openMode) {
|
||||||
AppWindow appWindow = app.getAppWindow();
|
AppWindow appWindow = app.getAppWindow();
|
||||||
|
|
||||||
@ -771,6 +779,7 @@ public class WebWindowManager extends WindowManager {
|
|||||||
switch (openMode.openType) {
|
switch (openMode.openType) {
|
||||||
case DIALOG: {
|
case DIALOG: {
|
||||||
final com.vaadin.ui.Window win = (com.vaadin.ui.Window) openMode.getData();
|
final com.vaadin.ui.Window win = (com.vaadin.ui.Window) openMode.getData();
|
||||||
|
removeCloseListeners(win);
|
||||||
AppUI.getCurrent().removeWindow(win);
|
AppUI.getCurrent().removeWindow(win);
|
||||||
fireListeners(window, getTabs().size() != 0);
|
fireListeners(window, getTabs().size() != 0);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user