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

jbuberel

Members
  • Posts

    38
  • Joined

  • Last visited

jbuberel's Achievements

Contributor

Contributor (5/14)

  • First Post Rare
  • Collaborator Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. I am facing a similar situation, where I would like to parameterize the RGB value of a foreground color on various text elements. My experiement so far seems to indicate that my values are being ignored. For example: <parameter name="rgb_value" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[new String("#FF0000")]]></defaultValueExpression> </parameter> Which is then referenced later in the JRXML file as forecolor: <staticText> <reportElement style="default" x="434" y="569" width="166" height="38" forecolor="$P{rgb_value}"/> <textElement/> <text><![CDATA[investigate the market in quartiles - where each quartile is 25% of homes ordered by price.]]></text> </staticText> When the report is rendered, this text is displayed as black, not red (#FF0000). I could do a conditional style for every possible color option, but that would be very tedious. Is there any other way to use a parameter value $P{variable_name} as the value of an attribute? Post Edited by jbuberel at 11/15/2011 23:54
  2. FYI: I just downloaded, built, installed and re-ran this test using the 4.1.1 release, and the problem appears to have disappeared! Hooray!! -jason
  3. Just performed an upgrade from 4.0.1 to 4.0.2 - made no changes to any JRXML or our source code. Performed a clean compile and template compilation. When running the first report, received the following AbstractMethodError: Code:2011-04-20 08:55:16 ERROR c.a.m.r.ReportSpecificationRunner pool-1-thread-1 - com.altosresearch.model.reporting.ReportSpecificationRunner@1aadf2c72011-04-20 08:55:16 ERROR c.a.m.r.ReportSpecificationRunner pool-1-thread-1 - Resulted in exception: java.lang.AbstractMethodError: net.sf.jasperreports.engine.fill.JRFillTextField.getParagraph()Lnet/sf/jasperreports/engine/JRParagraph; at net.sf.jasperreports.engine.util.JRStyleResolver.getLineSpacingValue(JRStyleResolver.java:987) ~[jasperreports-applet.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillTextElement.getLineSpacingValue(JRFillTextElement.java:353) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.TextMeasurer.initialize(TextMeasurer.java:308) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:360) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:1130) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:554) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:329) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillFrame.prepare(JRFillFrame.java:215) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:329) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:419) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:378) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2038) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58) ~[jasperreports-javaflow.jar:4.0.1 ] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417) ~[jasperreports-javaflow.jar:4.0.2] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247) ~[jasperreports-javaflow.jar:4.0.2] at com.altosresearch.report.ReportGenerationMgr.fillReport(ReportGenerationMgr.java:594) ~[classes/:na] at $IReportGenerationMgr_12f739ef524.fillReport($IReportGenerationMgr_12f739ef524.java) ~[na:na] at $IReportGenerationMgr_12f739ef525.fillReport($IReportGenerationMgr_12f739ef525.java) ~[na:na] at com.altosresearch.model.reporting.ReportSpecificationRunner.call(ReportSpecificationRunner.java:370) [classes/:na] at com.altosresearch.model.reporting.ReportSpecificationRunner.call(ReportSpecificationRunner.java:40) [classes/:na] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_24] at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_24] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_24] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_24] at java.lang.Thread.run(Thread.java:662) [na:1.6.0_24]
  4. This fix - cleanly recompiling all templates using 3.7.5 seems to have worked for me also.
  5. In our JRXML templates, we display US city names. The text field uses a fixed font size (11pt) to render the text. However, there are times when we run into very long city names (ex: "Fredericksburg") that are too long to fit in the text box. So instead, I would like to use an expression for the size: <font size="11"/> would instead be: <font size="$F{city}.length() > 10 ? 9 : 11" /> Or in other words: If the length of the city field is greater than 10 characters, use font size 9. Else, use font size 11. I am going to experiment with this later this evening, but thought I'd ask if others had run into this before and had come up with a good solution. Thanks, jason
  6. Teodor- Thanks - I went ahead and submitted a new issue to the tracker. Is there an XML-level workaround - a modification I can manually make to the .jrctx file regarding the 'position' attribute that the exception is reporting - that would allow me to avoid this problem? I've reviewed the contents of my .jrctx file (the one generated by iReports 3.7.2) but did not find any 'position=' attribute or element (see below). Code:<?xml version="1.0" encoding="UTF-8"?><chart-theme> <chart-settings border-visible="false"> <font/> </chart-settings> <title-settings show-title="false"> <font/> </title-settings> <subtitle-settings show-title="false"> <font/> </subtitle-settings> <legend-settings> <font/> </legend-settings> <plot-settings> <tick-label-font xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="font"/> <display-font xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="font"/> </plot-settings> <domain-axis-settings> <label-font xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="font"/> <tick-label-font xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="font"/> </domain-axis-settings> <range-axis-settings> <label-font xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="font"/> <tick-label-font xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="font"/> </range-axis-settings></chart-theme>
  7. Just downloaded v3.7.2. Built via maven. Then built new demo/samples//chartthemes. Installed all new jars. Using previous chart theme (.jrctx) XML file and generated PDF report. The following stack trace resulted (see below). Then, using iReport 3.7.2 created new generic chart theme, and attempted to generate report using new .jrctx file - same exception. Any ideas? [java] 2010-04-12 23:08:35 INFO main - Starting generation for spec [402880e227d6eca90127d6eccffe03e9] [java] 2010-04-12 23:08:41 ERROR main - Generic expection thrown during report fill for JASPER file: /home/jason/svn/branches/mywebpage/reports/broker_themed/broker_market_update_primary.jasper of 402880e227d6eca90127d6eccffe03e9 of customer 52955615 [java] org.exolab.castor.core.exceptions.CastorIllegalStateException: Field access error: position(java.lang.Byte) access resulted in exception: java.lang.reflect.InvocationTargetException [java] at org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:423) ~[castor.jar:1.2] [java] at org.exolab.castor.mapping.GeneralizedFieldHandler.getValue(GeneralizedFieldHandler.java:178) ~[castor.jar:1.2] [java] at org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:387) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:191) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1072) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.Validator.validate(Validator.java:135) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:326) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:271) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1065) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.Validator.validate(Validator.java:135) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:915) ~[castor.jar:1.2] [java] at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1159) ~[castor.jar:1.2] [java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) ~[na:1.6.0_19] [java] at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) ~[na:1.6.0_19] [java] at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:715) ~[castor.jar:1.2] [java] at net.sf.jasperreports.chartthemes.simple.XmlChartTheme.loadSettings(XmlChartTheme.java:150) ~[jasperreports-chart-themes.jar:na] [java] at net.sf.jasperreports.chartthemes.simple.XmlChartTheme.loadSettings(XmlChartTheme.java:109) ~[jasperreports-chart-themes.jar:na] [java] at net.sf.jasperreports.chartthemes.simple.XmlChartTheme.getChartThemeSettings(XmlChartTheme.java:93) ~[jasperreports-chart-themes.jar:na] [java] at net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.getChartSettings(SimpleChartTheme.java:208) ~[jasperreports-chart-themes.jar:na] [java] at net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.configureChart(SimpleChartTheme.java:423) ~[jasperreports-chart-themes.jar:na] [java] at net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.createTimeSeriesChart(SimpleChartTheme.java:1541) ~[jasperreports-chart-themes.jar:na] [java] at net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.createChart(SimpleChartTheme.java:394) ~[jasperreports-chart-themes.jar:na] [java] at net.sf.jasperreports.engine.fill.JRFillChart.evaluateChart(JRFillChart.java:1338) ~[jasperreports-javaflow.jar:na]
  8. After a day spent walking through the Jasper source in the debugger, I finally found the critical error. I had modified my jasperreports_extensions.properties file to contain a reference to the factory and my fonts.xml file (trying to replicate the appraoch taken in the 'Fonts' sample code). In my first attempt, the resulting file after ant variable substitution looked like this: net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistry net.sf.jasperreports.extension.fonts.spring.beans.resource=/home/jason/svn/trunk/classes/fonts.xml NOTE: The pathname to the 'fonts.xml' file is a full pathname. This version resulted in none of my custom font declarations being found by or made available to the JVM. On a whim, I then modified the location of the fonts.xml file and the reference to it so that both would end up in the same directory after compliation (/home/jason/svn/trunk/classes), and to use the following relative path to the fonts.xml file: net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistry net.sf.jasperreports.extension.fonts.spring.beans.resource=fonts.xml This had the desired effect - it caused the SpringExtensionsRegistry to load, parse, and process my fonts.xml file. In that file, I then defined fonts such as, where the ant macro @CLASSES@ is expanded at compile time to the complete canonical path to the TTF file. The use of the full pathname in this file did not have any negative side effect. However, at some point I will reformulate this to use a relative pathname.: <bean id="blairITCFontFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="BlairITC TT"/> <property name="normal" value="@CLASSES@/BlairMdITCTTMedium.ttf"/> <property name="bold" value="@CLASSES@/BlairITCTTBold.ttf"/> <property name="pdfEncoding" value="Identity-H"/> <property name="pdfEmbedded" value="true"/> <property name="exportFonts"> <map> <entry key="net.sf.jasperreports.html"> <value>Arial, Helvetica, sans-serif</value> </entry> <entry key="net.sf.jasperreports.xhtml"> <value>Arial, Helvetica, sans-serif</value> </entry> </map> </property> </bean> So everything is now back to normal :)
  9. Here is one fix that I have tried, but which did not work: JRProperties.setProperty("net.sf.jasperreports.export.pdf.fontdir.jasper", "/home/jason/svn/trunk/lib/fonts/"); JRProperties.setProperty("net.sf.jasperreports.export.pdf.font.BlairITC TT.Normal","/home/jason/svn/trunk/lib/fonts/BlairMdITCTTMedium.ttf"); JasperExportManager.exportReportToPdfStream(pFilledReport, pOut); The exception I am still getting is: net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'BlairITC TT' is not available to the JVM. See the Javadoc for more details. at net.sf.jasperreports.engine.util.JRStyledText.getAwtAttributedString(JRStyledText.java:228) at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:353) at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:1003) at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:542)
  10. I have read through the sample code included in 3.6.1 (demo/samples/fonts). I modified my jasperreports.properties file to include: net.sf.jasperreports.export.pdf.fontdir.jasper=/path/to/truetype/files/ However, when I run my existing reports, attempting to generate PDF, I get: net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'BlairITC TT' is not available to the JVM. See the Javadoc for more details. at net.sf.jasperreports.engine.util.JRStyledText.getAwtAttributedString(JRStyledText.java:228) I am not currently using the Spring framework, and would rather not have to deal with that. Is my only option to now programatically create an instance of 'SimpleFontFamily', and set all of the propeties (name, normal, italic, pdfEncoding, pdfEmbedded, etc.) on that object. Then add the object to the JRFiller? Is there an example showing that approach instead? I was really hoping this would be as simple as specifying the directory of my TrueType fonts...
  11. This new class file, newly introduced in 3.5.3, seems to be the most likely source of the problem I am seeing. That being said, I'm no closer to a resolution. Code:/* * To change this template, choose Tools | Templates * and open the template in the editor. */package com.jaspersoft.ireport.designer.utils;import java.nio.charset.Charset;import org.netbeans.spi.queries.FileEncodingQueryImplementation;import org.openide.filesystems.FileObject;/** * * @author gtoffoli */public class FileEncodingQueryImpl extends FileEncodingQueryImplementation{ @Override public Charset getEncoding(FileObject arg0) { System.out.println("Charset used: UTF-8!!!!"); System.out.flush(); return Charset.forName("UTF-8"); }}
  12. Sorry - this was meant for the iReport forum, not the JasperReports forum. My error!
  13. Same JRXML, same remote XML data sources, in v3.5.3: http://screencast.com/t/6JpWX78W6 compared to v3.5.2: http://screencast.com/t/0VI1CmMtl Or is this a font name thing perhaps?
  14. Generated and viewed using internal viewer on 3.5.3: http://screencast.com/t/6JpWX78W6 Same JRXML, same everything else on 3.5.2: http://screencast.com/t/0VI1CmMtl
  15. Solution: Replace all references to "XPath2" in my JRXML with "xpath2". Sorry for the alarm, Jason
×
×
  • Create New...