1 /*
2  * JasperReports - Free Java Reporting Library.
3  * Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
4  * http://www.jaspersoft.com
5  *
6  * Unless you have purchased a commercial license agreement from Jaspersoft,
7  * the following license terms apply:
8  *
9  * This program is part of JasperReports.
10  *
11  * JasperReports is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * JasperReports is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
23  */

24 package net.sf.jasperreports.engine.fill;
25
26 import java.awt.Color;
27
28 import net.sf.jasperreports.engine.JRBoxContainer;
29 import net.sf.jasperreports.engine.JRDefaultStyleProvider;
30 import net.sf.jasperreports.engine.JRLineBox;
31 import net.sf.jasperreports.engine.JRStyle;
32 import net.sf.jasperreports.engine.base.JRBoxPen;
33
34 /**
35  * @author Lucian Chirita (lucianc@users.sourceforge.net)
36  */

37 public class CachingLineBox implements JRLineBox
38 {
39     private final JRLineBox base;
40     
41     private final Integer padding;
42     private final Integer topPadding;
43     private final Integer bottomPadding;
44     private final Integer leftPadding;
45     private final Integer rightPadding;
46     
47     public CachingLineBox(JRLineBox base)
48     {
49         this.base = base;
50         
51         padding = base.getPadding();
52         topPadding = base.getTopPadding();
53         bottomPadding = base.getBottomPadding();
54         leftPadding = base.getLeftPadding();
55         rightPadding = base.getRightPadding();
56     }
57
58     @Override
59     public JRDefaultStyleProvider getDefaultStyleProvider()
60     {
61         return base.getDefaultStyleProvider();
62     }
63
64     @Override
65     public Float getDefaultLineWidth()
66     {
67         return base.getDefaultLineWidth();
68     }
69
70     @Override
71     public JRStyle getStyle()
72     {
73         return base.getStyle();
74     }
75
76     @Override
77     public Color getDefaultLineColor()
78     {
79         return base.getDefaultLineColor();
80     }
81
82     @Override
83     public String getStyleNameReference()
84     {
85         return base.getStyleNameReference();
86     }
87
88     @Override
89     public JRBoxContainer getBoxContainer()
90     {
91         return base.getBoxContainer();
92     }
93
94     @Override
95     public JRLineBox clone(JRBoxContainer boxContainer)
96     {
97         // cloning the base line box
98         return base.clone(boxContainer);
99     }
100
101     @Override
102     public JRBoxPen getPen()
103     {
104         return base.getPen();
105     }
106
107     @Override
108     public void copyPen(JRBoxPen pen)
109     {
110         throw new UnsupportedOperationException();
111     }
112
113     @Override
114     public JRBoxPen getTopPen()
115     {
116         return base.getTopPen();
117     }
118
119     @Override
120     public void copyTopPen(JRBoxPen topPen)
121     {
122         throw new UnsupportedOperationException();
123     }
124
125     @Override
126     public JRBoxPen getLeftPen()
127     {
128         return base.getLeftPen();
129     }
130
131     @Override
132     public void copyLeftPen(JRBoxPen leftPen)
133     {
134         throw new UnsupportedOperationException();
135     }
136
137     @Override
138     public JRBoxPen getBottomPen()
139     {
140         return base.getBottomPen();
141     }
142
143     @Override
144     public void copyBottomPen(JRBoxPen bottomPen)
145     {
146         throw new UnsupportedOperationException();
147     }
148
149     @Override
150     public JRBoxPen getRightPen()
151     {
152         return base.getRightPen();
153     }
154
155     @Override
156     public void copyRightPen(JRBoxPen rightPen)
157     {
158         throw new UnsupportedOperationException();
159     }
160
161     @Override
162     public Integer getPadding()
163     {
164         return padding;
165     }
166
167     @Override
168     public Integer getOwnPadding()
169     {
170         return base.getOwnPadding();
171     }
172
173     /**
174      * @deprecated Replaced by {@link #setPadding(Integer)}.
175      */

176     @Override
177     public void setPadding(int padding)
178     {
179         throw new UnsupportedOperationException();
180     }
181
182     @Override
183     public void setPadding(Integer padding)
184     {
185         throw new UnsupportedOperationException();
186     }
187
188     @Override
189     public Integer getTopPadding()
190     {
191         return topPadding;
192     }
193
194     @Override
195     public Integer getOwnTopPadding()
196     {
197         return base.getOwnTopPadding();
198     }
199
200     /**
201      * @deprecated Replaced by {@link #setTopPadding(Integer)}.
202      */

203     @Override
204     public void setTopPadding(int padding)
205     {
206         throw new UnsupportedOperationException();
207     }
208
209     @Override
210     public void setTopPadding(Integer padding)
211     {
212         throw new UnsupportedOperationException();
213     }
214
215     @Override
216     public Integer getLeftPadding()
217     {
218         return leftPadding;
219     }
220
221     @Override
222     public Integer getOwnLeftPadding()
223     {
224         return base.getOwnLeftPadding();
225     }
226
227     /**
228      * @deprecated Replaced by {@link #setLeftPadding(Integer)}.
229      */

230     @Override
231     public void setLeftPadding(int padding)
232     {
233         throw new UnsupportedOperationException();
234     }
235
236     @Override
237     public void setLeftPadding(Integer padding)
238     {
239         throw new UnsupportedOperationException();
240     }
241
242     @Override
243     public Integer getBottomPadding()
244     {
245         return bottomPadding;
246     }
247
248     @Override
249     public Integer getOwnBottomPadding()
250     {
251         return base.getOwnBottomPadding();
252     }
253
254     /**
255      * @deprecated Replaced by {@link #setBottomPadding(Integer)}.
256      */

257     @Override
258     public void setBottomPadding(int padding)
259     {
260         throw new UnsupportedOperationException();
261     }
262
263     @Override
264     public void setBottomPadding(Integer padding)
265     {
266         throw new UnsupportedOperationException();
267     }
268
269     @Override
270     public Integer getRightPadding()
271     {
272         return rightPadding;
273     }
274
275     @Override
276     public Integer getOwnRightPadding()
277     {
278         return base.getOwnRightPadding();
279     }
280
281     /**
282      * @deprecated Replaced by {@link #setRightPadding(Integer)}.
283      */

284     @Override
285     public void setRightPadding(int padding)
286     {
287         throw new UnsupportedOperationException();
288     }
289
290     @Override
291     public void setRightPadding(Integer padding)
292     {
293         throw new UnsupportedOperationException();
294     }
295
296 }
297