Jump to content
We've recently updated our Privacy Statement, available here ×

Species8372

Members
  • Posts

    10
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by Species8372

  1. Today i tried IReport for Netbeans the first time, as seen in other threads, JPA wont work. So i played around and found this solution for 3.7.1 : - move your ejb3-persitence.jar to iReport-3.7.1\ireport\modules\ext\jpa.jar, overwrite the old - remove all of the following files(if available) from iReport-3.7.1\ireport\modules\ext\ hibernate3.jar ehcache-1.2.3.jar hibernate-annotations.jar hibernate-commons-annotations.jar hibernate-entitymanager.jar hibernate-tools.jar - create a folder with the above files from your project - put all files from the folder in the jasper classpath, keeping the order from above - add all jars containing the persistance.xml and the POJO-classes as well as needed dependent jars of the same project Hint: C:\<Docs and settings folder>\<username>\.ireport\3.7.1\var\log contains errorlogs in case NB wont display the red sign in the bottom right corner. <ireportfolder>/etc/ireport.conf allows to enable more logging options as described there. Hope this will help ya! Species8372
  2. Hi there, as i found no really quick solution here in the forum and probably other people also want to know (there was some discussion going on hear early this year, with URLHandlerFactory...), here is a copy&paste solution for classloading inside an EAR to resolve configdata and/or fonts correctly. The problem occurs when you deploy an EAR and have fonts inside the ear - jasper wont usually be able to load the provided fonts, resulting in an error like "net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font" For the used exporter, define a special classloader: >>> exporter.setParameter(JRExporterParameter.CLASS_LOADER, new JasperClassLoader()); Implement a classloader to find the fonts/other data in your preferred EAR-location (in the sample: /WEB-INF/fop/fonts/ inside the WAR): >>>> see code part 1 In the example we use fop as well as Jasper to generate documents. fop is located in WEB-INF/fop and both use the same font-files. The problem here is to get access to the servlet-Context. ConfigBean is our own configuration provider, a class that stores a reference to the ServletContext. It will be initialized upon deployment: >>>> see code part 2 It must be configured in the web.xml with: >>>> see code part 3 That will ensure it is called once after deployment and from now on you have a ServletContext to use in the classLoader. I hope this can help some people. The example could of course also be used to load from other paths inside the EAR as well, providing the parameter into the used custom classloader. Species8372 Code:part 1:-------public class JasperClassLoader extends ClassLoader{ /** Creates a new instance of JasperClassLoader */ public JasperClassLoader() { } public URL getResource(String name) { URL url = super.getResource(name); if(url!=null) return url; try { return MyConfigHolder.getServletConfig().getServletContext().getResource("/WEB-INF/fop/fonts/"+name); }catch(Exception ex) { System.err.println("Malformed URL in JasperClassLoader: "+"/WEB-INF/fop/fonts/"+name); } return null; }}part 2:-------public class MyConfigServlet extends HttpServlet { public MyConfigServlet() { super(); } public void init(ServletConfig config) throws ServletException { MyConfigHolder.setServletConfig(config); }}part 3:-------<servlet> <servlet-name>MyConfigLoader</servlet-name> <servlet-class>MyConfigServlet</servlet-class> <load-on-startup>500</load-on-startup></servlet>
  3. Sorry for posting as new thread, it was meant as reply to http://www.jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=19573. I use Firefox 3 and somehow either i have no Save-Button beneath my post or the browser forgets that i was logged in at all. IE7 is complaining about lots of JS-Errors btw.
  4. Another change is needed inside Method fillColumnFooter to avoid overlapping of subreport and column footer on the same page where the subreport doesnt cause a page break but reaches into the column footer band. Its the 2 lines with if(offsetY>columnFooterOffsetY) addPage(false); Changed code: private void fillColumnFooter(byte evaluation) throws JRException { if (log.isDebugEnabled() && !columnFooter.isEmpty()) { log.debug("Fill " + fillerId + ": column footer"); } /* if (!isSubreport) { offsetY = columnFooterOffsetY; } */ if (isSubreport() && columnIndex == 0) { columnFooterOffsetY = offsetY; } if(offsetY>columnFooterOffsetY) addPage(false); int oldOffsetY = offsetY; if (!isFloatColumnFooter && !fillContext.isIgnorePagination()) { offsetY = columnFooterOffsetY; } columnFooter.evaluatePrintWhenExpression(evaluation); if (columnFooter.isToPrint()) { fillFixedBand(columnFooter, evaluation); } if (isFloatColumnFooter && !fillContext.isIgnorePagination()) { offsetY += columnFooterOffsetY - oldOffsetY; } }
  5. Ok, as i really needed to have the column footer * only at the end of each subreport * at the bottom of the page where each subreport finishes i wrote some fix to release the space of the column footer on pages where the print when expression is false. Replace the Method fillColumnBand in JRVerticalFiller.java with this code: /** returns true if the ColumnFooter-Condition evaluates to true */ private boolean isColumnFooterToPrint() throws JRException { columnFooter.evaluatePrintWhenExpression(JRExpression.EVALUATION_DEFAULT); return columnFooter.isPrintWhenTrue(); } /** * */ protected void fillColumnBand(JRFillBand band, byte evaluation) throws JRException { band.evaluate(evaluation); int colOffset = isColumnFooterToPrint()?columnFooterOffsetY:(columnFooterOffsetY+columnFooter.getHeight()); JRPrintBand printBand = band.fill(colOffset - offsetY - band.getHeight()); if (band.willOverflow() && !band.isSplitAllowed()) { fillColumnBreak(evaluation, evaluation); printBand = band.refill(colOffset - offsetY - band.getHeight()); } fillBand(printBand); offsetY += printBand.getHeight(); colOffset = isColumnFooterToPrint()?columnFooterOffsetY:(columnFooterOffsetY+columnFooter.getHeight()); while (band.willOverflow()) { fillColumnBreak(evaluation, evaluation); printBand = band.fill(colOffset - offsetY - band.getHeight()); fillBand(printBand); offsetY += printBand.getHeight(); colOffset = isColumnFooterToPrint()?columnFooterOffsetY:(columnFooterOffsetY+columnFooter.getHeight()); } resolveBandBoundElements(band, evaluation); } It resolves the columnFooter space just before filling the detail, so you can evalute the printWhen of the columnFooter AFTER the detail section was done. For me, the subreport tells the columnFooter "yes, now you can print yourself" and the column footer wont occupy space on the pages before. Hope that someone finds it useful... Species8372
  6. I have (or better: would like to have) a report with one subreport, and one columnfooter, that aligns on the bottom of a page. I reset a variable to know when each subreport ended so i only get the columnfooter on the last page of each subreport. Problem is, however, as stated before, that the space occupied by the column footer wont get released for all the pages not containing the column footer. But i need this space, it doesnt look good to have half the page empty just because the last page contains a column footer :( isFloatColumnFooter="true" and another group footer didnt help either, because then the group footer is aligned just after the last subreport row and i need it at page bottom. Greetings, Species8372
  7. I am having the same problem. The lastPageFooter from my main-report, which contains a subreport in the detail-section, does not align on the bottom of the last page. Also, a new empty page is created, if the subreport only contains data for 1 page and enough space would have been available on the first page for the lastPageFooter. If the subreport contains enough data for several pages the lastPageFooter doesnt have its own blank page. If i enclose my main report (with subreport) into another report as subreport, the lastPageFooter will appear somewhere on the last page, but not at the bottom. Is there any way, to a) tell the lastpageFooter, that it should be aligned to the bottom (eg. make coordinates relative to the page-bottom border)? b) keep the lastpageFooter to the last page instead of making a new blank page with the lastpageFooter (when using small subreports)? I am using Jasper/IReport 3.0.0. Greetings, Species8372
  8. Thats it! Thank you very much. Fast compile times, no Wrapping of booleans, just what i wanted. The only thing which i dont like very much is the location of the jasperreports.properties in WEB-INF/classes instead of WEB-INF/ where usually all configuration files reside. But i guess i can live with that... Regards, Species8372
  9. Hi, thankx for your hint. I tried groovy, but honestly it lacks performance. Compiling is 3-6 times slower, filling the report 1.5-2 times slower :-( I always wondered, why in times of JDK1.5 it shouldnt be possible to compile Code:(java.lang.Boolean)("bla".equals("bla"«»)) So i changed from the default jdt-compiler to the JDK1.5-compiler and it worked how i wanted, without groovy :) There is, however, one major drawback: I am not able to compile from a J2EE-Application as probably the classpath for the external javac-process is not correct. Is there any possible workaround to use the jdk1.5-compiler inside a deployed application on a J2EE-Server? Maybe using javac and the contextClassLoader of my webapp together somehow? Greetings, Markus
  10. Hello, i am wondering, why it is mandatory to hard cast expression fields. For a developer it is of course not the problem, to write Code:new Boolean("a".equals($F{FNAME}))but for a report-designer, who has absolutely no knowledge of java-syntax? Therefore i wonder why (at least!) for fields like "print, when" it isnt possible to just enter Code:[code]"a".equals($F{FNAME}) Thats the code the good expression builder creates, so why is it necessary to do this ugly construction to wrap it into the already known Class-Type? It would be great for all fields to have some implicit check, if the field-expression is castable to the required type and then wrap the expression automatically. Or optionally.... As it is currently i cannot go to a report-designer employee. They wont take it and prefer the old system. Or maybe i am just to stupid and missed something? Greetings, Species8372
×
×
  • Create New...