1 28 package net.sf.jasperreports.engine.xml; 29 30 import net.sf.jasperreports.engine.design.JRDesignDataset; 31 32 import org.xml.sax.Attributes ; 33 34 38 public class JRDatasetFactory extends JRBaseFactory 39 { 40 public static final String ELEMENT_subDataset = "subDataset"; 41 public static final String ELEMENT_filterExpression = "filterExpression"; 42 43 public static final String ATTRIBUTE_name = "name"; 44 public static final String ATTRIBUTE_scriptletClass = "scriptletClass"; 45 public static final String ATTRIBUTE_resourceBundle = "resourceBundle"; 46 public static final String ATTRIBUTE_whenResourceMissingType = "whenResourceMissingType"; 47 48 49 public Object createObject(Attributes attributes) 50 { 51 JRDesignDataset dataset = new JRDesignDataset(false); 52 53 dataset.setName(attributes.getValue(ATTRIBUTE_name)); 54 dataset.setScriptletClass(attributes.getValue(ATTRIBUTE_scriptletClass)); 55 56 dataset.setResourceBundle(attributes.getValue(ATTRIBUTE_resourceBundle)); 57 58 String resMissingAttr = attributes.getValue(ATTRIBUTE_whenResourceMissingType); 59 if (resMissingAttr != null && resMissingAttr.length() > 0) 60 { 61 Byte whenResourceMissingType = (Byte ) JRXmlConstants.getWhenResourceMissingTypeMap().get(resMissingAttr); 62 dataset.setWhenResourceMissingType(whenResourceMissingType.byteValue()); 63 } 64 65 return dataset; 66 } 67 } 68 | Popular Tags |