migrate ReportViewerProvider and JRViewerProvider to equinox extension.

This commit is contained in:
Heng Sin Low 2010-08-23 13:26:55 +08:00
parent 7752a328cc
commit 33cb50f4b8
25 changed files with 290 additions and 61 deletions

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JasperReports
Bundle-SymbolicName: org.adempiere.JasperReports
Bundle-SymbolicName: org.adempiere.JasperReports;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: JasperReports.jar
Export-Package: org.compiere.interfaces,

View File

@ -1,4 +1,5 @@
source.JasperReports.jar = src/
output.JasperReports.jar = build/
bin.includes = META-INF/,\
JasperReports.jar
JasperReports.jar,\
plugin.xml

6
JasperReports/plugin.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="org.compiere.report.JRViewerProvider" name="Jasper Report Viewer Provider" schema="schema/org.compiere.report.JRViewerProvider.exsd"/>
</plugin>

View File

@ -0,0 +1,102 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.adempiere.JasperReports" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.adempiere.JasperReports" id="org.compiere.report.JRViewerProvider" name="Jasper Report Viewer Provider"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="provider"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="provider">
<complexType>
<attribute name="class" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.compiere.report.JRViewerProvider"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -59,6 +59,7 @@ import net.sf.jasperreports.engine.export.JRPrintServiceExporter;
import net.sf.jasperreports.engine.export.JRPrintServiceExporterParameter;
import net.sf.jasperreports.engine.util.JRLoader;
import org.adempiere.base.Service;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException;
import org.compiere.model.MAttachment;
@ -102,7 +103,6 @@ public class ReportStarter implements ProcessCall, ClientProcess
private static CLogger log = CLogger.getCLogger(ReportStarter.class);
private static File REPORT_HOME = null;
private static JRViewerProvider viewerProvider = null;
private static JasperPrint jasperPrint;
static {
@ -540,7 +540,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
// JasperExportManager.exportReportToPdfFile(jasperPrint, "BasicReport.pdf");
} else {
log.info( "ReportStarter.startProcess run report -"+jasperPrint.getName());
JRViewerProvider viewerLauncher = getReportViewerProvider();
JRViewerProvider viewerLauncher = Service.locate(JRViewerProvider.class);
viewerLauncher.openViewer(jasperPrint, pi.getTitle()+" - " + reportPath);
}
} catch (JRException e) {
@ -1090,24 +1090,6 @@ public class ReportStarter implements ProcessCall, ClientProcess
}
}
/**
* Set jasper report viewer provider.
* @param provider
*/
public static void setReportViewerProvider(JRViewerProvider provider) {
if (provider == null)
throw new IllegalArgumentException("Cannot set report viewer provider to null");
viewerProvider = provider;
}
/**
* Get the current jasper report viewer provider
* @return JRViewerProvider
*/
public static JRViewerProvider getReportViewerProvider() {
return viewerProvider;
}
class ReportData {
private String reportFilePath;
private boolean directPrint;

View File

@ -1,4 +1,4 @@
#Thu Aug 19 17:50:42 MYT 2010
#Mon Aug 23 13:20:48 MYT 2010
eclipse.preferences.version=1
pluginProject.extensions=false
pluginProject.extensions=true
resolve.requirebundle=false

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JasperReportsClient
Bundle-SymbolicName: org.adempiere.apps.JasperReportsClient
Bundle-SymbolicName: org.adempiere.apps.JasperReportsClient;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.adempiere.base;bundle-version="1.0.0",

View File

@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
plugin.xml

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.compiere.report.JRViewerProvider">
<provider
class="org.compiere.report.SwingJRViewerProvider">
</provider>
</extension>
</plugin>

View File

@ -21,7 +21,6 @@ public class JasperReportsClientActivator implements BundleActivator {
@Override
public void start(BundleContext arg0) throws Exception {
ReportStarter.setReportViewerProvider(new SwingJRViewerProvider());
}
@Override

View File

@ -31,6 +31,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>

View File

@ -1,5 +1,6 @@
source.client.jar = src/
output.client.jar = build/
bin.includes = META-INF/,\
client.jar,\
plugin.xml
plugin.xml,\
component.xml
source.client.jar = src/
output.client.jar = build/

View File

@ -18,5 +18,11 @@
<run class="org.adempiere.client.Application" />
</application>
</extension>
<extension
point="org.compiere.print.ReportViewerProvider">
<provider
class="org.compiere.print.SwingViewerProvider">
</provider>
</extension>
</plugin>

View File

@ -194,7 +194,7 @@ public final class AMenu extends CFrame
//
Env.addEventListener(this);
//
ReportCtl.setReportViewerProvider(new SwingViewerProvider());
// ReportCtl.setReportViewerProvider(new SwingViewerProvider());
//
splash.dispose();
splash = null;

View File

@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>

View File

@ -1,4 +1,4 @@
#Mon Aug 09 17:35:10 MYT 2010
#Mon Aug 23 12:23:34 MYT 2010
eclipse.preferences.version=1
pluginProject.extensions=false
pluginProject.extensions=true
resolve.requirebundle=false

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: UI base
Bundle-SymbolicName: org.adempiere.ui.base
Bundle-SymbolicName: org.adempiere.ui.base;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.adempiere.base;bundle-version="1.0.0"

View File

@ -1,6 +1,8 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
org-netbeans-api-visual.jar,\
org-openide-util.jar
org-openide-util.jar,\
component.xml,\
plugin.xml
source.. = src/

6
uibase/plugin.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="org.compiere.print.ReportViewerProvider" name="Report Viewer Provider" schema="schema/org.compiere.print.ReportViewerProvider.exsd"/>
</plugin>

View File

@ -0,0 +1,102 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.adempiere.ui.base" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.adempiere.ui.base" id="org.compiere.print.ReportViewerProvider" name="Report Viewer Provider"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="provider"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="provider">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.compiere.print.ReportViewerProvider"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -19,6 +19,7 @@ package org.compiere.print;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.Service;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MPaySelectionCheck;
import org.compiere.model.MProcess;
@ -65,8 +66,6 @@ public class ReportCtl
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (ReportCtl.class);
private static ReportViewerProvider viewerProvider = null;
/**
* Create Report.
* Called from ProcessCtl.
@ -374,19 +373,8 @@ public class ReportCtl
*/
public static void preview(ReportEngine re)
{
ReportViewerProvider provider = getReportViewerProvider();
provider.openViewer(re);
ReportViewerProvider viewer = Service.locate(ReportViewerProvider.class);
viewer.openViewer(re);
}
public static void setReportViewerProvider(ReportViewerProvider provider)
{
if (provider == null)
throw new IllegalArgumentException("Cannot set report viewer provider to null");
viewerProvider = provider;
}
public static ReportViewerProvider getReportViewerProvider()
{
return viewerProvider;
}
} // ReportCtl

View File

@ -32,6 +32,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>

View File

@ -28,11 +28,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.adempiere.webui.window.ZkJRViewerProvider;
import org.adempiere.webui.window.ZkReportViewerProvider;
import org.compiere.Adempiere;
import org.compiere.print.ReportCtl;
import org.compiere.report.ReportStarter;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.Ini;
@ -88,8 +84,6 @@ public class WebUIServlet extends DHtmlLayoutServlet
// hengsin: temporary solution for problem with zk client
Ini.setProperty(Ini.P_ADEMPIERESYS, false);
ReportCtl.setReportViewerProvider(new ZkReportViewerProvider());
ReportStarter.setReportViewerProvider(new ZkJRViewerProvider());
logger.log(Level.OFF, "ADempiere web ui service started successfully");
/**
* End ADempiere Start

View File

@ -1,4 +1,3 @@
source.. = WEB-INF/src/
output.. = WEB-INF/classes/
bin.includes = META-INF/,\
WEB-INF/,\
@ -12,9 +11,8 @@ bin.includes = META-INF/,\
zul/,\
WEB-INF/classes/,\
timeout.zul,\
plugin.xml
bin.excludes = WEB-INF/src/,\
WEB-INF/web-2.5.xml
plugin.xml,\
component.xml
src.includes = WEB-INF/classes/,\
WEB-INF/lib/,\
WEB-INF/tld/,\
@ -29,3 +27,6 @@ src.includes = WEB-INF/classes/,\
theme/,\
theme.zs,\
zul/
source.. = WEB-INF/src/
bin.excludes = WEB-INF/src/,\
WEB-INF/web-2.5.xml

View File

@ -2,5 +2,17 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="org.adempiere.webui.Form" name="Web Form" schema="schema/org.adempiere.webui.Form.exsd"/>
<extension
point="org.compiere.print.ReportViewerProvider">
<provider
class="org.adempiere.webui.window.ZkReportViewerProvider">
</provider>
</extension>
<extension
point="org.compiere.report.JRViewerProvider">
<provider
class="org.adempiere.webui.window.ZkJRViewerProvider">
</provider>
</extension>
</plugin>