IDEMPIERE-5831 - Fix onZoom events to be executed once a click for Broadcast Messages (#1974)

This commit is contained in:
Marcos Gabriel de Oliveira Favaretto 2023-08-21 02:06:40 -03:00 committed by GitHub
parent db833e3665
commit 094dee35dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 13 deletions

View File

@ -22,15 +22,12 @@ import java.util.logging.Level;
import org.adempiere.exceptions.DBException; import org.adempiere.exceptions.DBException;
import org.adempiere.model.MBroadcastMessage; import org.adempiere.model.MBroadcastMessage;
import org.adempiere.webui.ClientInfo; import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.ZoomEvent;
import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.util.ZKUpdateUtil;
import org.compiere.model.MNote; import org.compiere.model.MNote;
import org.compiere.model.MQuery;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -41,7 +38,6 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Cell; import org.zkoss.zul.Cell;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
@ -124,7 +120,6 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
Env.setContext(Env.getCtx(), MBroadcastMessage.CLIENTINFO_BROADCAST_COMPONENT_ID, pnlHead.getUuid()); Env.setContext(Env.getCtx(), MBroadcastMessage.CLIENTINFO_BROADCAST_COMPONENT_ID, pnlHead.getUuid());
setTitle(mbMessages.get(0)); setTitle(mbMessages.get(0));
textMsgContent.setContent(mbMessages.get(0).get_Translation(MBroadcastMessage.COLUMNNAME_BroadcastMessage)); textMsgContent.setContent(mbMessages.get(0).get_Translation(MBroadcastMessage.COLUMNNAME_BroadcastMessage));
pnlHead.addEventListener(ZoomEvent.EVENT_NAME, this);
htmlDiv.setFocus(true); htmlDiv.setFocus(true);
htmlDiv.setStyle("display: table-cell; vertical-align: middle; text-align: center;"); htmlDiv.setStyle("display: table-cell; vertical-align: middle; text-align: center;");
Div divAlign = new Div(); Div divAlign = new Div();
@ -244,13 +239,6 @@ public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup
hashMessages.put(mbMessages.get(currMsg).get_ID(), acknowledged.isChecked()); hashMessages.put(mbMessages.get(currMsg).get_ID(), acknowledged.isChecked());
} }
} }
else if(event.getName().equals(ZoomEvent.EVENT_NAME)) {
Clients.clearBusy();
ZoomEvent ze = (ZoomEvent) event;
if (ze.getData() != null && ze.getData() instanceof MQuery) {
AEnv.zoom((MQuery) ze.getData());
}
}
} }
/** /**

View File

@ -19,13 +19,16 @@ package org.adempiere.webui.panel;
import org.adempiere.webui.ClientInfo; import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.GlobalSearch; import org.adempiere.webui.apps.GlobalSearch;
import org.adempiere.webui.apps.MenuSearchController; import org.adempiere.webui.apps.MenuSearchController;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.event.ZoomEvent;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.AboutWindow; import org.adempiere.webui.window.AboutWindow;
import org.compiere.model.MQuery;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
@ -36,6 +39,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.KeyEvent; import org.zkoss.zk.ui.event.KeyEvent;
import org.zkoss.zk.ui.event.OpenEvent; import org.zkoss.zk.ui.event.OpenEvent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Image; import org.zkoss.zul.Image;
import org.zkoss.zul.Popup; import org.zkoss.zul.Popup;
import org.zkoss.zul.impl.LabelImageElement; import org.zkoss.zul.impl.LabelImageElement;
@ -63,6 +67,7 @@ public class HeaderPanel extends Panel implements EventListener<Event>
{ {
super(); super();
addEventListener(Events.ON_CREATE, this); addEventListener(Events.ON_CREATE, this);
addEventListener(ZoomEvent.EVENT_NAME, this);
} }
protected void onCreate() protected void onCreate()
@ -140,6 +145,12 @@ public class HeaderPanel extends Panel implements EventListener<Event>
}else if (ke.getKeyCode() == 27) { }else if (ke.getKeyCode() == 27) {
popMenu.close(); popMenu.close();
} }
} else if(event.getName().equals(ZoomEvent.EVENT_NAME)) {
Clients.clearBusy();
ZoomEvent ze = (ZoomEvent) event;
if (ze.getData() != null && ze.getData() instanceof MQuery) {
AEnv.zoom((MQuery) ze.getData());
}
} }
} }