1 28 package net.sf.jasperreports.charts.xml; 29 30 import net.sf.jasperreports.charts.util.JRMeterInterval; 31 import net.sf.jasperreports.engine.xml.JRBaseFactory; 32 import net.sf.jasperreports.engine.xml.JRXmlConstants; 33 34 import org.xml.sax.Attributes ; 35 36 37 41 public class JRMeterIntervalFactory extends JRBaseFactory 42 { 43 private static final String ATTRIBUTE_label = "label"; 44 private static final String ATTRIBUTE_color = "color"; 45 private static final String ATTRIBUTE_alpha = "alpha"; 46 47 50 public Object createObject(Attributes atts) 51 { 52 JRMeterInterval interval = new JRMeterInterval(); 53 54 String value = atts.getValue(ATTRIBUTE_label); 55 if (value != null && value.length() > 0) 56 { 57 interval.setLabel(value); 58 } 59 60 value = atts.getValue(ATTRIBUTE_color); 61 if (value != null && value.length() > 0) 62 { 63 interval.setBackgroundColor(JRXmlConstants.getColor(value, null)); 64 } 65 66 value = atts.getValue(ATTRIBUTE_alpha); 67 if (value != null && value.length() > 0) 68 { 69 interval.setAlpha(Double.valueOf(value).doubleValue()); 70 } 71 72 return interval; 73 } 74 } 75 | Popular Tags |