/** * */ protected JRBaseSection getSection(JRSection section) { JRBaseSection baseSection = null; if (section != null) { baseSection = (JRBaseSection)get(section); if (baseSection == null) { baseSection = new JRBaseSection(section, this); } } return baseSection; }
public FillParts(JRSection section, JRFillObjectFactory fillFactory) { JRPart[] sectionParts = section == null ? null : section.getParts(); if (sectionParts == null || sectionParts.length == 0) { parts = Collections.emptyList(); } else { parts = new ArrayList<FillPart>(sectionParts.length); for (JRPart part : sectionParts) { FillPart fillPart = new FillPart(part, fillFactory); parts.add(fillPart); } } }
/** * */ protected void writeSection( JRSection section, String sectionName, String sectionBandListGetterName) { if (section != null) { JRBand[] bands = section.getBands(); if (bands != null && bands.length > 0) { write( "//" + sectionName + "\n\n"); for(int i = 0; i < bands.length; i++) { writeBand( bands[i], sectionName + i); write( sectionBandListGetterName + ".add(" + i + ", " + sectionName + i + ");\n\n"); } } flush(); } }
/** * */ protected JRFillSection getSection(JRSection section) { JRFillSection fillSection = null; if (section == null) { fillSection = filler.missingFillSection; } else { fillSection = (JRFillSection)get(section); if (fillSection == null) { fillSection = new JRFillSection(filler, section, this); } } return fillSection; }
/** * */ private void addBands(JRSection section, List<JRBand> bands) { if (section != null) { JRBand[] sectionBands = section.getBands(); if (sectionBands != null) { for (JRBand band : sectionBands) { addBand(band, bands); } } } }
/** * */ protected JRBaseSection(JRSection section, JRBaseObjectFactory factory) { factory.put(section, this); /* */ JRBand[] jrBands = section.getBands(); if (jrBands != null && jrBands.length > 0) { bands = new JRBand[jrBands.length]; for(int i = 0; i < jrBands.length; i++) { bands[i] = factory.getBand(jrBands[i]); } } /* */ JRPart[] jrParts = section.getParts(); if (jrParts != null && jrParts.length > 0) { parts = new JRPart[jrParts.length]; for(int i = 0; i < jrParts.length; i++) { parts[i] = factory.getPart(jrParts[i]); } } }
/** * */ private void addSection(JRSection section, boolean isColumnSection) { if (section != null) { JRBand[] bands = section.getBands(); if (bands != null && bands.length > 0) { for(int i = 0; i< bands.length; i++) { addBand(bands[i], isColumnSection); } } } }
/** * */ protected void writeSection(JRSection section) throws IOException { if (section != null) { JRBand[] bands = section.getBands(); if (bands != null && bands.length > 0) { if(isNewerVersionOrEqual(JRConstants.VERSION_3_5_2)) { for(int i = 0; i < bands.length; i++) { writeBand(bands[i]); } } else { writeBand(bands[0]); } } if (isNewerVersionOrEqual(JRConstants.VERSION_6_0_0)) { JRPart[] parts = section.getParts(); if (parts != null && parts.length > 0) { for(int i = 0; i < parts.length; i++) { writePart(parts[i]); } } } } }
protected void visitSection(JRSection section) { if (section != null) { JRBand[] bands = section.getBands(); if (bands != null) { for(int i = 0; i < bands.length; i++) { visitBand(bands[i]); } } } }
/** * */ private void verifySection(JRSection section) { if (section != null) { JRBand[] bands = section.getBands(); if (bands != null && bands.length > 0) { if (sectionType == SectionTypeEnum.PART) { addBrokenRule("Part reports cannot contain bands", section); } else { for(int i = 0; i< bands.length; i++) { verifyBand(bands[i]); } } } JRPart[] parts = section.getParts(); if (parts != null && parts.length > 0) { if (sectionType == SectionTypeEnum.BAND) { addBrokenRule("Band reports cannot contain parts", section); } else { for (int i = 0; i < parts.length; i++) { verifyPart(parts[i]); } } } } }
protected void setSectionOrigin(JRSection section, BandTypeEnum type) { if (section instanceof JRDesignSection) { JROrigin origin = new JROrigin(null, getName(), type); ((JRDesignSection) section).setOrigin(origin); } }
protected void setSectionOrigin(JRSection section, BandTypeEnum type) { if (section instanceof JRDesignSection) { JROrigin origin = new JROrigin(type); ((JRDesignSection) section).setOrigin(origin); } }
/** * */ protected JRFillSection( JRBaseFiller filler, JRSection section, JRFillObjectFactory factory ) { if (section != null) { factory.put(section, this); isEmpty = true; areAllPrintWhenExprNull = true; JRBand[] jrBands = section.getBands(); if (jrBands != null && jrBands.length > 0) { bands = new JRFillBand[jrBands.length]; for (int i = 0; i < jrBands.length; i++) { bands[i] = factory.getBand(jrBands[i]); isEmpty = isEmpty && bands[i].isEmpty(); areAllPrintWhenExprNull = areAllPrintWhenExprNull && bands[i].isPrintWhenExpressionNull(); } } else { // use a single missing band for empty sections bands = new JRFillBand[]{filler.missingFillBand}; } } else { // use a single missing band for null/missing sections bands = new JRFillBand[]{filler.missingFillBand}; } this.filler = filler; }
protected JRSection wrapBand(JRBand band, BandTypeEnum bandType) { if (band == null) { return null; } JROrigin origin = new JROrigin(null, getName(), bandType); JRDesignSection section = new JRDesignSection(origin); section.addBand(band); return section; }
/** * Return the index of band in the section. It return -1 if the band is not found in this section * * @param section * the section * @param band * the band * @return the band index */ public static int getBandIndex(JRSection section, JRBand band) { JRBand[] bands = section.getBands(); for (int i = 0; bands != null && i < bands.length; ++i) { if (bands[i] == band) return i; } return -1; }
/** * Return the index of band in the section. * It return -1 if the band is not found in this section * * @param section * @param band * @return */ public static int getBandIndex(JRSection section, JRBand band) { JRBand[] bands = section.getBands(); for (int i=0;bands != null && i<bands.length; ++i) { if (bands[i] == band) return i; } return -1; }
public void adjustTextMarkup(JasperReport jr) { JRSection detailSection = jr.getDetailSection(); for (JRBand band : detailSection.getBands()) { if (band.getElements().length > 0) { JRBaseTextField text = (JRBaseTextField) band.getElements()[0]; text.setBold(true); for (JRElement element : band.getElements()) { JRBaseTextField column = (JRBaseTextField) element; column.setMarkup(JRCommonText.MARKUP_HTML); } } } }
@Override public JRSection getDetailSection() { return detailSection; }
@Override public JRSection getGroupHeaderSection() { return this.groupHeaderSection; }
@Override public JRSection getGroupFooterSection() { return this.groupFooterSection; }
@Override public JRSection getSection() { return ((JasperDesign)digester.peek(digester.getCount() - 2)).getDetailSection(); }
@Override public JRSection getSection() { return ((JRDesignGroup)digester.peek()).getGroupHeaderSection(); }
@Override public JRSection getSection() { return ((JRDesignGroup)digester.peek()).getGroupFooterSection(); }
/** * */ private void writeGroup(JRGroup group) throws IOException { writer.startElement(JRXmlConstants.ELEMENT_group); writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, group.getName()); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isStartNewColumn, group.isStartNewColumn(), false); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isStartNewPage, group.isStartNewPage(), false); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isResetPageNumber, group.isResetPageNumber(), false); writer.addAttribute(JRXmlConstants.ATTRIBUTE_isReprintHeaderOnEachPage, group.isReprintHeaderOnEachPage(), false); if (isNewerVersionOrEqual(JRConstants.VERSION_6_5_1)) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_isReprintHeaderOnEachColumn, group.isReprintHeaderOnEachColumn(), false); } writer.addAttributePositive(JRXmlConstants.ATTRIBUTE_minHeightToStartNewPage, group.getMinHeightToStartNewPage()); if (isNewerVersionOrEqual(JRConstants.VERSION_6_4_3)) { writer.addAttributePositive(JRXmlConstants.ATTRIBUTE_minDetailsToStartFromTop, group.getMinDetailsToStartFromTop()); } if (isNewerVersionOrEqual(JRConstants.VERSION_3_6_2)) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_footerPosition, group.getFooterPositionValue(), FooterPositionEnum.NORMAL); writer.addAttribute(JRXmlConstants.ATTRIBUTE_keepTogether, group.isKeepTogether(), false); } if (isNewerVersionOrEqual(JRConstants.VERSION_6_4_3)) { writer.addAttribute(JRXmlConstants.ATTRIBUTE_preventOrphanFooter, group.isPreventOrphanFooter(), false); } writeExpression(JRXmlConstants.ELEMENT_groupExpression, group.getExpression(), false); JRSection groupHeader = group.getGroupHeaderSection(); if (groupHeader != null) { writer.startElement(JRXmlConstants.ELEMENT_groupHeader); writeSection(groupHeader); writer.closeElement(true); } JRSection groupFooter = group.getGroupFooterSection(); if (groupFooter != null) { writer.startElement(JRXmlConstants.ELEMENT_groupFooter); writeSection(groupFooter); writer.closeElement(true); } writer.closeElement(); }
/** * */ private void writeGroup( JRGroup group) { String groupName = group.getName(); groupsMap.put(groupName, groupName); write( "JRDesignGroup " + groupName + " = new JRDesignGroup();\n"); write( groupName + ".setName(\"" + JRStringUtil.escapeJavaStringLiteral(groupName) + "\");\n"); write( groupName + ".setStartNewColumn({0});\n", group.isStartNewColumn(), false); write( groupName + ".setStartNewPage({0});\n", group.isStartNewPage(), false); write( groupName + ".setReprintHeaderOnEachPage({0});\n", group.isReprintHeaderOnEachPage(), false); write( groupName + ".setReprintHeaderOnEachColumn({0});\n", group.isReprintHeaderOnEachColumn(), false); write( groupName + ".setMinHeightToStartNewPage({0});\n", group.getMinHeightToStartNewPage()); write( groupName + ".setMinDetailsToStartFromTop({0});\n", group.getMinDetailsToStartFromTop()); write( groupName + ".setFooterPosition({0});\n", group.getFooterPositionValue(), FooterPositionEnum.NORMAL); write( groupName + ".setKeepTogether({0});\n", group.isKeepTogether(), false); write( groupName + ".setPreventOrphanFooter({0});\n", group.isPreventOrphanFooter(), false); writeExpression( group.getExpression(), groupName, "Expression"); JRSection groupHeader = group.getGroupHeaderSection(); if (groupHeader != null) { writeSection( groupHeader, groupName+"Header", "((JRDesignSection)" + groupName + ".getGroupHeaderSection()).getBandsList()" ); } JRSection groupFooter = group.getGroupFooterSection(); if (groupFooter != null) { writeSection( groupFooter, groupName+"Footer", "((JRDesignSection)" + groupName + ".getGroupFooterSection()).getBandsList()" ); } flush(); }
@Override public JRSection getGroupHeaderSection() { return groupHeaderSection; }
@Override public JRSection getGroupFooterSection() { return groupFooterSection; }
@Override protected JRFillSection getSection(JRSection section) { //avoid creating subdataset group sections return super.getSection(null); }
@Override public JRSection getGroupFooterSection() { return footerSection; }
@Override public JRSection getGroupHeaderSection() { return headerSection; }
protected JRSection wrapBand(JRBand band, JROrigin origin) { JRDesignSection section = new JRDesignSection(origin); section.addBand(band); return section; }
@Override public JRSection getDetailSection() { return detail; }
@Override public JRSection getSection(){ return getJrGroup().getGroupHeaderSection(); }
@Override public JRSection getSection(){ return getJrGroup().getGroupFooterSection(); }
/** * */ public abstract JRSection getSection();
/** * Return the JRSection of the actual band * * @return a JRSection */ public abstract JRSection getSection();