Permalink
Browse files

Added a JasperReports plugin to core.

  • Loading branch information...
1 parent a3cd4d2 commit 72ebe8bea68b7a9952aa59bfc9beaa8d14128c04 @olas committed Jul 22, 2010
Showing with 600 additions and 0 deletions.
  1. +13 −0 features/net.bioclipse.core_feature/feature.xml
  2. +1 −0 features/net.bioclipse.platform_feature/bioclipse.product
  3. +36 −0 plugins/net.bioclipse.jasper/.classpath
  4. +28 −0 plugins/net.bioclipse.jasper/.project
  5. +48 −0 plugins/net.bioclipse.jasper/META-INF/MANIFEST.MF
  6. +37 −0 plugins/net.bioclipse.jasper/build.properties
  7. BIN plugins/net.bioclipse.jasper/icons/lastd.gif
  8. BIN plugins/net.bioclipse.jasper/lib/batik-anim.jar
  9. BIN plugins/net.bioclipse.jasper/lib/batik-awt-util.jar
  10. BIN plugins/net.bioclipse.jasper/lib/batik-bridge.jar
  11. BIN plugins/net.bioclipse.jasper/lib/batik-css.jar
  12. BIN plugins/net.bioclipse.jasper/lib/batik-dom.jar
  13. BIN plugins/net.bioclipse.jasper/lib/batik-ext.jar
  14. BIN plugins/net.bioclipse.jasper/lib/batik-gvt.jar
  15. BIN plugins/net.bioclipse.jasper/lib/batik-parser.jar
  16. BIN plugins/net.bioclipse.jasper/lib/batik-script.jar
  17. BIN plugins/net.bioclipse.jasper/lib/batik-svg-dom.jar
  18. BIN plugins/net.bioclipse.jasper/lib/batik-svggen.jar
  19. BIN plugins/net.bioclipse.jasper/lib/batik-util.jar
  20. BIN plugins/net.bioclipse.jasper/lib/batik-xml.jar
  21. BIN plugins/net.bioclipse.jasper/lib/bsh-2.0b4.jar
  22. BIN plugins/net.bioclipse.jasper/lib/commons-beanutils-1.8.0.jar
  23. BIN plugins/net.bioclipse.jasper/lib/commons-collections-2.1.1.jar
  24. BIN plugins/net.bioclipse.jasper/lib/commons-digester-1.7.jar
  25. BIN plugins/net.bioclipse.jasper/lib/groovy-all-1.5.5.jar
  26. BIN plugins/net.bioclipse.jasper/lib/iText-2.1.7.jar
  27. BIN plugins/net.bioclipse.jasper/lib/jasperreports-3.7.3.jar
  28. BIN plugins/net.bioclipse.jasper/lib/jasperreports-fonts-3.7.3.jar
  29. BIN plugins/net.bioclipse.jasper/lib/jaxen-1.1.1.jar
  30. BIN plugins/net.bioclipse.jasper/lib/jcommon-1.0.0.jar
  31. BIN plugins/net.bioclipse.jasper/lib/jfreechart-1.0.0.jar
  32. BIN plugins/net.bioclipse.jasper/lib/jpa.jar
  33. BIN plugins/net.bioclipse.jasper/lib/jxl-2.6.jar
  34. BIN plugins/net.bioclipse.jasper/lib/png-encoder-1.5.jar
  35. BIN plugins/net.bioclipse.jasper/lib/poi-3.5-FINAL-20090928.jar
  36. BIN plugins/net.bioclipse.jasper/lib/swtjasperviewer-1.2.0.jar
  37. +16 −0 plugins/net.bioclipse.jasper/plugin.xml
  38. +50 −0 plugins/net.bioclipse.jasper/src/net/bioclipse/jasper/Activator.java
  39. +343 −0 plugins/net.bioclipse.jasper/src/net/bioclipse/jasper/editor/ReportEditor.java
  40. +28 −0 plugins/net.bioclipse.logger/.project
