1 28 package net.sf.jasperreports.charts.xml; 29 30 import net.sf.jasperreports.charts.design.JRDesignBarPlot; 31 import net.sf.jasperreports.engine.JRChart; 32 import net.sf.jasperreports.engine.xml.JRBaseFactory; 33 34 import org.xml.sax.Attributes ; 35 36 37 41 public class JRBarPlotFactory extends JRBaseFactory 42 { 43 private static final String ATTRIBUTE_isShowTickMarks = "isShowTickMarks"; 44 private static final String ATTRIBUTE_isShowTickLabels = "isShowTickLabels"; 45 private static final String ATTRIBUTE_isShowLabels = "isShowLabels"; 46 47 public Object createObject(Attributes atts) 48 { 49 JRChart chart = (JRChart) digester.peek(); 50 JRDesignBarPlot plot = (JRDesignBarPlot)chart.getPlot(); 51 52 String isShowTickMarks = atts.getValue(ATTRIBUTE_isShowTickMarks); 53 if (isShowTickMarks != null && isShowTickMarks.length() > 0) { 54 plot.setShowTickMarks(Boolean.valueOf(isShowTickMarks).booleanValue()); 55 } 56 57 String isShowTickLabels = atts.getValue(ATTRIBUTE_isShowTickLabels); 58 if (isShowTickLabels != null && isShowTickLabels.length() > 0) { 59 plot.setShowTickLabels(Boolean.valueOf(isShowTickLabels).booleanValue()); 60 } 61 62 String isShowLabels = atts.getValue( ATTRIBUTE_isShowLabels ); 63 if( isShowLabels != null && isShowLabels.length() > 0 ){ 64 plot.setShowLabels(Boolean.valueOf(isShowLabels).booleanValue()); 65 } 66 67 return plot; 68 } 69 } 70 | Popular Tags |