diff --git a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
index e78b5368b5..5f52899552 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
+++ b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml
@@ -48,7 +48,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
-
+
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java
index aff56e8d64..9dc068242c 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/report/HTMLExtension.java
@@ -31,6 +31,7 @@ import org.compiere.print.PrintData;
import org.compiere.print.PrintDataElement;
import org.compiere.util.Env;
import org.compiere.util.Msg;
+import org.zkoss.zk.ui.Executions;
/**
*
@@ -43,19 +44,27 @@ public class HTMLExtension implements IHTMLExtension {
private String componentId;
private String scriptURL;
private String styleURL;
+ private String contextPath;
public HTMLExtension(String contextPath, String classPrefix, String componentId) {
String theme = MSysConfig.getValue(MSysConfig.HTML_REPORT_THEME, "/", Env.getAD_Client_ID(Env.getCtx()));
- if (! theme.startsWith("/"))
+ if (! theme.startsWith("/") && !theme.startsWith("~./"))
theme = "/" + theme;
if (! theme.endsWith("/"))
theme = theme + "/";
this.classPrefix = classPrefix;
this.componentId = componentId;
- this.styleURL = contextPath + theme + "css/report.css";
+ if (theme.startsWith("~./")) {
+ if (Executions.getCurrent() != null) {
+ this.styleURL = Executions.encodeURL(theme + "css/report.css");
+ }
+ } else {
+ this.styleURL = contextPath + theme + "css/report.css";
+ }
+ this.contextPath = contextPath;
}
public void extendIDColumn(int row, ConcreteElement columnElement, a href,
@@ -91,8 +100,32 @@ public class HTMLExtension implements IHTMLExtension {
public void setWebAttribute (body reportBody){
// set attribute value for create menu context
- reportBody.addAttribute("windowIco", "/webui" + ThemeManager.getThemeResource("images/mWindow.png"));
- reportBody.addAttribute("reportIco", "/webui" + ThemeManager.getThemeResource("images/mReport.png"));
+ StringBuilder windowImageURL = new StringBuilder();
+ String windowIco = ThemeManager.getThemeResource("images/mWindow.png");
+ if (windowIco.startsWith("~./")) {
+ if (Executions.getCurrent() != null) {
+ windowImageURL.append(Executions.encodeURL(windowIco));
+ }
+ } else {
+ windowImageURL.append(contextPath);
+ if (!windowIco.startsWith("/") && !contextPath.endsWith("/"))
+ windowImageURL.append("/");
+ windowImageURL.append(windowIco);
+ }
+ StringBuilder reportImageURL = new StringBuilder();
+ String reportIco = ThemeManager.getThemeResource("images/mReport.png");
+ if (reportIco.startsWith("~./")) {
+ if (Executions.getCurrent() != null) {
+ reportImageURL.append(Executions.encodeURL(reportIco));
+ }
+ } else {
+ reportImageURL.append(contextPath);
+ if (!reportIco.startsWith("/") && !contextPath.endsWith("/"))
+ reportImageURL.append("/");
+ reportImageURL.append(reportIco);
+ }
+ reportBody.addAttribute("windowIco",windowImageURL.toString());
+ reportBody.addAttribute("reportIco", reportImageURL.toString());
reportBody.addAttribute ("reportLabel", Msg.getMsg(AEnv.getLanguage(Env.getCtx()), "Report").replace("&", ""));
reportBody.addAttribute ("windowLabel", Msg.getMsg(AEnv.getLanguage(Env.getCtx()), "Window"));
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java
index 0da62e6391..4c26444c0e 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java
@@ -23,8 +23,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
import java.util.logging.Level;
import javax.activation.FileDataSource;
@@ -37,7 +35,6 @@ import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.BusyDialog;
-import org.adempiere.webui.apps.DesktopRunnable;
import org.adempiere.webui.apps.WReport;
import org.adempiere.webui.apps.form.WReportCustomization;
import org.adempiere.webui.component.Checkbox;
@@ -63,7 +60,6 @@ import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.IServerPushCallback;
import org.adempiere.webui.util.ServerPushTemplate;
import org.adempiere.webui.util.ZKUpdateUtil;
-import org.compiere.Adempiere;
import org.compiere.model.GridField;
import org.compiere.model.MArchive;
import org.compiere.model.MClient;
@@ -200,8 +196,6 @@ public class ZkReportViewer extends Window implements EventListener, ITab
private BusyDialog progressWindow;
private Mask mask;
- private Future> future;
-
private final static String ON_RENDER_REPORT_EVENT = "onRenderReport";
private Popup toolbarPopup;
@@ -232,6 +226,9 @@ public class ZkReportViewer extends Window implements EventListener, ITab
m_reportEngine.getPrintFormat().get_Translation(MPrintFormat.COLUMNNAME_Name)));
addEventListener(ON_RENDER_REPORT_EVENT, this);
+ addEventListener("onPostInit", e -> {
+ postRenderReportEvent();
+ });
}
@Override
@@ -579,9 +576,6 @@ public class ZkReportViewer extends Window implements EventListener, ITab
int AD_Process_ID = m_reportEngine.getPrintInfo() != null ? m_reportEngine.getPrintInfo().getAD_Process_ID() : 0;
updateToolbarAccess(AD_Window_ID, AD_Process_ID);
- postRenderReportEvent();
- //iframe.setAutohide(true);
-
this.setBorder("normal");
this.addEventListener("onZoom", new EventListener() {
@@ -634,6 +628,8 @@ public class ZkReportViewer extends Window implements EventListener, ITab
});
init = true;
+
+ Events.echoEvent("onPostInit", this, null);
}
/**
@@ -656,29 +652,20 @@ public class ZkReportViewer extends Window implements EventListener, ITab
media = null;
Listitem selected = previewType.getSelectedItem();
if (selected == null || "PDF".equals(selected.getValue())) {
- future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new PDFRendererRunnable(this),getDesktop()));
+ new PDFRendererRunnable(this).run();
} else if ("HTML".equals(previewType.getSelectedItem().getValue())) {
- future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new HTMLRendererRunnable(this),getDesktop()));
+ new HTMLRendererRunnable(this).run();
} else if ("XLS".equals(previewType.getSelectedItem().getValue())) {
- future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new XLSRendererRunnable(this),getDesktop()));
+ new XLSRendererRunnable(this).run();
} else if ("CSV".equals(previewType.getSelectedItem().getValue())) {
- future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new CSVRendererRunnable(this),getDesktop()));
+ new CSVRendererRunnable(this).run();
} else if ("XLSX".equals(previewType.getSelectedItem().getValue())) {
- future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new XLSXRendererRunnable(this),getDesktop()));
+ new XLSXRendererRunnable(this).run();
}
}
private void onPreviewReport() {
try {
- if (future != null) {
- try {
- future.get();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- } catch (ExecutionException e) {
- throw new RuntimeException(e.getCause());
- }
- }
mediaVersion++;
String url = Utils.getDynamicMediaURI(this, mediaVersion, media.getName(), media.getFormat());
String pdfJsUrl = "pdf.js/web/viewer.html?file="+url;
@@ -715,7 +702,6 @@ public class ZkReportViewer extends Window implements EventListener, ITab
revalidate();
} finally {
hideBusyDialog();
- future = null;
}
}
@@ -940,12 +926,6 @@ public class ZkReportViewer extends Window implements EventListener, ITab
m_ctx = null;
m_WindowNo = -1;
}
- if (future != null && !future.isDone())
- {
- future.cancel(true);
- future = null;
- }
-
}
public void onEvent(Event event) throws Exception {
diff --git a/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js b/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js
index 660f8d214e..f36b15480a 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js
+++ b/org.adempiere.ui.zk/WEB-INF/src/web/js/org/idempiere/commons/report.js
@@ -86,10 +86,13 @@ window.idempiere.getMenu = function(doc, componentId, foreignColumnName, value){
windowMenu.appendChild(href);
menu.appendChild(windowMenu);
- var image = doc.createElement("img");
- image.src = doc.body.getAttribute ("windowIco");
- image.setAttribute("align", "middle");
- href.appendChild(image);
+ var windowIco = doc.body.getAttribute ("windowIco");
+ if (typeof windowIco === 'string' && windowIco.length > 0) {
+ var image = doc.createElement("img");
+ image.src = windowIco;
+ image.setAttribute("align", "middle");
+ href.appendChild(image);
+ }
href.appendChild(doc.createTextNode(doc.body.getAttribute ("windowLabel")));
//report menu item
@@ -109,10 +112,13 @@ window.idempiere.getMenu = function(doc, componentId, foreignColumnName, value){
report.appendChild(reportHref);
menu.appendChild(report);
- var reportimage = doc.createElement("img");
- reportimage.src = doc.body.getAttribute ("reportIco");
- reportimage.setAttribute("align", "middle");
- reportHref.appendChild(reportimage);
+ var reportIco = doc.body.getAttribute ("reportIco");
+ if (typeof reportIco === 'string' && reportIco.length > 0) {
+ var reportimage = doc.createElement("img");
+ reportimage.src = reportIco;
+ reportimage.setAttribute("align", "middle");
+ reportHref.appendChild(reportimage);
+ }
reportHref.appendChild(doc.createTextNode(doc.body.getAttribute ("reportLabel")));
doc.contextMenu = menu;
diff --git a/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/preference.zul b/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/preference.zul
index 78f11ec7a2..e012c0b934 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/preference.zul
+++ b/org.adempiere.ui.zk/WEB-INF/src/web/theme/default/preference.zul
@@ -10,12 +10,15 @@
import org.compiere.util.Env;
import org.adempiere.webui.theme.ITheme;
import org.compiere.model.MSysConfig;
+ import org.zkoss.zul.theme.Themes;
+ import org.zkoss.zk.ui.Executions;
Env.setContext(Env.getCtx(), ITheme.ZK_TOOLBAR_BUTTON_SIZE, "24");
/* Set the next variable if you want to control browser title in theme */
/* Env.setContext(Env.getCtx(), "#ZK_BROWSER_TITLE", "iDempiere"); */
Env.setContext(Env.getCtx(), ITheme.USE_CSS_FOR_WINDOW_SIZE, "Y");
Env.setContext(Env.getCtx(), ITheme.USE_FONT_ICON_FOR_IMAGE, MSysConfig.getBooleanValue(MSysConfig.ZK_THEME_USE_FONT_ICON_FOR_IMAGE, false));
+ Themes.setTheme(Executions.getCurrent(), "breeze");
]]>