From b72501542e2c59558c20500310fddcc69bb85bfc Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 23 Oct 2013 10:02:06 -0500 Subject: [PATCH] IDEMPIERE-1457 Bug in Calendar - java.lang.NullPointerException --- .../src/org/adempiere/webui/component/Tabpanel.java | 11 ++++++----- .../org/adempiere/webui/dashboard/CalendarWindow.java | 3 +++ .../org/adempiere/webui/panel/ITabOnCloseHandler.java | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java index 84d3fc68f3..d953027dd9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java @@ -73,12 +73,13 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace } public void onClose() { - if (onCloseHandler != null) + if (onCloseHandler != null) { onCloseHandler.onClose(this); - - Tab tab = this.getLinkedTab(); - if (tab != null) - tab.close(); + } else { + Tab tab = this.getLinkedTab(); + if (tab != null) + tab.close(); + } } public void setOnCloseHandler(ITabOnCloseHandler handler) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java index e66eb5276d..a173f2fc0d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/CalendarWindow.java @@ -66,6 +66,7 @@ import org.zkoss.zul.Listbox; import org.zkoss.zul.Listitem; import org.zkoss.zul.Popup; import org.zkoss.zul.Span; +import org.zkoss.zul.Tab; import org.zkoss.zul.Timer; import org.zkoss.zul.Toolbarbutton; @@ -198,6 +199,8 @@ public class CalendarWindow extends Window implements EventListener, ITab public void onClose(Tabpanel tabPanel){ //IDEMPIERE-1457: On close, remove calendars away scm calendars.setModel(null); + Tab tab = tabPanel.getLinkedTab(); + tab.close(); } public void onEvent(Event e) throws Exception { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java index a643a772e1..36b1df1741 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java @@ -21,5 +21,7 @@ import org.adempiere.webui.component.Tabpanel; * */ public interface ITabOnCloseHandler { + + /* NOTE onClose method must implement the actual closing of the tab */ public void onClose(Tabpanel tabPanel); }