User: hr Date: 2007-08-03 09:51:36+0000 Modified: dba/reportdesign/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java
Log: INTEGRATION: CWS rpt23fix02 (1.2.4); FILE MERGED 2007/07/25 15:05:46 tmorgner 1.2.4.1: Issue number: 78128 This commit fixes the messed up repeating-header system. The whole thing has been redesigned to create a clean state-flow that can be debugged and traced without any weird mind-bending activities. The report-targets now have a new state (IN_GROUP_INSTANCE) to keep track of the group's processing and to separate repeating headers and footers from ordinary headers and footers. This patch also enforces a clean state-flow in the OfficeReportOutputTarget and explicitly checks for all allowed band-types and throws exceptions on every illegal state. File Changes: Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/parser/rpt/ ========================================================================= File [changed]: GroupReadHandler.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/parser/rpt/GroupReadHandler.java?r1=1.2&r2=1.3 Delta lines: +16 -14 --------------------- --- GroupReadHandler.java 2007-07-09 11:56:09+0000 1.2 +++ GroupReadHandler.java 2007-08-03 09:51:33+0000 1.3 @@ -39,16 +39,13 @@ import java.util.ArrayList; +import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.OfficeGroup; +import com.sun.star.report.pentaho.model.OfficeGroupInstanceSection; import com.sun.star.report.pentaho.parser.ElementReadHandler; -import com.sun.star.report.pentaho.parser.StarXmlFactoryModule; -import com.sun.star.report.pentaho.OfficeNamespaces; import org.jfree.report.expressions.FormulaExpression; -import org.jfree.report.structure.Group; -import org.jfree.report.structure.Node; import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; -import org.jfree.report.JFreeReportInfo; import org.jfree.xmlns.parser.XmlReadHandler; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -59,12 +56,17 @@ private GroupSectionReadHandler groupFooter; private GroupReadHandler childGroup; private RootTableReadHandler detailSection; - private Group group; + private OfficeGroup group; + private OfficeGroupInstanceSection groupInstanceSection; private ArrayList functionHandlers; public GroupReadHandler() { group = new OfficeGroup(); + groupInstanceSection = new OfficeGroupInstanceSection(); + groupInstanceSection.setNamespace(OfficeNamespaces.INTERNAL_NS); + groupInstanceSection.setType("group-instance"); + group.addNode(groupInstanceSection); functionHandlers = new ArrayList(); } @@ -84,7 +86,7 @@ { final FormulaExpression function = new FormulaExpression(); function.setFormula(groupExpr); - group.setGroupingExpression(function); + groupInstanceSection.setGroupingExpression(function); } } @@ -145,18 +147,18 @@ { final FunctionReadHandler handler = (FunctionReadHandler) functionHandlers.get(i); - group.addExpression(handler.getExpression()); + groupInstanceSection.addExpression(handler.getExpression()); } if (groupHeader != null) { - group.addNode(groupHeader.getElement()); + groupInstanceSection.addNode(groupHeader.getElement()); } final Section groupBody = new Section(); groupBody.setNamespace(OfficeNamespaces.INTERNAL_NS); groupBody.setType("group-body"); - group.addNode(groupBody); + groupInstanceSection.addNode(groupBody); // XOR: Either the detail or the group section can be set .. if (detailSection != null) { @@ -169,7 +171,7 @@ if (groupFooter != null) { - group.addNode(groupFooter.getElement()); + groupInstanceSection.addNode(groupFooter.getElement()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
