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.base;
029:
030: import java.io.Serializable;
031:
032: import net.sf.jasperreports.engine.JRConstants;
033: import net.sf.jasperreports.engine.JRSubreportReturnValue;
034: import net.sf.jasperreports.engine.JRVariable;
035:
036: /**
037: * Base implementation of {@link net.sf.jasperreports.engine.JRSubreportReturnValue JRSubreportReturnValue}.
038: *
039: * @author Lucian Chirita (lucianc@users.sourceforge.net)
040: * @version $Id: JRBaseSubreportReturnValue.java 1229 2006-04-19 10:27:35Z teodord $
041: */
042: public class JRBaseSubreportReturnValue implements
043: JRSubreportReturnValue, Serializable {
044:
045: /**
046: *
047: */
048: private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
049:
050: /**
051: * The name of the subreport variable to be copied.
052: */
053: protected String subreportVariable = null;
054:
055: /**
056: * The name of the master variable where the value should be copied.
057: */
058: protected String toVariable = null;
059:
060: /**
061: * The calculation type.
062: */
063: protected byte calculation = JRVariable.CALCULATION_NOTHING;
064:
065: /**
066: * The incrementer factory class name.
067: */
068: protected String incrementerFactoryClassName = null;
069:
070: protected JRBaseSubreportReturnValue() {
071: }
072:
073: protected JRBaseSubreportReturnValue(
074: JRSubreportReturnValue returnValue,
075: JRBaseObjectFactory factory) {
076: factory.put(returnValue, this );
077:
078: subreportVariable = returnValue.getSubreportVariable();
079: toVariable = returnValue.getToVariable();
080: calculation = returnValue.getCalculation();
081: incrementerFactoryClassName = returnValue
082: .getIncrementerFactoryClassName();
083: }
084:
085: /**
086: * Returns the name of the subreport variable whose value should be copied.
087: *
088: * @return the name of the subreport variable whose value should be copied.
089: */
090: public String getSubreportVariable() {
091: return this .subreportVariable;
092: }
093:
094: /**
095: * Returns the name of the master report variable where the value should be copied.
096: *
097: * @return the name of the master report variable where the value should be copied.
098: */
099: public String getToVariable() {
100: return this .toVariable;
101: }
102:
103: /**
104: * Returns the calculation type.
105: * <p>
106: * When copying the value from the subreport, a formula can be applied such that sum,
107: * maximum, average and so on can be computed.
108: *
109: * @return the calculation type.
110: */
111: public byte getCalculation() {
112: return calculation;
113: }
114:
115: /**
116: * Returns the incrementer factory class name.
117: * <p>
118: * The factory will be used to increment the value of the master report variable
119: * with the value from the subreport.
120: *
121: * @return the incrementer factory class name.
122: */
123: public String getIncrementerFactoryClassName() {
124: return incrementerFactoryClassName;
125: }
126:
127: }
|