1 28 package net.sf.jasperreports.engine.xml; 29 30 import net.sf.jasperreports.engine.design.JRDesignGroup; 31 32 import org.xml.sax.Attributes ; 33 34 35 39 public class JRGroupFactory extends JRBaseFactory 40 { 41 42 43 46 private static final String ATTRIBUTE_name = "name"; 47 private static final String ATTRIBUTE_isStartNewColumn = "isStartNewColumn"; 48 private static final String ATTRIBUTE_isStartNewPage = "isStartNewPage"; 49 private static final String ATTRIBUTE_isResetPageNumber = "isResetPageNumber"; 50 private static final String ATTRIBUTE_isReprintHeaderOnEachPage = "isReprintHeaderOnEachPage"; 51 private static final String ATTRIBUTE_minHeightToStartNewPage = "minHeightToStartNewPage"; 52 53 54 57 public Object createObject(Attributes atts) 58 { 59 JRDesignGroup group = new JRDesignGroup(); 60 61 group.setName(atts.getValue(ATTRIBUTE_name)); 62 63 String isStartNewColumn = atts.getValue(ATTRIBUTE_isStartNewColumn); 64 if (isStartNewColumn != null && isStartNewColumn.length() > 0) 65 { 66 group.setStartNewColumn(Boolean.valueOf(isStartNewColumn).booleanValue()); 67 } 68 69 String isStartNewPage = atts.getValue(ATTRIBUTE_isStartNewPage); 70 if (isStartNewPage != null && isStartNewPage.length() > 0) 71 { 72 group.setStartNewPage(Boolean.valueOf(isStartNewPage).booleanValue()); 73 } 74 75 String isResetPageNumber = atts.getValue(ATTRIBUTE_isResetPageNumber); 76 if (isResetPageNumber != null && isResetPageNumber.length() > 0) 77 { 78 group.setResetPageNumber(Boolean.valueOf(isResetPageNumber).booleanValue()); 79 } 80 81 String isReprintHeaderOnEachPage = atts.getValue(ATTRIBUTE_isReprintHeaderOnEachPage); 82 if (isReprintHeaderOnEachPage != null && isReprintHeaderOnEachPage.length() > 0) 83 { 84 group.setReprintHeaderOnEachPage(Boolean.valueOf(isReprintHeaderOnEachPage).booleanValue()); 85 } 86 87 String minHeightToStartNewPage = atts.getValue(ATTRIBUTE_minHeightToStartNewPage); 88 if (minHeightToStartNewPage != null && minHeightToStartNewPage.length() > 0) 89 { 90 group.setMinHeightToStartNewPage(Integer.parseInt(minHeightToStartNewPage)); 91 } 92 93 return group; 94 } 95 96 97 } 98 | Popular Tags |