net.sf.jasperreports.engine.design.DesignCommonReturnValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasperreports Show documentation
Show all versions of jasperreports Show documentation
Free Java Reporting Library
/*
* JasperReports - Free Java Reporting Library.
* Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
* http://www.jaspersoft.com
*
* Unless you have purchased a commercial license agreement from Jaspersoft,
* the following license terms apply:
*
* This program is part of JasperReports.
*
* JasperReports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JasperReports is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JasperReports. If not, see .
*/
package net.sf.jasperreports.engine.design;
import net.sf.jasperreports.engine.JRConstants;
import net.sf.jasperreports.engine.base.BaseCommonReturnValue;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.type.CalculationEnum;
/**
* Implementation of {@link net.sf.jasperreports.engine.ReturnValue ReturnValue}
* to be used for report design purposes.
*
* @author Lucian Chirita ([email protected])
*/
public class DesignCommonReturnValue extends BaseCommonReturnValue implements JRChangeEventsSupport
{
/**
*
*/
private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
public static final String PROPERTY_CALCULATION = "calculation";
public static final String PROPERTY_INCREMENTER_FACTORY_CLASS_NAME = "incrementerFactoryClassName";
public static final String PROPERTY_TO_VARIABLE = "toVariable";
/**
* Sets the destination variable name.
*
* @param name the variable name
* @see net.sf.jasperreports.engine.ReturnValue#getToVariable()
*/
public void setToVariable(String name)
{
Object old = this.toVariable;
this.toVariable = name;
getEventSupport().firePropertyChange(PROPERTY_TO_VARIABLE, old, this.toVariable);
}
/**
* Sets the calculation type.
*
* @param calculationValue the calculation type
* @see net.sf.jasperreports.engine.ReturnValue#getCalculation()
*/
public void setCalculation(CalculationEnum calculationValue)
{
CalculationEnum old = this.calculation;
this.calculation = calculationValue;
getEventSupport().firePropertyChange(PROPERTY_CALCULATION, old, this.calculation);
}
/**
* Sets the incrementer factory class name.
*
* @param incrementerFactoryClassName the name of the incrementer factory class
* @see net.sf.jasperreports.engine.ReturnValue#getIncrementerFactoryClassName()
*/
public void setIncrementerFactoryClassName(String incrementerFactoryClassName)
{
Object old = this.incrementerFactoryClassName;
this.incrementerFactoryClassName = incrementerFactoryClassName;
getEventSupport().firePropertyChange(PROPERTY_INCREMENTER_FACTORY_CLASS_NAME, old, this.incrementerFactoryClassName);
}
@Override
public Object clone()
{
DesignCommonReturnValue clone = (DesignCommonReturnValue)super.clone();
clone.eventSupport = null;
return clone;
}
private transient JRPropertyChangeSupport eventSupport;
@Override
public JRPropertyChangeSupport getEventSupport()
{
synchronized (this)
{
if (eventSupport == null)
{
eventSupport = new JRPropertyChangeSupport(this);
}
}
return eventSupport;
}
}