KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > fill > JRFillRectangle


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine.fill;
29
30 import java.io.IOException JavaDoc;
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 /**
45  * @author Teodor Danciu (teodord@users.sourceforge.net)
46  * @version $Id: JRFillRectangle.java 1357 2006-08-10 12:36:24 +0300 (Thu, 10 Aug 2006) lucianc $
47  */

48 public class JRFillRectangle extends JRFillGraphicElement implements JRRectangle
49 {
50
51
52     /**
53      *
54      */

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     /**
72      *
73      */

74     public int getRadius()
75     {
76         return JRStyleResolver.getRadius(this);
77     }
78         
79     public Integer JavaDoc getOwnRadius()
80     {
81         return ((JRRectangle)this.parent).getOwnRadius();
82     }
83
84     /**
85      *
86      */

87     public void setRadius(int radius)
88     {
89     }
90
91     /**
92      *
93      */

94     public void setRadius(Integer JavaDoc radius)
95     {
96     }
97
98     /**
99      *
100      */

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     /**
115      *
116      */

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     /**
130      *
131      */

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     /**
147      *
148      */

149     public JRChild getCopy(JRAbstractObjectFactory factory)
150     {
151         return factory.getRectangle(this);
152     }
153
154     /**
155      *
156      */

157     public void collectExpressions(JRExpressionCollector collector)
158     {
159         collector.collect(this);
160     }
161
162     /**
163      *
164      */

165     public void writeXml(JRXmlWriter xmlWrite) throws IOException JavaDoc
166     {
167         xmlWrite.writeRectangle(this);
168     }
169
170     /**
171      *
172      */

173     protected void resolveElement (JRPrintElement element, byte evaluation)
174     {
175         // nothing
176
}
177
178
179     public JRCloneable createClone(JRFillCloneFactory factory)
180     {
181         return new JRFillRectangle(this, factory);
182     }
183
184 }
185
Popular Tags