1 28 package net.sf.jasperreports.crosstabs.xml; 29 30 31 import net.sf.jasperreports.crosstabs.design.JRDesignCrosstab; 32 import net.sf.jasperreports.engine.design.JasperDesign; 33 import net.sf.jasperreports.engine.xml.JRBaseFactory; 34 35 import org.xml.sax.Attributes ; 36 37 38 42 public class JRCrosstabFactory extends JRBaseFactory 43 { 44 public static final String ATTRIBUTE_columnBreakOffset = "columnBreakOffset"; 45 public static final String ATTRIBUTE_isRepeatColumnHeaders = "isRepeatColumnHeaders"; 46 public static final String ATTRIBUTE_isRepeatRowHeaders = "isRepeatRowHeaders"; 47 48 public Object createObject(Attributes atts) 49 { 50 JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); 51 52 JRDesignCrosstab crosstab = new JRDesignCrosstab(jasperDesign); 53 54 String columnBreakOffsetAttr = atts.getValue(ATTRIBUTE_columnBreakOffset); 55 if (columnBreakOffsetAttr != null && columnBreakOffsetAttr.length() > 0) 56 { 57 crosstab.setColumnBreakOffset(Integer.parseInt(columnBreakOffsetAttr)); 58 } 59 60 String repeatColHeadersAttr = atts.getValue(ATTRIBUTE_isRepeatColumnHeaders); 61 if (repeatColHeadersAttr != null && repeatColHeadersAttr.length() > 0) 62 { 63 crosstab.setRepeatColumnHeaders(Boolean.valueOf(repeatColHeadersAttr).booleanValue()); 64 } 65 66 String repeatRowHeadersAttr = atts.getValue(ATTRIBUTE_isRepeatRowHeaders); 67 if (repeatRowHeadersAttr != null && repeatColHeadersAttr.length() > 0) 68 { 69 crosstab.setRepeatRowHeaders(Boolean.valueOf(repeatRowHeadersAttr).booleanValue()); 70 } 71 72 return crosstab; 73 } 74 } 75 | Popular Tags |