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.export;
029:
030: import java.awt.Color;
031:
032: import net.sf.jasperreports.engine.JRBox;
033: import net.sf.jasperreports.engine.JRElement;
034: import net.sf.jasperreports.engine.JRPrintElement;
035: import net.sf.jasperreports.engine.base.JRBasePrintElement;
036:
037: /**
038: * @author Teodor Danciu (teodord@users.sourceforge.net)
039: * @version $Id: JRExporterGridCell.java 1696 2007-04-02 12:14:28Z lucianc $
040: */
041: public class JRExporterGridCell {
042:
043: /**
044: *
045: */
046: public static final JRExporterGridCell OCCUPIED_CELL = new JRExporterGridCell(
047: new ElementWrapper(new JRBasePrintElement(null), null, null),
048: 0, 0, 1, 1);
049:
050: /**
051: *
052: */
053: private ElementWrapper wrapper = null;
054:
055: private Color backcolor;
056: private Color forecolor;
057: private JRBox box;
058:
059: private int width = 0;
060: private int height = 0;
061: private int colSpan = 0;
062: private int rowSpan = 0;
063:
064: private JRGridLayout layout = null;
065:
066: /**
067: *
068: */
069: public JRExporterGridCell(ElementWrapper wrapper, int width,
070: int height, int colSpan, int rowSpan) {
071: this .wrapper = wrapper;
072: this .width = width;
073: this .height = height;
074: this .colSpan = colSpan;
075: this .rowSpan = rowSpan;
076: }
077:
078: public ElementWrapper getWrapper() {
079: return wrapper;
080: }
081:
082: public JRPrintElement getElement() {
083: return wrapper == null ? null : wrapper.getElement();
084: }
085:
086: public int getWidth() {
087: return width;
088: }
089:
090: public void setWidth(int width) {
091: this .width = width;
092: }
093:
094: public int getHeight() {
095: return height;
096: }
097:
098: public int getColSpan() {
099: return colSpan;
100: }
101:
102: public void setColSpan(int colSpan) {
103: this .colSpan = colSpan;
104: }
105:
106: public int getRowSpan() {
107: return rowSpan;
108: }
109:
110: public JRGridLayout getLayout() {
111: return layout;
112: }
113:
114: public void setLayout(JRGridLayout layout) {
115: this .layout = layout;
116: }
117:
118: public Color getBackcolor() {
119: return backcolor;
120: }
121:
122: public void setBackcolor(Color backcolor) {
123: this .backcolor = backcolor;
124: }
125:
126: public JRBox getBox() {
127: return box;
128: }
129:
130: public void setBox(JRBox box) {
131: this .box = box;
132: }
133:
134: public Color getForecolor() {
135: return forecolor;
136: }
137:
138: public void setForecolor(Color forecolor) {
139: this .forecolor = forecolor;
140: }
141:
142: public Color getCellBackcolor() {
143: Color color;
144: JRPrintElement element = getElement();
145: if (element != null
146: && element.getMode() == JRElement.MODE_OPAQUE) {
147: color = element.getBackcolor();
148: } else {
149: color = backcolor;
150: }
151: return color;
152: }
153:
154: public boolean isEmpty() {
155: return wrapper == null && backcolor == null && box == null;
156: }
157:
158: }
|