View
13 features/net.bioclipse.core_feature/feature.xml
@@ -955,4 +955,17 @@ The Eclipse Public License accompanies this distribution, and is available at ht
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="net.bioclipse.jasper"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.lowagie.itext"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
</feature>
View
1 features/net.bioclipse.platform_feature/bioclipse.product
@@ -52,6 +52,7 @@
<features>
<feature id="net.bioclipse.platform_feature" version="2.4.0.20100709"/>
+ <feature id="net.bioclipse.ds_feature" version="2.4.0.20100709"/>
</features>
View
36 plugins/net.bioclipse.jasper/.classpath
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/iText-2.1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jcommon-1.0.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jfreechart-1.0.0.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-anim.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-awt-util.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-bridge.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-css.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-dom.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-ext.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-gvt.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-parser.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-script.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-svg-dom.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-svggen.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-util.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/batik-xml.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/bsh-2.0b4.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.8.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-collections-2.1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/commons-digester-1.7.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/groovy-all-1.5.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jasperreports-3.7.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jasperreports-fonts-3.7.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jaxen-1.1.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jpa.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jxl-2.6.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/png-encoder-1.5.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/swtjasperviewer-1.2.0.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
28 plugins/net.bioclipse.jasper/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.bioclipse.jasper</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
48 plugins/net.bioclipse.jasper/META-INF/MANIFEST.MF
@@ -0,0 +1,48 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jasper Reports for Bioclipse
+Bundle-SymbolicName: net.bioclipse.jasper;singleton:=true
+Bundle-Version: 1.2.0
+Bundle-Activator: net.bioclipse.jasper.Activator
+Bundle-Vendor: The Bioclipse Team
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ net.bioclipse.core,
+ net.bioclipse.ui,
+ org.eclipse.core.resources
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,
+ lib/batik-anim.jar,
+ lib/batik-awt-util.jar,
+ lib/batik-bridge.jar,
+ lib/batik-css.jar,
+ lib/batik-dom.jar,
+ lib/batik-ext.jar,
+ lib/batik-gvt.jar,
+ lib/batik-parser.jar,
+ lib/batik-script.jar,
+ lib/batik-svg-dom.jar,
+ lib/batik-svggen.jar,
+ lib/batik-util.jar,
+ lib/batik-xml.jar,
+ lib/bsh-2.0b4.jar,
+ lib/commons-beanutils-1.8.0.jar,
+ lib/commons-collections-2.1.1.jar,
+ lib/commons-digester-1.7.jar,
+ lib/groovy-all-1.5.5.jar,
+ lib/jasperreports-3.7.3.jar,
+ lib/jasperreports-fonts-3.7.3.jar,
+ lib/jaxen-1.1.1.jar,
+ lib/jpa.jar,
+ lib/jxl-2.6.jar,
+ lib/png-encoder-1.5.jar,
+ lib/poi-3.5-FINAL-20090928.jar,
+ lib/swtjasperviewer-1.2.0.jar,
+ lib/jcommon-1.0.0.jar,
+ lib/jfreechart-1.0.0.jar,
+ lib/iText-2.1.7.jar
+Import-Package: org.apache.commons.logging,
+ org.apache.log4j
+Export-Package: net.bioclipse.jasper,
+ net.bioclipse.jasper.editor
View
37 plugins/net.bioclipse.jasper/build.properties
@@ -0,0 +1,37 @@
+source.. = src/
+output.. = bin/
+bin.includes = .,\
+ plugin.xml,\
+ icons/,\
+ lib/batik-anim.jar,\
+ lib/batik-awt-util.jar,\
+ lib/batik-bridge.jar,\
+ lib/batik-css.jar,\
+ lib/batik-dom.jar,\
+ lib/batik-ext.jar,\
+ lib/batik-gvt.jar,\
+ lib/batik-parser.jar,\
+ lib/batik-script.jar,\
+ lib/batik-svg-dom.jar,\
+ lib/batik-svggen.jar,\
+ lib/batik-util.jar,\
+ lib/batik-xml.jar,\
+ lib/bsh-2.0b4.jar,\
+ lib/commons-beanutils-1.8.0.jar,\
+ lib/commons-collections-2.1.1.jar,\
+ lib/commons-digester-1.7.jar,\
+ lib/groovy-all-1.5.5.jar,\
+ lib/jasperreports-3.7.3.jar,\
+ lib/jasperreports-fonts-3.7.3.jar,\
+ lib/jaxen-1.1.1.jar,\
+ lib/jpa.jar,\
+ lib/jxl-2.6.jar,\
+ lib/png-encoder-1.5.jar,\
+ lib/poi-3.5-FINAL-20090928.jar,\
+ lib/swtjasperviewer-1.2.0.jar,\
+ lib/jcommon-1.0.0.jar,\
+ lib/jfreechart-1.0.0.jar,\
+ lib/iText-2.1.7.jar,\
+ META-INF/
+source.. = src/
+jars.compile.order = .
View
BIN plugins/net.bioclipse.jasper/icons/lastd.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN plugins/net.bioclipse.jasper/lib/batik-anim.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-awt-util.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-bridge.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-css.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-dom.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-ext.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-gvt.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-parser.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-script.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-svg-dom.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-svggen.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-util.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/batik-xml.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/bsh-2.0b4.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/commons-beanutils-1.8.0.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/commons-collections-2.1.1.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/commons-digester-1.7.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/groovy-all-1.5.5.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/iText-2.1.7.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/jasperreports-3.7.3.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/jasperreports-fonts-3.7.3.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/jaxen-1.1.1.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/jcommon-1.0.0.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/jfreechart-1.0.0.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/jpa.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/jxl-2.6.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/png-encoder-1.5.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/poi-3.5-FINAL-20090928.jar
Binary file not shown.
View
BIN plugins/net.bioclipse.jasper/lib/swtjasperviewer-1.2.0.jar
Binary file not shown.
View
16 plugins/net.bioclipse.jasper/plugin.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="net.bioclipse.jasper.editor.ReportEditor"
+ default="false"
+ id="net.bioclipse.jasper.report.editor"
+ extensions="bogus"
+ icon="icons/lastd.gif"
+ name="Report Editor">
+ </editor>
+ </extension>
+
+</plugin>
View
50 plugins/net.bioclipse.jasper/src/net/bioclipse/jasper/Activator.java
@@ -0,0 +1,50 @@
+package net.bioclipse.jasper;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "net.bioclipse.jasper";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
View
343 plugins/net.bioclipse.jasper/src/net/bioclipse/jasper/editor/ReportEditor.java
@@ -0,0 +1,343 @@
+package net.bioclipse.jasper.editor;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Collection;
+import java.util.Map;
+
+import net.bioclipse.core.business.BioclipseException;
+import net.sf.jasperreports.engine.JRDataSource;
+import net.sf.jasperreports.engine.JasperFillManager;
+import net.sf.jasperreports.engine.JasperPrint;
+import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
+
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorPart;
+
+import com.jasperassistant.designer.viewer.DefaultHyperlinkHandler;
+import com.jasperassistant.designer.viewer.IReportViewer;
+import com.jasperassistant.designer.viewer.ReportViewer;
+import com.jasperassistant.designer.viewer.StatusBar;
+import com.jasperassistant.designer.viewer.actions.ExportAsCsvAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsHtmlAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsJasperReportsAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsMultiXlsAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsPdfAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsRtfAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsSingleXlsAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsXmlAction;
+import com.jasperassistant.designer.viewer.actions.ExportAsXmlWithImagesAction;
+import com.jasperassistant.designer.viewer.actions.ExportMenuAction;
+import com.jasperassistant.designer.viewer.actions.FirstPageAction;
+import com.jasperassistant.designer.viewer.actions.LastPageAction;
+import com.jasperassistant.designer.viewer.actions.NextPageAction;
+import com.jasperassistant.designer.viewer.actions.PageNumberContributionItem;
+import com.jasperassistant.designer.viewer.actions.PreviousPageAction;
+import com.jasperassistant.designer.viewer.actions.PrintAction;
+import com.jasperassistant.designer.viewer.actions.ReloadAction;
+import com.jasperassistant.designer.viewer.actions.ZoomActualSizeAction;
+import com.jasperassistant.designer.viewer.actions.ZoomComboContributionItem;
+import com.jasperassistant.designer.viewer.actions.ZoomFitPageAction;
+import com.jasperassistant.designer.viewer.actions.ZoomFitPageWidthAction;
+import com.jasperassistant.designer.viewer.actions.ZoomInAction;
+import com.jasperassistant.designer.viewer.actions.ZoomOutAction;
+
+/**
+ * An editor wrappping a Jasper ReportViewer.
+ *
+ * @author ola
+ *
+ */
+public class ReportEditor extends EditorPart implements ISelectionProvider{
+
+ private ReportViewer reportViewer = new ReportViewer(SWT.BORDER);
+
+ private static final Logger logger = Logger.getLogger(ReportEditor.class);
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ initMenu();
+ initToolBar();
+
+
+
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = layout.marginHeight = 0;
+ container.setLayout(layout);
+
+ Control reportViewerControl = reportViewer.createControl(container);
+ reportViewerControl.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ StatusBar statusBar = new StatusBar();
+ statusBar.setReportViewer(reportViewer);
+ Control statusBarControl = statusBar.createControl(container);
+ statusBarControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ reportViewer.addHyperlinkListener(new DefaultHyperlinkHandler());
+
+
+
+
+
+ /*
+
+// // prepare report and data
+// InputStream is = getServletContext().getResourceAsStream("/WEB-INF/reports/userList.jrxml");
+// JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(results);
+//
+// // generate pdf file
+// JasperDesign jasperDesign = JRXmlLoader.load(is);
+// JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
+// JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters,
+// ds);
+
+
+
+
+ String path;
+ try {
+// path = FileUtil.getFilePath("demo/FirstJasper.jrprint", Activator.PLUGIN_ID);
+ path = FileUtil.getFilePath("demo/PieChartReport.jrprint", Activator.PLUGIN_ID);
+// path = FileUtil.getFilePath("demo/HyperlinkReport.jrprint", Activator.PLUGIN_ID);
+ reportViewer.loadDocument(path, false);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+*/
+
+ getSite().setSelectionProvider(this);
+
+ }
+
+
+
+
+
+
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ }
+
+ @Override
+ public void doSaveAs() {
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+
+ setSite( site );
+ setInput( input );
+
+ }
+
+ @Override
+ public boolean isDirty() {
+ return false;
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ @Override
+ public void setFocus() {
+ }
+
+
+
+ private void initMenu() {
+
+ MenuManager mm = new MenuManager();
+ mm.add( new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ getSite().registerContextMenu("net.bioclipse.jasper.report.context",
+ mm, this);
+
+ MenuManager export = new MenuManager("Export");
+ export.add(new ExportAsPdfAction(reportViewer));
+ export.add(new ExportAsRtfAction(reportViewer));
+ export.add(new ExportAsJasperReportsAction(reportViewer));
+ export.add(new ExportAsHtmlAction(reportViewer));
+ export.add(new ExportAsSingleXlsAction(reportViewer));
+ export.add(new ExportAsMultiXlsAction(reportViewer));
+ export.add(new ExportAsCsvAction(reportViewer));
+ export.add(new ExportAsXmlAction(reportViewer));
+ export.add(new ExportAsXmlWithImagesAction(reportViewer));
+
+ MenuManager file = new MenuManager("File");
+ file.add(new ReloadAction(reportViewer));
+ file.add(new Separator());
+ file.add(export);
+ file.add(new Separator());
+ file.add(new PrintAction(reportViewer));
+ mm.add(file);
+
+ MenuManager view = new MenuManager("View");
+ view.add(new ZoomOutAction(reportViewer));
+ view.add(new ZoomInAction(reportViewer));
+ view.add(new Separator());
+ view.add(new ZoomActualSizeAction(reportViewer));
+ view.add(new ZoomFitPageAction(reportViewer));
+ view.add(new ZoomFitPageWidthAction(reportViewer));
+ mm.add(view);
+
+ MenuManager nav = new MenuManager("Navigate");
+ nav.add(new FirstPageAction(reportViewer));
+ nav.add(new PreviousPageAction(reportViewer));
+ nav.add(new NextPageAction(reportViewer));
+ nav.add(new LastPageAction(reportViewer));
+ mm.add(nav);
+
+ }
+
+
+
+ private void initToolBar() {
+
+ IToolBarManager tbManager = getEditorSite().getActionBars()
+ .getToolBarManager();
+
+ ExportMenuAction exportMenu = new ExportMenuAction(reportViewer);
+ IAction pdfAction = null;
+ exportMenu.getMenuManager().add(
+ pdfAction = new ExportAsPdfAction(reportViewer));
+ exportMenu.getMenuManager().add(
+ new ExportAsRtfAction(reportViewer));
+ exportMenu.getMenuManager().add(
+ new ExportAsJasperReportsAction(reportViewer));
+ exportMenu.getMenuManager().add(new ExportAsHtmlAction(reportViewer));
+ exportMenu.getMenuManager().add(
+ new ExportAsSingleXlsAction(reportViewer));
+ exportMenu.getMenuManager().add(
+ new ExportAsMultiXlsAction(reportViewer));
+ exportMenu.getMenuManager().add(new ExportAsCsvAction(reportViewer));
+ exportMenu.getMenuManager().add(new ExportAsXmlAction(reportViewer));
+ exportMenu.getMenuManager().add(
+ new ExportAsXmlWithImagesAction(reportViewer));
+ exportMenu.setDefaultAction(pdfAction);
+
+ tbManager.add(exportMenu);
+ tbManager.add(new PrintAction(reportViewer));
+ tbManager.add(new ReloadAction(reportViewer));
+ tbManager.add(new Separator());
+ tbManager.add(new FirstPageAction(reportViewer));
+ tbManager.add(new PreviousPageAction(reportViewer));
+ if (SWT.getPlatform().equals("win32")) //$NON-NLS-1$
+ tbManager.add(new PageNumberContributionItem(reportViewer));
+ tbManager.add(new NextPageAction(reportViewer));
+ tbManager.add(new LastPageAction(reportViewer));
+ tbManager.add(new Separator());
+ tbManager.add(new ZoomActualSizeAction(reportViewer));
+ tbManager.add(new ZoomFitPageAction(reportViewer));
+ tbManager.add(new ZoomFitPageWidthAction(reportViewer));
+ tbManager.add(new Separator());
+ tbManager.add(new ZoomOutAction(reportViewer));
+ tbManager.add(new ZoomComboContributionItem(reportViewer));
+ tbManager.add(new ZoomInAction(reportViewer));
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Composite container = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = layout.marginHeight = 0;
+ container.setLayout(layout);
+
+ Control reportViewerControl = reportViewer.createControl(container);
+ reportViewerControl.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ StatusBar statusBar = new StatusBar();
+ statusBar.setReportViewer(reportViewer);
+ Control statusBarControl = statusBar.createControl(container);
+ statusBarControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ reportViewer.addHyperlinkListener(new DefaultHyperlinkHandler());
+
+ return container;
+ }
+
+ /**
+ * Returns the report viewer used for viewing reports.
+ *
+ * @return the report viewer
+ */
+ public IReportViewer getReportViewer() {
+ return reportViewer;
+ }
+
+
+
+
+
+
+
+ @Override
+ public void addSelectionChangedListener(ISelectionChangedListener arg0) {
+ }
+ @Override
+ public ISelection getSelection() {
+ return new StructuredSelection(new Object());
+ }
+ @Override
+ public void removeSelectionChangedListener(ISelectionChangedListener arg0) {
+ }
+ @Override
+ public void setSelection(ISelection arg0) {
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public void openReport(String reportAbsolutePath, Map parameters,
+ Collection beanCollection ) throws BioclipseException {
+
+ logger.debug("Opening jasper report: " + reportAbsolutePath);
+ logger.debug("Number of parameters: " + parameters != null ? parameters.size() : "");
+ logger.debug("Number of beans: " + beanCollection.size());
+
+ FileInputStream fis;
+ try {
+ fis = new FileInputStream(new File(reportAbsolutePath));
+
+ //Create a new JR data source and populate with our collection
+ JRDataSource reportSource =
+ new JRBeanCollectionDataSource(beanCollection );
+ JasperPrint jp = JasperFillManager.fillReport( fis, parameters,
+ reportSource);
+ reportViewer.setDocument(jp);
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ throw new BioclipseException(e.getMessage());
+ }
+
+ }
+
+}
View
28 plugins/net.bioclipse.logger/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.bioclipse.logger</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>

0 comments on commit 72ebe8b

Please sign in to comment.