1 28 package net.sf.jasperreports.engine.xml; 29 30 import net.sf.jasperreports.engine.design.JRDesignTextElement; 31 32 import org.xml.sax.Attributes ; 33 34 35 39 public class JRTextElementFactory extends JRBaseFactory 40 { 41 42 43 46 private static final String ATTRIBUTE_textAlignment = "textAlignment"; 47 private static final String ATTRIBUTE_verticalAlignment = "verticalAlignment"; 48 private static final String ATTRIBUTE_rotation = "rotation"; 49 private static final String ATTRIBUTE_lineSpacing = "lineSpacing"; 50 private static final String ATTRIBUTE_isStyledText = "isStyledText"; 51 52 53 56 public Object createObject(Attributes atts) 57 { 58 JRDesignTextElement textElement = (JRDesignTextElement)digester.peek(); 59 60 Byte horizontalAlignment = (Byte )JRXmlConstants.getHorizontalAlignMap().get(atts.getValue(ATTRIBUTE_textAlignment)); 61 if (horizontalAlignment != null) 62 { 63 textElement.setHorizontalAlignment(horizontalAlignment); 64 } 65 66 Byte verticalAlignment = (Byte )JRXmlConstants.getVerticalAlignMap().get(atts.getValue(ATTRIBUTE_verticalAlignment)); 67 if (verticalAlignment != null) 68 { 69 textElement.setVerticalAlignment(verticalAlignment); 70 } 71 72 Byte rotation = (Byte )JRXmlConstants.getRotationMap().get(atts.getValue(ATTRIBUTE_rotation)); 73 if (rotation != null) 74 { 75 textElement.setRotation(rotation); 76 } 77 78 Byte lineSpacing = (Byte )JRXmlConstants.getLineSpacingMap().get(atts.getValue(ATTRIBUTE_lineSpacing)); 79 if (lineSpacing != null) 80 { 81 textElement.setLineSpacing(lineSpacing); 82 } 83 84 String isStyledText = atts.getValue(ATTRIBUTE_isStyledText); 85 if (isStyledText != null && isStyledText.length() > 0) 86 { 87 textElement.setStyledText(Boolean.valueOf(isStyledText)); 88 } 89 90 return textElement; 91 } 92 93 94 } 95 | Popular Tags |