diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java index ccf1911267..4b4e22ea9f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPCalendar.java @@ -51,6 +51,7 @@ import org.zkoss.util.Locales; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Desktop; import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; @@ -123,8 +124,7 @@ public class DPCalendar extends DashboardPanel implements EventListener, calendars.addEventListener("onEventCreate", this); calendars.addEventListener("onEventEdit", this); - - EventManager.getInstance().register(ON_REQUEST_CHANGED_TOPIC, this); + createStaticListeners(); } @@ -464,6 +464,22 @@ public class DPCalendar extends DashboardPanel implements EventListener, } } + @Override + public void onPageAttached(Page newpage, Page oldpage) { + super.onPageAttached(newpage, oldpage); + if (newpage != null) { + EventManager.getInstance().register(ON_REQUEST_CHANGED_TOPIC, this); + desktop = getDesktop(); + } + } + + @Override + public void onPageDetached(Page page) { + super.onPageDetached(page); + EventManager.getInstance().unregister(this); + desktop = null; + } + static class TopicSubscriber implements ITopicSubscriber> { @Override diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java index 80e6cf9178..8166928945 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPRecentItems.java @@ -34,6 +34,7 @@ import org.idempiere.distributed.ITopicSubscriber; import org.osgi.service.event.EventHandler; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Desktop; +import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; @@ -106,8 +107,7 @@ public class DPRecentItems extends DashboardPanel implements EventListener { @Override public void onMessage(Integer message) {