From 6e00887194e1e3294f3cfdc5543b6188fd9c6164 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 6 Sep 2011 11:15:26 +0800 Subject: [PATCH] IDEMPIERE-20 Logo not printed in GardenWorld documents. Hook up resource finder to report image element. (transplanted from 0f850c295919acc723f3447b71170b4b5aaa39c8) --- .../src/org/compiere/print/layout/ImageElement.java | 4 ++++ .../src/org/adempiere/webui/util/WebUIResourceFinder.java | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/print/layout/ImageElement.java b/org.adempiere.base/src/org/compiere/print/layout/ImageElement.java index 8db33ed2c2..7af4822c57 100644 --- a/org.adempiere.base/src/org/compiere/print/layout/ImageElement.java +++ b/org.adempiere.base/src/org/compiere/print/layout/ImageElement.java @@ -27,6 +27,7 @@ import java.net.URL; import java.util.Properties; import java.util.logging.Level; +import org.adempiere.base.Core; import org.compiere.model.MAttachment; import org.compiere.model.MImage; import org.compiere.print.MPrintFormatItem; @@ -209,6 +210,9 @@ public class ImageElement extends PrintElement { ClassLoader cl = getClass().getClassLoader(); url = cl.getResource(urlString); + if (url != null) + return url; + url = Core.getResourceFinder().getResource(urlString); if (url != null) return url; log.log(Level.WARNING, "Not found - " + urlString); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java index 4aa2f88c27..ea9407d22e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/WebUIResourceFinder.java @@ -27,7 +27,12 @@ public class WebUIResourceFinder implements IResourceFinder { @Override public URL getResource(String name) { - return WebUIActivator.getBundleContext().getBundle().getEntry(name); + URL url = WebUIActivator.getBundleContext().getBundle().getEntry(name); + if (url == null && name.startsWith("org/compiere/images")) { + String t = name.substring("org/compiere/".length()); + url = WebUIActivator.getBundleContext().getBundle().getEntry(t); + } + return url; } }