Fix problem with PDF Viewer window that cannot be closed on zkwebui.

Steps to reproduce:
- Create an standard order with delivery=Force and complete
- Run the Generate Shipments process (from zkwebui) and fill the parameters to generate the shipments
- Answer Yes when asked to print the shipments
- zkwebui open a pdf viewer window without title that cannot be closed
This patch solves the problem assigning a title to the window when the title is empty
This commit is contained in:
Carlos Ruiz 2011-03-08 11:52:10 -05:00
parent 1c21d4122e
commit 4f3363a0c5
1 changed files with 6 additions and 1 deletions

View File

@ -16,6 +16,8 @@ import java.io.InputStream;
import org.adempiere.webui.component.Window; import org.adempiere.webui.component.Window;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.util.media.AMedia; import org.zkoss.util.media.AMedia;
import org.zkoss.zul.Iframe; import org.zkoss.zul.Iframe;
@ -46,7 +48,10 @@ public class SimplePDFViewer extends Window {
this.setBorder("normal"); this.setBorder("normal");
this.appendChild(iframe); this.appendChild(iframe);
this.setClosable(true); this.setClosable(true);
this.setTitle(title); if (title != null && title.trim().length() > 0)
this.setTitle(title);
else
this.setTitle(Msg.translate(Env.getCtx(), "PDF"));
int width = Double.valueOf(SessionManager.getAppDesktop().getClientInfo().desktopWidth * 0.80).intValue(); int width = Double.valueOf(SessionManager.getAppDesktop().getClientInfo().desktopWidth * 0.80).intValue();
this.setWidth(width + "px"); this.setWidth(width + "px");