Jump to content
Changes to the Jaspersoft community edition download ×

ahallez

Members
  • Posts

    11
  • 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 ahallez

  1. For completeness: I upgraded the jasperreports library to 6.0 (from 5.something) and the report renders correctly now. I still get an expection: Interrupted exception, but this doesn't seem to have an influence on the result.
  2. Ok here goes: The main reportThe subreportThe data source(s) class file<!DOCTYPE jasperReport [ <!ENTITY fonts SYSTEM "be/gymfed/GymFedFonts.xml"> <!ENTITY parameters SYSTEM "be/gymfed/GymFedDefaultParameters.xml"> <!ENTITY pageheader SYSTEM "be/gymfed/PageHeader.xml"> <!ENTITY pagefooter SYSTEM "be/gymfed/PageFooter.xml">]><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ParticipantsReport" columnCount="1" printOrder="Vertical" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" isTitleNewPage="false" isSummaryNewPage="false" scriptletClass="be.scoreexpress.ui.report.SEScriptlet">&fonts;<subDataset name="blocks"> <parameter name="TEMPLATE_FILE" class="java.lang.String" /> <parameter name="blockSubReport" class="java.lang.String" /> <field name="block" class="be.scoreexpress.data.competition.Block"/> <field name="blockDataSource" class="net.sf.jasperreports.engine.JRDataSource"/></subDataset>&parameters;<parameter name="blockSubReport" class="java.lang.String" /><field name="session" class="java.lang.Object"/><field name="categories" class="java.lang.String"/><field name="blocks" class="net.sf.jasperreports.engine.JRDataSource"/>&pageheader;<detail> <band height="90"> <textField isStretchWithOverflow="true" > <reportElement x="0" y="0" width="535" height="22" style="headerbold" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="true"/> <textElement textAlignment="Left" lineSpacing="Single"> <font size="15"/> </textElement> <textFieldExpression class="java.lang.String"> ((be.scoreexpress.data.competition.Session) $F{session}).getName() </textFieldExpression> </textField> <!--<textField isStretchWithOverflow="true" > <reportElement x="0" y="24" width="535" height="22" style="headerbold" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="true"/> <textElement textAlignment="Left" lineSpacing="Single"/> <textFieldExpression class="java.lang.String"> $F{categories} </textFieldExpression> </textField>--> <componentElement> <reportElement x="0" y="25" width="535" height="65" style="table" /> <c:list xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Horizontal"> <datasetRun subDataset="blocks"> <parametersMapExpression>$P{REPORT_PARAMETERS_MAP}</parametersMapExpression> <!--<datasetParameter name="TEMPLATE_FILE"> <datasetParameterExpression>$P{TEMPLATE_FILE}</datasetParameterExpression> </datasetParameter> <datasetParameter name="blockSubReport"> <datasetParameterExpression>$P{blockSubReport}</datasetParameterExpression> </datasetParameter>--> <dataSourceExpression>$F{blocks}</dataSourceExpression> </datasetRun> <c:listContents height="30" width="266"> <textField isStretchWithOverflow="true" > <reportElement x="0" y="0" width="265" height="16" style="headerbold" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="true"/> <textElement textAlignment="Left" lineSpacing="Single"> <font size="13" isBold="true" /> </textElement> <textFieldExpression class="java.lang.String"> $F{block}.toString(); </textFieldExpression> </textField> <subreport isUsingCache="false"> <reportElement x="0" y="25" width="265" height="0" isRemoveLineWhenBlank="true"/> <!--<subreportParameter name="TEMPLATE_FILE"> <subreportParameterExpression>"./config/GymFedStyles.xml"</subreportParameterExpression> </subreportParameter>--> <dataSourceExpression> $F{blockDataSource} </dataSourceExpression> <subreportExpression class="java.lang.String"> $P{blockSubReport} </subreportExpression> </subreport> </c:listContents> </c:list> </componentElement> <!--<subreport isUsingCache="true"> <reportElement positionType="Float" x="0" y="25" width="535" height="0" isRemoveLineWhenBlank="true"/> <subreportParameter name="TEMPLATE_FILE"> <subreportParameterExpression>$P{TEMPLATE_FILE}</subreportParameterExpression> </subreportParameter> <dataSourceExpression> $F{blocks} </dataSourceExpression> <subreportExpression class="java.lang.String"> $P{blockSubReport} </subreportExpression> </subreport>--> <!--<break type="Page"> <reportElement x="0" y="31" width="10" height="1"/> </break>--> </band></detail>&pagefooter;</jasperReport>[/code]<!DOCTYPE jasperReport [ <!ENTITY fonts SYSTEM "be/gymfed/GymFedFonts.xml">]><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ParticipantsReport" columnCount="1" printOrder="Vertical" pageWidth="265" pageHeight="100" columnWidth="265" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isTitleNewPage="false" isSummaryNewPage="false" ><template><![CDATA["./config/GymFedStyles.xml"]]></template><subDataset name="blockParticipations"> <field name="blockParticipation" class="be.scoreexpress.data.competition.BlockParticipation"/> <field name="panel" class="java.lang.String"/></subDataset><!--<parameter name="TEMPLATE_FILE" class="java.lang.String"/>--><!--<field name="block" class="be.scoreexpress.data.competition.Block"/><field name="index" class="java.lang.Integer" />--><field name="blockParticipations" class="net.sf.jasperreports.engine.JRDataSource"/><detail> <band height="30" ><!-- <textField isStretchWithOverflow="true" > <reportElement x="0" y="0" width="265" height="16" style="headerbold" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="true"/> <textElement textAlignment="Left" lineSpacing="Single"> <font size="13" isBold="true" /> </textElement> <textFieldExpression class="java.lang.String"> $F{block}.toString(); </textFieldExpression> </textField>--> <componentElement> <reportElement x="0" y="0" width="265" height="26" style="table" /> <c:table xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetRun subDataset="blockParticipations"> <dataSourceExpression>$F{blockParticipations}</dataSourceExpression> </datasetRun> <c:column width="30"> <c:columnHeader height="16" style="table_TH"> <staticText> <reportElement x="0" y="0" width="28" height="16" style="transparent"> </reportElement> <textElement verticalAlignment="Middle"> <font size="10" isBold="true" /> </textElement> <text>Nr</text> </staticText> </c:columnHeader> <c:detailCell height="26" style="table_TD"> <textField isStretchWithOverflow="true"> <reportElement x="0" y="0" width="28" height="14" style="transparent"> </reportElement> <textFieldExpression>$F{blockParticipation}.getParticipation().getNumber()</textFieldExpression> </textField> </c:detailCell> </c:column> <c:column width="110"> <c:columnHeader height="16" style="table_TH"> <staticText> <reportElement x="0" y="0" width="108" height="16" style="transparent"> </reportElement> <textElement verticalAlignment="Middle"> <font size="10" isBold="true" /> </textElement> <text>Participant</text> </staticText> </c:columnHeader> <c:detailCell height="26" style="table_TD"> <textField isStretchWithOverflow="true"> <reportElement x="0" y="0" width="108" height="14" style="transparent"> </reportElement> <textFieldExpression>$F{blockParticipation}.getParticipation().getParticipantName()</textFieldExpression> </textField> <textField isStretchWithOverflow="true"> <reportElement x="0" y="14" width="108" height="12" style="transparent" positionType="Float" isPrintWhenDetailOverflows="true"> </reportElement> <textElement verticalAlignment="Top"> <font size="7" /> </textElement> <textFieldExpression>$F{blockParticipation}.getParticipation().getClub().getName()</textFieldExpression> </textField> </c:detailCell> </c:column> <c:column width="90"> <c:columnHeader height="16" style="table_TH"> <staticText> <reportElement x="0" y="0" width="88" height="16" style="transparent"> </reportElement> <textElement verticalAlignment="Middle"> <font size="10" isBold="true" /> </textElement> <text>Category</text> </staticText> </c:columnHeader> <c:detailCell height="26" style="table_TD"> <textField isStretchWithOverflow="true"> <reportElement x="0" y="0" width="88" height="14" style="transparent"> </reportElement> <textFieldExpression>$F{blockParticipation}.getParticipation().getCategory().toString()</textFieldExpression> </textField> </c:detailCell> </c:column> </c:table> </componentElement> </band></detail></jasperReport>[/code]/** To change this template, choose Tools | Templates* and open the template in the editor.*/package be.scoreexpress.ui.report;import be.scoreexpress.data.competition.*;import be.scoreexpress.data.jurypanel.JuryPanel;import java.util.*;import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JRField;/**** @author axel*/public class SessionDataSource implements net.sf.jasperreports.engine.JRDataSource { Iterator<Session> iterator; Session current; public SessionDataSource(Competition competition) { iterator = competition.getSessions().iterator(); } public boolean next() throws JRException { if (iterator.hasNext()) { current = iterator.next(); return true; } return false; } public Object getFieldValue(JRField jrf) throws JRException { String name = jrf.getName(); if ("session".equals(name)) { return current; } else if ("categories".equals(name)) { StringBuilder names = new StringBuilder(); String separator = ""; for (SessionCategory scat : current.getCategories()) { names.append(separator).append(scat.getCategory().toString()); separator = ", "; } return names.toString(); } else if ("blocks".equals(name)) { return new BlockDataSource(current); } return null; }}class BlockDataSource implements net.sf.jasperreports.engine.JRRewindableDataSource { Session session; Iterator<Block> blockIterator; Block current = null; public BlockDataSource(Session session) { this.session = session; blockIterator = session.getBlocks().iterator(); } public boolean next() throws JRException { java.lang.System.out.println("Next Block 1"); if (blockIterator.hasNext()) { current = blockIterator.next(); java.lang.System.out.println(current.toString()); return true; } return false; } public Object getFieldValue(JRField jrf) throws JRException { if ("block".equals(jrf.getName())) { return current; } else if ("blockDataSource".equals(jrf.getName())) { return new BlockBlockDataSource(current); } return null; } public void moveFirst() throws JRException { current = null; blockIterator = session.getBlocks().iterator(); }}class BlockBlockDataSource implements net.sf.jasperreports.engine.JRRewindableDataSource { Block block; boolean ready = true; public BlockBlockDataSource(Block block) { this.block = block; } public boolean next() throws JRException { java.lang.System.out.println("Next Block 2"); if (ready) { ready = false; java.lang.System.out.println(block.toString()); return true; } return false; } public Object getFieldValue(JRField jrf) throws JRException { if ("blockParticipations".equals(jrf.getName())) { return new BlockParticipationDataSource(block); } return null; } public void moveFirst() throws JRException { ready = true; }}class BlockParticipationDataSource implements net.sf.jasperreports.engine.JRDataSource { Iterator<BlockParticipation> partIterator; BlockParticipation current = null; public BlockParticipationDataSource(Block block) { partIterator = block.getParticipations().iterator(); } public boolean next() throws JRException { java.lang.System.out.println("Next participation"); if (partIterator.hasNext()) { current = partIterator.next(); java.lang.System.out.println(current.getParticipation().getParticipantName()); return true; } return false; } public Object getFieldValue(JRField jrf) throws JRException { if ("blockParticipation".equals(jrf.getName())) { return current; } if ("panel".equals(jrf.getName())) { if (current.getEvent() != null) { JuryPanel panel = JuryPanel.getResponsiblePanel(current.getParticipation(), current.getEvent()); if (panel != null) { return panel.getName(); } } return ""; } return null; }}[/code]
  3. The data sources used in the report are all custom datasources. The main datasource providing a subdatasource (through a field) for each detail. In general the list subdatasource contains 0 to many elements. The traversal of this datasource seems to work well. The list subdatasource is providing a subsdatasource of its own (again through a field) containing only one element. This is the datasource that is not traversed well; it is only used in the list elements that are positioned on the left side and not for the elements positioned on the right side of the page.
  4. I'm running into a strange problem using the list component in combination a subreport. The structure of the report is as follows: 1. The main report has a single column layout. 2. The detail band of the report has list component with a horizontal print order. The (fixed) width of the list elements is half the page width, such that each row in the list can contain two elements. The height of the list elements is not fixed. 3. The list element contains a subreport which in turn contains a table component in the detail band. As it turns out, the report compiles. When executed, the uneven list elements (displayed at the left side of the page) are rendered correctly, but the even list elements, displayed on the right side of the page, are not rendered correctly. I added logging to the datasource classes used in the reports, and it looks like the datasources for the right side list elements are never traversed. When I switch the printorder to vertical, the content is correct (but not the layout). Currently I'm out of options for solving this problem. Any ideas about were to look?
  5. Anybody who knows how to solve this problem, I'm in a similar situation. Many thanks, Axel
  6. Hi Teodor, In my case this is no solution. To ensure that the logo's appear on each page, I would have to include a group that is triggered with each detail. This would disturb the behaviour of the other groups in the reports. Best regards, Axel
  7. If you can't style an element dynamically, you could add one element per style that you want to display and use printWhenExpressions to decide which one should be visible. Axel Hallez
  8. Hello all, I'm trying to implement a resizable page footer in my reports. I tried several approaches, but nothing was succesfull. The user has the option specify an image that should be in the footer. If there's no image, the band height should be reduced, otherwise the band height should be adjusted to the image height. The image is passed as a parameter. I tried a combination of printWhenExpression for deciding wether the image should be printed or not and isRemoveLineWhenBlank to shrink the band if the image is not printed. I also tried to start out with a low band height and set scaleImage to RealHeight in order to increase the band height. None of these approaches works. The band is just always the same height. So my impression is that band resizing is not supported for the page footer. Would this be something to add? I understand that it is difficult to fill pages if the footer size can vary throughout the report, but in this case, the footer size can be determined once a the beginning and remains the same for all of the pages. Kind regards, Axel Hallez Post Edited by ahallez at 11/01/2009 19:28
×
×
  • Create New...