1 28 package net.sf.jasperreports.engine.xml; 29 30 import net.sf.jasperreports.engine.design.JRDesignParameter; 31 32 import org.xml.sax.Attributes ; 33 34 35 39 public class JRParameterFactory extends JRBaseFactory 40 { 41 42 43 46 private static final String ATTRIBUTE_name = "name"; 47 private static final String ATTRIBUTE_class = "class"; 48 private static final String ATTRIBUTE_isForPrompting = "isForPrompting"; 49 50 51 54 public Object createObject(Attributes atts) 55 { 56 JRDesignParameter parameter = new JRDesignParameter(); 57 58 setParameterAttributes(parameter, atts); 59 60 return parameter; 61 } 62 63 64 protected void setParameterAttributes(JRDesignParameter parameter, Attributes atts) 65 { 66 parameter.setName(atts.getValue(ATTRIBUTE_name)); 67 68 if (atts.getValue(ATTRIBUTE_class) != null) 69 { 70 parameter.setValueClassName(atts.getValue(ATTRIBUTE_class)); 71 } 72 73 String isForPrompting = atts.getValue(ATTRIBUTE_isForPrompting); 74 if (isForPrompting != null && isForPrompting.length() > 0) 75 { 76 parameter.setForPrompting(Boolean.valueOf(isForPrompting).booleanValue()); 77 } 78 } 79 80 81 } 82 | Popular Tags |