public void setPropertyValue(Object id, Object value) { JRDesignGroup jrGroup = (JRDesignGroup) getValue(); if (id.equals(JRDesignGroup.PROPERTY_NAME)) { jrGroup.setName((String) value); } else if (id.equals(JRDesignGroup.PROPERTY_EXPRESSION)) jrGroup.setExpression(ExprUtil.setValues(jrGroup.getExpression(), value, null)); else if (id.equals(JRBaseGroup.PROPERTY_MIN_HEIGHT_TO_START_NEW_PAGE)) { int minH = 0; if (value != null) minH = Math.max(0, (Integer) value); jrGroup.setMinHeightToStartNewPage(minH); } else if (id.equals(JRDesignGroup.PROPERTY_START_NEW_COLUMN)) jrGroup.setStartNewColumn((Boolean) value); else if (id.equals(JRDesignGroup.PROPERTY_START_NEW_PAGE)) jrGroup.setStartNewPage((Boolean) value); else if (id.equals(JRDesignGroup.PROPERTY_RESET_PAGE_NUMBER)) jrGroup.setResetPageNumber((Boolean) value); else if (id.equals(JRDesignGroup.PROPERTY_REPRINT_HEADER_ON_EACH_PAGE)) jrGroup.setReprintHeaderOnEachPage((Boolean) value); else if (id.equals(JRDesignGroup.PROPERTY_KEEP_TOGETHER)) jrGroup.setKeepTogether((Boolean) value); else if (id.equals(JRDesignGroup.PROPERTY_FOOTER_POSITION)) jrGroup.setFooterPosition((FooterPositionEnum) positionD.getEnumValue(value)); }
@Override public void setFooterPosition(FooterPositionEnum footerPositionValue) { FooterPositionEnum old = this.footerPositionValue; this.footerPositionValue = footerPositionValue; getEventSupport().firePropertyChange(PROPERTY_FOOTER_POSITION, old, this.footerPositionValue); }
@SuppressWarnings("deprecation") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2) { if (footerPosition == 0) { // stream class didn't have footerPosition, use default. // ideally we should have used PSEUDO_SERIAL_VERSION_UID to // detect this case, but there was no PSEUDO_SERIAL_VERSION_UID // when footerPosition was introduced footerPositionValue = FooterPositionEnum.NORMAL; } else { // convert stream byte value to enum footerPositionValue = FooterPositionEnum.getByValue(footerPosition); } } if (groupHeader != null) { groupHeaderSection = new JRBaseSection(groupHeader); groupHeader = null; } if (groupFooter != null) { groupFooterSection = new JRBaseSection(groupFooter); groupFooter = null; } }
/** * */ public static void moveContent(GroupFooterElementRange groupFooterElementRange, int columnFooterOffsetY) { if (groupFooterElementRange.getMasterFooterPosition() != FooterPositionEnum.NORMAL)//FIXME is footerPosition testing required here? { ElementRange elementRange = groupFooterElementRange.getElementRange(); int distanceToColumnFooter = columnFooterOffsetY - elementRange.getBottomY(); //no page/column break occurred for (int i = elementRange.getFirstElementIndex(); i <= elementRange.getLastElementIndex(); i++) { JRPrintElement printElement = elementRange.getPage().getElements().get(i); printElement.setY(printElement.getY() + distanceToColumnFooter); } } }
public SimpleGroupFooterElementRange( ElementRange elementRange, FooterPositionEnum masterFooterPosition ) { this.elementRange = elementRange; this.masterFooterPosition = masterFooterPosition; }
@Override public void setPropertyValue(Object id, Object value) { JRDesignGroup jrGroup = (JRDesignGroup) getValue(); if (id.equals(JasperDesign.PROPERTY_ORIENTATION)) jrGroup .setFooterPosition((FooterPositionEnum) EnumHelper.getSetValue(FooterPositionEnum.values(), value, 1, true)); else super.setPropertyValue(id, value); }
@SuppressWarnings("unchecked") public FooterPositionProperty(JRDesignGroup group) { super(FooterPositionEnum.class, group); this.group = group; setValue("suppressCustomEditor", Boolean.TRUE); }
public List getTagList() { List tags = new java.util.ArrayList(); tags.add(new Tag(FooterPositionEnum.NORMAL, I18n.getString("Global.Property.FooterPosition.normal"))); tags.add(new Tag(FooterPositionEnum.STACK_AT_BOTTOM, I18n.getString("Global.Property.FooterPosition.stackAtBottom"))); tags.add(new Tag(FooterPositionEnum.FORCE_AT_BOTTOM, I18n.getString("Global.Property.FooterPosition.forceAtBottom"))); tags.add(new Tag(FooterPositionEnum.COLLATE_AT_BOTTOM, I18n.getString("Global.Property.FooterPosition.collateAtBottom"))); return tags; }
public static FooterPositionEnum groupFooterPosition(GroupFooterPosition footerPosition) { switch (footerPosition) { case NORMAL: return FooterPositionEnum.NORMAL; case COLLATE_AT_BOTTOM: return FooterPositionEnum.COLLATE_AT_BOTTOM; case FORCE_AT_BOTTOM: return FooterPositionEnum.FORCE_AT_BOTTOM; case STACK_AT_BOTTOM: return FooterPositionEnum.STACK_AT_BOTTOM; default: throw new JasperDesignException("GroupFooterPosition " + footerPosition.name() + " not supported"); } }
@Override public FooterPositionEnum getFooterPositionValue() { return this.footerPositionValue; }
/** * */ 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(); }
@Override public Object createObject(Attributes atts) { JRDesignGroup group = new JRDesignGroup(); group.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name)); String isStartNewColumn = atts.getValue(JRXmlConstants.ATTRIBUTE_isStartNewColumn); if (isStartNewColumn != null && isStartNewColumn.length() > 0) { group.setStartNewColumn(Boolean.valueOf(isStartNewColumn).booleanValue()); } String isStartNewPage = atts.getValue(JRXmlConstants.ATTRIBUTE_isStartNewPage); if (isStartNewPage != null && isStartNewPage.length() > 0) { group.setStartNewPage(Boolean.valueOf(isStartNewPage).booleanValue()); } String isResetPageNumber = atts.getValue(JRXmlConstants.ATTRIBUTE_isResetPageNumber); if (isResetPageNumber != null && isResetPageNumber.length() > 0) { group.setResetPageNumber(Boolean.valueOf(isResetPageNumber).booleanValue()); } String isReprintHeaderOnEachPage = atts.getValue(JRXmlConstants.ATTRIBUTE_isReprintHeaderOnEachPage); if (isReprintHeaderOnEachPage != null && isReprintHeaderOnEachPage.length() > 0) { group.setReprintHeaderOnEachPage(Boolean.valueOf(isReprintHeaderOnEachPage).booleanValue()); } String isReprintHeaderOnEachColumn = atts.getValue(JRXmlConstants.ATTRIBUTE_isReprintHeaderOnEachColumn); if (isReprintHeaderOnEachColumn != null && isReprintHeaderOnEachColumn.length() > 0) { group.setReprintHeaderOnEachColumn(Boolean.valueOf(isReprintHeaderOnEachColumn).booleanValue()); } String minHeightToStartNewPage = atts.getValue(JRXmlConstants.ATTRIBUTE_minHeightToStartNewPage); if (minHeightToStartNewPage != null && minHeightToStartNewPage.length() > 0) { group.setMinHeightToStartNewPage(Integer.parseInt(minHeightToStartNewPage)); } String minDetailsToStartFromTop = atts.getValue(JRXmlConstants.ATTRIBUTE_minDetailsToStartFromTop); if (minDetailsToStartFromTop != null && minDetailsToStartFromTop.length() > 0) { group.setMinDetailsToStartFromTop(Integer.parseInt(minDetailsToStartFromTop)); } FooterPositionEnum footerPosition = FooterPositionEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_footerPosition)); if (footerPosition != null) { group.setFooterPosition(footerPosition); } String keepTogether = atts.getValue(JRXmlConstants.ATTRIBUTE_keepTogether); if (keepTogether != null && keepTogether.length() > 0) { group.setKeepTogether(Boolean.valueOf(keepTogether).booleanValue()); } String preventOrphanFooter = atts.getValue(JRXmlConstants.ATTRIBUTE_preventOrphanFooter); if (preventOrphanFooter != null && preventOrphanFooter.length() > 0) { group.setPreventOrphanFooter(Boolean.valueOf(preventOrphanFooter).booleanValue()); } return group; }
/** * */ 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 FooterPositionEnum getFooterPositionValue() { return parent.getFooterPositionValue(); }
@Override public void setFooterPosition(FooterPositionEnum footerPosition) { throw new UnsupportedOperationException(); }
@Override public FooterPositionEnum getMasterFooterPosition() { return masterFooterPosition; }
@Override public void setMasterFooterPosition(FooterPositionEnum masterFooterPosition) { this.masterFooterPosition = masterFooterPosition; }
@Override public FooterPositionEnum getCurrentFooterPosition() { return crtFooterPosition; }
@Override public void setCurrentFooterPosition(FooterPositionEnum crtFooterPosition) { this.crtFooterPosition = crtFooterPosition; }
@Override public FooterPositionEnum getFooterPositionValue() { return datasetGroup.getFooterPositionValue(); }
/** * Creates the property descriptors. * * @param desc * the desc */ @Override public void createPropertyDescriptors(List<IPropertyDescriptor> desc, Map<String, Object> defaultsMap) { validator = new GroupNameValidator(); validator.setTargetNode(this); JSSTextPropertyDescriptor nameD = new JSSValidatedTextPropertyDescriptor(JRDesignGroup.PROPERTY_NAME, Messages.common_name, validator); nameD.setDescription(Messages.MGroup_name_description); desc.add(nameD); JRExpressionPropertyDescriptor expressionD = new JRExpressionPropertyDescriptor(JRDesignGroup.PROPERTY_EXPRESSION, Messages.common_expression); expressionD.setDescription(Messages.MGroup_expression_description); desc.add(expressionD); PixelPropertyDescriptor minhD = new PixelPropertyDescriptor(JRBaseGroup.PROPERTY_MIN_HEIGHT_TO_START_NEW_PAGE, Messages.MGroup_minHeightTitle); minhD.setDescription(Messages.MGroup_minHeightDescription); desc.add(minhD); CheckBoxPropertyDescriptor stNewColD = new CheckBoxPropertyDescriptor(JRBaseGroup.PROPERTY_START_NEW_COLUMN, Messages.MGroup_newColTitle); stNewColD.setDescription(Messages.MGroup_newColDescription); desc.add(stNewColD); CheckBoxPropertyDescriptor stNewPageD = new CheckBoxPropertyDescriptor(JRBaseGroup.PROPERTY_START_NEW_PAGE, Messages.MGroup_newPageTitle); stNewPageD.setDescription(Messages.MGroup_newPageDescription); desc.add(stNewPageD); CheckBoxPropertyDescriptor rPageNumD = new CheckBoxPropertyDescriptor(JRBaseGroup.PROPERTY_RESET_PAGE_NUMBER, Messages.MGroup_pageNumberTitle); rPageNumD.setDescription(Messages.MGroup_pageNumberDescription); desc.add(rPageNumD); CheckBoxPropertyDescriptor rHeadEPD = new CheckBoxPropertyDescriptor( JRBaseGroup.PROPERTY_REPRINT_HEADER_ON_EACH_PAGE, Messages.MGroup_reprintTitle); rHeadEPD.setDescription(Messages.MGroup_reprintPosition); desc.add(rHeadEPD); CheckBoxPropertyDescriptor keepToD = new CheckBoxPropertyDescriptor(JRBaseGroup.PROPERTY_KEEP_TOGETHER, Messages.MGroup_keepTitle); keepToD.setDescription(Messages.MGroup_keepDescription); desc.add(keepToD); positionD = new JSSEnumPropertyDescriptor(JRBaseGroup.PROPERTY_FOOTER_POSITION, Messages.MGroup_footerPosTitle, FooterPositionEnum.class, NullEnum.NOTNULL); positionD.setDescription(Messages.MGroup_footerPosDescription); desc.add(positionD); defaultsMap.put(JRDesignGroup.PROPERTY_MIN_HEIGHT_TO_START_NEW_PAGE, CONST_MIN_HEIGHT); defaultsMap.put(JRDesignGroup.PROPERTY_FOOTER_POSITION, FooterPositionEnum.NORMAL); defaultsMap.put(JRDesignGroup.PROPERTY_KEEP_TOGETHER, Boolean.FALSE); defaultsMap.put(JRDesignGroup.PROPERTY_REPRINT_HEADER_ON_EACH_PAGE, Boolean.FALSE); defaultsMap.put(JRDesignGroup.PROPERTY_RESET_PAGE_NUMBER, Boolean.FALSE); defaultsMap.put(JRDesignGroup.PROPERTY_START_NEW_COLUMN, Boolean.FALSE); defaultsMap.put(JRDesignGroup.PROPERTY_START_NEW_PAGE, Boolean.FALSE); setHelpPrefix(desc, "net.sf.jasperreports.doc/docs/schema.reference.html?cp=0_1#group"); //$NON-NLS-1$ }
@Override public Object getDefaultValue() { return FooterPositionEnum.NORMAL; }
/** * Specifies how the group footer section behaves with regards to its position on the current page. */ public FooterPositionEnum getFooterPositionValue();
/** * Specifies the group footer section behavior with regards to its position on the current page. */ public void setFooterPosition(FooterPositionEnum footerPosition);
@Override public void setPropertyValue(Object value) { group.setFooterPosition((FooterPositionEnum)value); }
public FooterPositionEnum getMasterFooterPosition();
public void setMasterFooterPosition(FooterPositionEnum footerPosition);
public FooterPositionEnum getCurrentFooterPosition();
public void setCurrentFooterPosition(FooterPositionEnum footerPosition);