KickJava   Java API By Example, From Geeks To Geeks.

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


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 net.sf.jasperreports.engine.JRException;
31 import net.sf.jasperreports.engine.JRGraphicElement;
32 import net.sf.jasperreports.engine.util.JRStyleResolver;
33
34
35 /**
36  * @author Teodor Danciu (teodord@users.sourceforge.net)
37  * @version $Id: JRFillGraphicElement.java 1281 2006-06-07 15:33:25 +0300 (Wed, 07 Jun 2006) teodord $
38  */

39 public abstract class JRFillGraphicElement extends JRFillElement implements JRGraphicElement
40 {
41
42
43     /**
44      *
45      */

46     protected JRFillGraphicElement(
47         JRBaseFiller filler,
48         JRGraphicElement graphicElement,
49         JRFillObjectFactory factory
50         )
51     {
52         super(filler, graphicElement, factory);
53     }
54
55
56     protected JRFillGraphicElement(
57         JRFillGraphicElement graphicElement,
58         JRFillCloneFactory factory
59         )
60     {
61         super(graphicElement, factory);
62     }
63     
64
65     /**
66      *
67      */

68     public byte getPen()
69     {
70         return JRStyleResolver.getPen(this, PEN_1_POINT);
71     }
72     
73     /**
74      *
75      */

76     public Byte JavaDoc getOwnPen()
77     {
78         return ((JRGraphicElement)this.parent).getOwnPen();
79     }
80
81     /**
82      *
83      */

84     public void setPen(byte pen)
85     {
86     }
87     
88     /**
89      *
90      */

91     public void setPen(Byte JavaDoc pen)
92     {
93     }
94     
95     /**
96      *
97      */

98     public byte getFill()
99     {
100         return JRStyleResolver.getFill(this, FILL_SOLID);
101     }
102
103     /**
104      *
105      */

106     public Byte JavaDoc getOwnFill()
107     {
108         return ((JRGraphicElement)this.parent).getOwnFill();
109     }
110
111     /**
112      *
113      */

114     public void setFill(byte fill)
115     {
116     }
117     
118     /**
119      *
120      */

121     public void setFill(Byte JavaDoc fill)
122     {
123     }
124     
125
126     /**
127      *
128      */

129     public void rewind()
130     {
131     }
132
133
134     /**
135      *
136      */

137     protected boolean prepare(
138         int availableStretchHeight,
139         boolean isOverflow
140         ) throws JRException
141     {
142         boolean willOverflow = false;
143
144         super.prepare(availableStretchHeight, isOverflow);
145         
146         if (!this.isToPrint())
147         {
148             return willOverflow;
149         }
150         
151         boolean isToPrint = true;
152         boolean isReprinted = false;
153
154         if (isOverflow && this.isAlreadyPrinted() && !this.isPrintWhenDetailOverflows())
155         {
156             isToPrint = false;
157         }
158
159         if (
160             isToPrint &&
161             this.isPrintWhenExpressionNull() &&
162             !this.isPrintRepeatedValues()
163             )
164         {
165             if (
166                 ( !this.isPrintInFirstWholeBand() || !this.getBand().isFirstWholeOnPageColumn() ) &&
167                 ( this.getPrintWhenGroupChanges() == null || !this.getBand().isNewGroup(this.getPrintWhenGroupChanges()) ) &&
168                 ( !isOverflow || !this.isPrintWhenDetailOverflows() )
169                 )
170             {
171                 isToPrint = false;
172             }
173         }
174
175         if (
176             isToPrint &&
177             availableStretchHeight < this.getRelativeY() - this.getY() - this.getBandBottomY()
178             )
179         {
180             isToPrint = false;
181             willOverflow = true;
182         }
183         
184         if (
185             isToPrint &&
186             isOverflow &&
187             //(this.isAlreadyPrinted() || !this.isPrintRepeatedValues())
188
(this.isPrintWhenDetailOverflows() && (this.isAlreadyPrinted() || (!this.isAlreadyPrinted() && !this.isPrintRepeatedValues())))
189             )
190         {
191             isReprinted = true;
192         }
193
194         this.setToPrint(isToPrint);
195         this.setReprinted(isReprinted);
196         
197         return willOverflow;
198     }
199     
200     
201 }
202
Popular Tags