IDEMPIERE-5520 Navigation between Tabs leave Detached DOM objects (Leak) (#1658)

IDEMPIERE-5559 Cannot find current Find Window - NullPointerException
- Fix navigation error
This commit is contained in:
hengsin 2023-02-01 19:03:39 +08:00 committed by GitHub
parent 9f71eeadbc
commit 560b9f4bad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -62,6 +62,8 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
/*** Replace current tab content ***/
public static final String REPLACE = "replace";
private boolean fireWindowCloseEventOnDetach = true;
public Window()
{
super();
@ -83,6 +85,7 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
super.onPageDetached(page);
if (Executions.getCurrent() != null && Executions.getCurrent().getDesktop() != null &&
Executions.getCurrent().getDesktop().getExecution() != null) {
if (fireWindowCloseEventOnDetach)
Events.sendEvent(this, new Event(DialogEvents.ON_WINDOW_CLOSE, this, null));
}
}
@ -146,4 +149,20 @@ public class Window extends org.zkoss.zul.Window implements ISupportMask
public Component getMaskComponent() {
return showMaskWrapper.getMaskComponent();
}
/**
*
* @return true if {@link DialogEvents#ON_WINDOW_CLOSE} event is fire when window is detach from page
*/
public boolean isFireWindowCloseEventOnDetach() {
return fireWindowCloseEventOnDetach;
}
/**
*
* @param fireWindowCloseEventOnDetach true to fire {@link DialogEvents#ON_WINDOW_CLOSE} event when window is detach from page (default is true)
*/
public void setFireWindowCloseEventOnDetach(boolean fireWindowCloseEventOnDetach) {
this.fireWindowCloseEventOnDetach = fireWindowCloseEventOnDetach;
}
}

View File

@ -353,6 +353,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
LayoutUtils.addSclass("find-window", this);
addEventListener(Events.ON_CANCEL, e -> onCancel());
setFireWindowCloseEventOnDetach(false);
}
public boolean initialize()
@ -2940,6 +2941,9 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
}
}
/**
* hide window and fire {@link DialogEvents#ON_WINDOW_CLOSE} event
*/
public void dispose()
{
// Find SQL