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 net.sf.jasperreports.engine.JasperPrint; 31 32 import org.xml.sax.Attributes ; 33 34 35 39 public class JasperPrintFactory extends JRBaseFactory 40 { 41 42 43 46 public static final String ELEMENT_jasperPrint = "jasperPrint"; 47 public static final String ATTRIBUTE_name = "name"; 48 public static final String ATTRIBUTE_pageWidth = "pageWidth"; 49 public static final String ATTRIBUTE_pageHeight = "pageHeight"; 50 public static final String ATTRIBUTE_orientation = "orientation"; 51 public static final String ATTRIBUTE_formatFactoryClass = "formatFactoryClass"; 52 public static final String ATTRIBUTE_locale = "locale"; 53 public static final String ATTRIBUTE_timezone = "timezone"; 54 55 56 59 public Object createObject(Attributes atts) 60 { 61 JasperPrint jasperPrint = new JasperPrint(); 62 63 jasperPrint.setName(atts.getValue(ATTRIBUTE_name)); 64 65 String pageWidth = atts.getValue(ATTRIBUTE_pageWidth); 66 if (pageWidth != null && pageWidth.length() > 0) 67 { 68 jasperPrint.setPageWidth(Integer.parseInt(pageWidth)); 69 } 70 71 String pageHeight = atts.getValue(ATTRIBUTE_pageHeight); 72 if (pageHeight != null && pageHeight.length() > 0) 73 { 74 jasperPrint.setPageHeight(Integer.parseInt(pageHeight)); 75 } 76 77 Byte orientation = (Byte )JRXmlConstants.getOrientationMap().get(atts.getValue(ATTRIBUTE_orientation)); 78 if (orientation != null) 79 { 80 jasperPrint.setOrientation(orientation.byteValue()); 81 } 82 83 String formatFactoryClass = atts.getValue(ATTRIBUTE_formatFactoryClass); 84 if (formatFactoryClass != null) 85 { 86 jasperPrint.setFormatFactoryClass(formatFactoryClass); 87 } 88 89 String locale = atts.getValue(ATTRIBUTE_locale); 90 if (locale != null) 91 { 92 jasperPrint.setLocaleCode(locale); 93 } 94 95 String timezone = atts.getValue(ATTRIBUTE_timezone); 96 if (timezone != null) 97 { 98 jasperPrint.setTimeZoneId(timezone); 99 } 100 101 return jasperPrint; 102 } 103 104 105 } 106
| Popular Tags
|