try {
InputStream stream = getClass().getClassLoader()
.getResourceAsStream(reportFile);
if (stream == null) {
throw new ProTransException("Fant ikke rapport");
}
jasperPrintReport = JasperFillManager.fillReport(stream,
parameters, datasource);
JRViewerProTrans viewer = new JRViewerProTrans(jasperPrintReport);
viewer.setPrintable(printable);
viewer.setSavable(printable);
this.pnlMain.add(viewer, BorderLayout.CENTER);
} catch (JRException e) {
e.printStackTrace();
String msg;
if (e.getCause() instanceof FileNotFoundException) {
msg = "Kunne ikke finne rapport " + reportFile;
} else {
msg = e.getMessage();
}
throw new ProTransException("Feil ved generering av rapport " + msg);
}
}