1 28 package net.sf.jasperreports.engine.fill; 29 30 import java.io.IOException ; 31 32 import net.sf.jasperreports.engine.JRAbstractObjectFactory; 33 import net.sf.jasperreports.engine.JRChild; 34 import net.sf.jasperreports.engine.JRException; 35 import net.sf.jasperreports.engine.JRExpressionCollector; 36 import net.sf.jasperreports.engine.JRPrintElement; 37 import net.sf.jasperreports.engine.JRPrintRectangle; 38 import net.sf.jasperreports.engine.JRRectangle; 39 import net.sf.jasperreports.engine.JRStyle; 40 import net.sf.jasperreports.engine.util.JRStyleResolver; 41 import net.sf.jasperreports.engine.xml.JRXmlWriter; 42 43 44 48 public class JRFillRectangle extends JRFillGraphicElement implements JRRectangle 49 { 50 51 52 55 protected JRFillRectangle( 56 JRBaseFiller filler, 57 JRRectangle rectangle, 58 JRFillObjectFactory factory 59 ) 60 { 61 super(filler, rectangle, factory); 62 } 63 64 65 protected JRFillRectangle(JRFillRectangle rectangle, JRFillCloneFactory factory) 66 { 67 super(rectangle, factory); 68 } 69 70 71 74 public int getRadius() 75 { 76 return JRStyleResolver.getRadius(this); 77 } 78 79 public Integer getOwnRadius() 80 { 81 return ((JRRectangle)this.parent).getOwnRadius(); 82 } 83 84 87 public void setRadius(int radius) 88 { 89 } 90 91 94 public void setRadius(Integer radius) 95 { 96 } 97 98 101 protected JRTemplateRectangle getJRTemplateRectangle() 102 { 103 JRStyle style = getStyle(); 104 JRTemplateRectangle template = (JRTemplateRectangle) getTemplate(style); 105 if (template == null) 106 { 107 template = new JRTemplateRectangle(filler.getJasperPrint().getDefaultStyleProvider(), this); 108 registerTemplate(style, template); 109 } 110 return template; 111 } 112 113 114 117 protected void evaluate( 118 byte evaluation 119 ) throws JRException 120 { 121 this.reset(); 122 123 this.evaluatePrintWhenExpression(evaluation); 124 125 setValueRepeating(true); 126 } 127 128 129 132 protected JRPrintElement fill() 133 { 134 JRPrintRectangle printRectangle = null; 135 136 printRectangle = new JRTemplatePrintRectangle(this.getJRTemplateRectangle()); 137 printRectangle.setX(this.getX()); 138 printRectangle.setY(this.getRelativeY()); 139 printRectangle.setWidth(getWidth()); 140 printRectangle.setHeight(this.getStretchHeight()); 141 142 return printRectangle; 143 } 144 145 146 149 public JRChild getCopy(JRAbstractObjectFactory factory) 150 { 151 return factory.getRectangle(this); 152 } 153 154 157 public void collectExpressions(JRExpressionCollector collector) 158 { 159 collector.collect(this); 160 } 161 162 165 public void writeXml(JRXmlWriter xmlWrite) throws IOException 166 { 167 xmlWrite.writeRectangle(this); 168 } 169 170 173 protected void resolveElement (JRPrintElement element, byte evaluation) 174 { 175 } 177 178 179 public JRCloneable createClone(JRFillCloneFactory factory) 180 { 181 return new JRFillRectangle(this, factory); 182 } 183 184 } 185 | Popular Tags |