IDEMPIERE-1457 Bug in Calendar - java.lang.NullPointerException

This commit is contained in:
Carlos Ruiz 2013-10-23 10:02:06 -05:00
parent b051da0bef
commit b72501542e
3 changed files with 11 additions and 5 deletions

View File

@ -73,13 +73,14 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace
} }
public void onClose() { public void onClose() {
if (onCloseHandler != null) if (onCloseHandler != null) {
onCloseHandler.onClose(this); onCloseHandler.onClose(this);
} else {
Tab tab = this.getLinkedTab(); Tab tab = this.getLinkedTab();
if (tab != null) if (tab != null)
tab.close(); tab.close();
} }
}
public void setOnCloseHandler(ITabOnCloseHandler handler) { public void setOnCloseHandler(ITabOnCloseHandler handler) {
this.onCloseHandler = handler; this.onCloseHandler = handler;

View File

@ -66,6 +66,7 @@ import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Popup; import org.zkoss.zul.Popup;
import org.zkoss.zul.Span; import org.zkoss.zul.Span;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Timer; import org.zkoss.zul.Timer;
import org.zkoss.zul.Toolbarbutton; import org.zkoss.zul.Toolbarbutton;
@ -198,6 +199,8 @@ public class CalendarWindow extends Window implements EventListener<Event>, ITab
public void onClose(Tabpanel tabPanel){ public void onClose(Tabpanel tabPanel){
//IDEMPIERE-1457: On close, remove calendars away scm //IDEMPIERE-1457: On close, remove calendars away scm
calendars.setModel(null); calendars.setModel(null);
Tab tab = tabPanel.getLinkedTab();
tab.close();
} }
public void onEvent(Event e) throws Exception { public void onEvent(Event e) throws Exception {

View File

@ -21,5 +21,7 @@ import org.adempiere.webui.component.Tabpanel;
* *
*/ */
public interface ITabOnCloseHandler { public interface ITabOnCloseHandler {
/* NOTE onClose method must implement the actual closing of the tab */
public void onClose(Tabpanel tabPanel); public void onClose(Tabpanel tabPanel);
} }