01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.ubt.report.client;
06:
07: import net.sf.jasperreports.view.JasperViewer;
08: import net.sf.jasperreports.engine.JRException;
09: import net.sf.jasperreports.engine.JasperPrint;
10: import net.sf.jasperreports.engine.util.JRLoader;
11: import com.sun.portal.ubt.report.view.report.UBTReportI;
12: import com.sun.portal.ubt.report.server.UBTReportServer;
13:
14: /**
15: * Shows the report in JasperViewer
16: */
17: public class UBTReportViewer {
18: private JasperPrint report;
19:
20: public UBTReportViewer(JasperPrint report) {
21: this .report = report;
22: }
23:
24: /**
25: * Constructor
26: * @param filename .jrprint filename
27: * @throws JRException
28: */
29: public UBTReportViewer(String filename) throws JRException {
30: this .report = (JasperPrint) JRLoader.loadObject(filename);
31: }
32:
33: public void show() throws JRException {
34: JasperViewer.viewReport(report);
35: }
36:
37: public static void main(String[] args) throws JRException {
38: UBTReportServer server = new UBTReportServer(
39: "e:\\sandhya\\ubt\\UBTReports\\reportOut");
40: JasperPrint report = server
41: .getReport(UBTReportI.PORTLET_RENDER);
42: new UBTReportViewer(report).show();
43: }
44: }
|