Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 28 package net.sf.jasperreports.engine.xml; 29 30 import java.util.Set ; 31 32 import net.sf.jasperreports.engine.JRVariable; 33 import net.sf.jasperreports.engine.design.JRDesignElementDataset; 34 import net.sf.jasperreports.engine.design.JRDesignGroup; 35 36 import org.xml.sax.Attributes ; 37 38 39 43 public class JRElementDatasetFactory extends JRBaseFactory 44 { 45 46 public static final String ELEMENT_incrementWhenExpression = "incrementWhenExpression"; 47 48 private static final String ATTRIBUTE_resetType = "resetType"; 49 private static final String ATTRIBUTE_resetGroup = "resetGroup"; 50 private static final String ATTRIBUTE_incrementType = "incrementType"; 51 private static final String ATTRIBUTE_incrementGroup = "incrementGroup"; 52 53 54 public Object createObject(Attributes atts) 55 { 56 JRDesignElementDataset dataset = (JRDesignElementDataset) digester.peek(); 57 58 setDatasetAtts(atts, dataset); 59 60 return dataset; 61 } 62 63 protected void setDatasetAtts(Attributes atts, JRDesignElementDataset dataset) 64 { 65 JRXmlLoader xmlLoader = (JRXmlLoader)digester.peek(digester.getCount() - 1); 66 Set groupBoundDatasets = xmlLoader.getGroupBoundDatasets(); 67 68 Byte resetType = (Byte )JRXmlConstants.getResetTypeMap().get(atts.getValue(ATTRIBUTE_resetType)); 69 if (resetType != null) 70 { 71 dataset.setResetType(resetType.byteValue()); 72 } 73 if (dataset.getResetType() == JRVariable.RESET_TYPE_GROUP) 74 { 75 groupBoundDatasets.add(dataset); 76 77 String groupName = atts.getValue(ATTRIBUTE_resetGroup); 78 if (groupName != null) 79 { 80 JRDesignGroup group = new JRDesignGroup(); 81 group.setName(groupName); 82 dataset.setResetGroup(group); 83 } 84 } 85 86 Byte incrementType = (Byte )JRXmlConstants.getResetTypeMap().get(atts.getValue(ATTRIBUTE_incrementType)); 87 if (incrementType != null) 88 { 89 dataset.setIncrementType(incrementType.byteValue()); 90 } 91 if (dataset.getIncrementType() == JRVariable.RESET_TYPE_GROUP) 92 { 93 groupBoundDatasets.add(dataset); 94 95 String groupName = atts.getValue(ATTRIBUTE_incrementGroup); 96 if (groupName != null) 97 { 98 JRDesignGroup group = new JRDesignGroup(); 99 group.setName(groupName); 100 dataset.setIncrementGroup(group); 101 } 102 } 103 } 104 105 } 106
| Popular Tags
|