001: /*
002: * ============================================================================
003: * GNU Lesser General Public License
004: * ============================================================================
005: *
006: * JasperReports - Free Java report-generating library.
007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
022: *
023: * JasperSoft Corporation
024: * 303 Second Street, Suite 450 North
025: * San Francisco, CA 94107
026: * http://www.jaspersoft.com
027: */
028: package net.sf.jasperreports.engine.fill;
029:
030: import java.awt.Color;
031:
032: import net.sf.jasperreports.engine.JRBox;
033: import net.sf.jasperreports.engine.JRConstants;
034: import net.sf.jasperreports.engine.JRDefaultStyleProvider;
035: import net.sf.jasperreports.engine.JRElement;
036: import net.sf.jasperreports.engine.util.JRStyleResolver;
037:
038: /**
039: * Frame information shared by multiple print frame objects.
040: *
041: * @author Lucian Chirita (lucianc@users.sourceforge.net)
042: * @version $Id: JRTemplateFrame.java 1307 2006-06-20 16:01:54Z teodord $
043: * @see net.sf.jasperreports.engine.fill.JRTemplatePrintFrame
044: */
045: public class JRTemplateFrame extends JRTemplateElement implements JRBox {
046: private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
047:
048: /**
049: * Creates a template frame for a crosstab cell.
050: *
051: * @param cell the cell
052: */
053: public JRTemplateFrame(JRDefaultStyleProvider defaultStyleProvider,
054: JRFillCellContents cell) {
055: super (defaultStyleProvider);
056:
057: parentStyle = cell.getStyle();
058:
059: setBackcolor(cell.getBackcolor());
060: setMode(cell.getMode());
061: setBox(cell.getBox());
062: }
063:
064: /**
065: * Creates a template frame for a frame.
066: *
067: * @param frame the frame
068: */
069: public JRTemplateFrame(JRDefaultStyleProvider defaultStyleProvider,
070: JRFillFrame frame) {
071: super (defaultStyleProvider);
072:
073: setElement(frame);
074: setBox(frame);
075: }
076:
077: /**
078: *
079: */
080: public byte getMode() {
081: return JRStyleResolver
082: .getMode(this , JRElement.MODE_TRANSPARENT);
083: }
084:
085: /**
086: * Sets the border of this template frame.
087: *
088: * @param box the border
089: */
090: protected void setBox(JRBox box) {
091: if (box != null) {
092: border = box.getOwnBorder();
093: topBorder = box.getOwnTopBorder();
094: leftBorder = box.getOwnLeftBorder();
095: bottomBorder = box.getOwnBottomBorder();
096: rightBorder = box.getOwnRightBorder();
097: borderColor = box.getOwnBorderColor();
098: topBorderColor = box.getOwnTopBorderColor();
099: leftBorderColor = box.getOwnLeftBorderColor();
100: bottomBorderColor = box.getOwnBottomBorderColor();
101: rightBorderColor = box.getOwnRightBorderColor();
102: padding = box.getOwnPadding();
103: topPadding = box.getOwnTopPadding();
104: leftPadding = box.getOwnLeftPadding();
105: bottomPadding = box.getOwnBottomPadding();
106: rightPadding = box.getOwnRightPadding();
107: }
108: }
109:
110: //box
111: protected Byte border;
112: protected Byte topBorder = null;
113: protected Byte leftBorder = null;
114: protected Byte bottomBorder = null;
115: protected Byte rightBorder = null;
116: protected Color borderColor = null;
117: protected Color topBorderColor = null;
118: protected Color leftBorderColor = null;
119: protected Color bottomBorderColor = null;
120: protected Color rightBorderColor = null;
121: protected Integer padding;
122: protected Integer topPadding = null;
123: protected Integer leftPadding = null;
124: protected Integer bottomPadding = null;
125: protected Integer rightPadding = null;
126:
127: /**
128: *
129: */
130: public byte getBorder() {
131: return JRStyleResolver.getBorder(this );
132: }
133:
134: public Byte getOwnBorder() {
135: return border;
136: }
137:
138: /**
139: *
140: */
141: public void setBorder(byte border) {
142: this .border = new Byte(border);
143: }
144:
145: /**
146: *
147: */
148: public Color getBorderColor() {
149: return JRStyleResolver.getBorderColor(this , getForecolor());
150: }
151:
152: public Color getOwnBorderColor() {
153: return borderColor;
154: }
155:
156: /**
157: *
158: */
159: public void setBorderColor(Color borderColor) {
160: this .borderColor = borderColor;
161: }
162:
163: /**
164: *
165: */
166: public int getPadding() {
167: return JRStyleResolver.getPadding(this );
168: }
169:
170: public Integer getOwnPadding() {
171: return padding;
172: }
173:
174: /**
175: *
176: */
177: public void setPadding(int padding) {
178: this .padding = new Integer(padding);
179: }
180:
181: /**
182: *
183: */
184: public byte getTopBorder() {
185: return JRStyleResolver.getTopBorder(this );
186: }
187:
188: /**
189: *
190: */
191: public Byte getOwnTopBorder() {
192: return topBorder;
193: }
194:
195: /**
196: *
197: */
198: public void setTopBorder(byte topBorder) {
199: this .topBorder = new Byte(topBorder);
200: }
201:
202: /**
203: *
204: */
205: public Color getTopBorderColor() {
206: return JRStyleResolver.getTopBorderColor(this , getForecolor());
207: }
208:
209: /**
210: *
211: */
212: public Color getOwnTopBorderColor() {
213: return topBorderColor;
214: }
215:
216: /**
217: *
218: */
219: public void setTopBorderColor(Color topBorderColor) {
220: this .topBorderColor = topBorderColor;
221: }
222:
223: /**
224: *
225: */
226: public int getTopPadding() {
227: return JRStyleResolver.getTopPadding(this );
228: }
229:
230: /**
231: *
232: */
233: public Integer getOwnTopPadding() {
234: return topPadding;
235: }
236:
237: /**
238: *
239: */
240: public void setTopPadding(int topPadding) {
241: this .topPadding = new Integer(topPadding);
242: }
243:
244: /**
245: *
246: */
247: public byte getLeftBorder() {
248: return JRStyleResolver.getLeftBorder(this );
249: }
250:
251: /**
252: *
253: */
254: public Byte getOwnLeftBorder() {
255: return leftBorder;
256: }
257:
258: /**
259: *
260: */
261: public void setLeftBorder(byte leftBorder) {
262: this .leftBorder = new Byte(leftBorder);
263: }
264:
265: /**
266: *
267: */
268: public Color getLeftBorderColor() {
269: return JRStyleResolver.getLeftBorderColor(this , getForecolor());
270: }
271:
272: /**
273: *
274: */
275: public Color getOwnLeftBorderColor() {
276: return leftBorderColor;
277: }
278:
279: /**
280: *
281: */
282: public void setLeftBorderColor(Color leftBorderColor) {
283: this .leftBorderColor = leftBorderColor;
284: }
285:
286: /**
287: *
288: */
289: public int getLeftPadding() {
290: return JRStyleResolver.getLeftPadding(this );
291: }
292:
293: /**
294: *
295: */
296: public Integer getOwnLeftPadding() {
297: return leftPadding;
298: }
299:
300: /**
301: *
302: */
303: public void setLeftPadding(int leftPadding) {
304: this .leftPadding = new Integer(leftPadding);
305: }
306:
307: /**
308: *
309: */
310: public byte getBottomBorder() {
311: return JRStyleResolver.getBottomBorder(this );
312: }
313:
314: /**
315: *
316: */
317: public Byte getOwnBottomBorder() {
318: return bottomBorder;
319: }
320:
321: /**
322: *
323: */
324: public void setBottomBorder(byte bottomBorder) {
325: this .bottomBorder = new Byte(bottomBorder);
326: }
327:
328: /**
329: *
330: */
331: public Color getBottomBorderColor() {
332: return JRStyleResolver.getBottomBorderColor(this ,
333: getForecolor());
334: }
335:
336: /**
337: *
338: */
339: public Color getOwnBottomBorderColor() {
340: return bottomBorderColor;
341: }
342:
343: /**
344: *
345: */
346: public void setBottomBorderColor(Color bottomBorderColor) {
347: this .bottomBorderColor = bottomBorderColor;
348: }
349:
350: /**
351: *
352: */
353: public int getBottomPadding() {
354: return JRStyleResolver.getBottomPadding(this );
355: }
356:
357: /**
358: *
359: */
360: public Integer getOwnBottomPadding() {
361: return bottomPadding;
362: }
363:
364: /**
365: *
366: */
367: public void setBottomPadding(int bottomPadding) {
368: this .bottomPadding = new Integer(bottomPadding);
369: }
370:
371: /**
372: *
373: */
374: public byte getRightBorder() {
375: return JRStyleResolver.getRightBorder(this );
376: }
377:
378: /**
379: *
380: */
381: public Byte getOwnRightBorder() {
382: return rightBorder;
383: }
384:
385: /**
386: *
387: */
388: public void setRightBorder(byte rightBorder) {
389: this .rightBorder = new Byte(rightBorder);
390: }
391:
392: /**
393: *
394: */
395: public Color getRightBorderColor() {
396: return JRStyleResolver
397: .getRightBorderColor(this , getForecolor());
398: }
399:
400: /**
401: *
402: */
403: public Color getOwnRightBorderColor() {
404: return rightBorderColor;
405: }
406:
407: /**
408: *
409: */
410: public void setRightBorderColor(Color rightBorderColor) {
411: this .rightBorderColor = rightBorderColor;
412: }
413:
414: /**
415: *
416: */
417: public int getRightPadding() {
418: return JRStyleResolver.getRightPadding(this );
419: }
420:
421: /**
422: *
423: */
424: public Integer getOwnRightPadding() {
425: return rightPadding;
426: }
427:
428: /**
429: *
430: */
431: public void setRightPadding(int rightPadding) {
432: this .rightPadding = new Integer(rightPadding);
433: }
434:
435: /**
436: *
437: */
438: public void setBorder(Byte border) {
439: this .border = border;
440: }
441:
442: /**
443: *
444: */
445: public void setPadding(Integer padding) {
446: this .padding = padding;
447: }
448:
449: /**
450: *
451: */
452: public void setTopBorder(Byte topBorder) {
453: this .topBorder = topBorder;
454: }
455:
456: /**
457: *
458: */
459: public void setTopPadding(Integer topPadding) {
460: this .topPadding = topPadding;
461: }
462:
463: /**
464: *
465: */
466: public void setLeftBorder(Byte leftBorder) {
467: this .leftBorder = leftBorder;
468: }
469:
470: /**
471: *
472: */
473: public void setLeftPadding(Integer leftPadding) {
474: this .leftPadding = leftPadding;
475: }
476:
477: /**
478: *
479: */
480: public void setBottomBorder(Byte bottomBorder) {
481: this .bottomBorder = bottomBorder;
482: }
483:
484: /**
485: *
486: */
487: public void setBottomPadding(Integer bottomPadding) {
488: this .bottomPadding = bottomPadding;
489: }
490:
491: /**
492: *
493: */
494: public void setRightBorder(Byte rightBorder) {
495: this .rightBorder = rightBorder;
496: }
497:
498: /**
499: *
500: */
501: public void setRightPadding(Integer rightPadding) {
502: this.rightPadding = rightPadding;
503: }
504:
505: }
|