package net.sf.jasperreports.crosstabs.design; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabMeasure; import net.sf.jasperreports.engine.JRExpression; import net.sf.jasperreports.engine.JRVariable; import net.sf.jasperreports.engine.design.JRDesignVariable; import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport; import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport; public class JRDesignCrosstabMeasure extends JRBaseCrosstabMeasure implements JRChangeEventsSupport { private static final long serialVersionUID = 10200L; public static final String PROPERTY_CALCULATION = "calculation"; public static final String PROPERTY_INCREMENTER_FACTORY_CLASS_NAME = "incrementerFactoryClassName"; public static final String PROPERTY_NAME = "name"; public static final String PROPERTY_PERCENTAGE_CALCULATION_CLASS_NAME = "percentageCalculatorClassName"; public static final String PROPERTY_PERCENTAGE_OF_TYPE = "percentageOfType"; public static final String PROPERTY_VALUE_CLASS = "valueClassName"; public static final String PROPERTY_VALUE_EXPRESSION = "expression"; private JRDesignVariable designVariable; private transient JRPropertyChangeSupport eventSupport; public JRDesignCrosstabMeasure() { this.variable = (JRVariable)(this.designVariable = new JRDesignVariable()); this.designVariable.setCalculation((byte)8); this.designVariable.setSystemDefined(true); } public void setCalculation(byte calculation) { byte old = this.calculation; this.calculation = calculation; getEventSupport().firePropertyChange("calculation", old, this.calculation); } public void setValueExpression(JRExpression expression) { Object old = this.expression; this.expression = expression; getEventSupport().firePropertyChange("expression", old, this.expression); } public void setIncrementerFactoryClassName(String incrementerFactoryClassName) { Object old = this.incrementerFactoryClassName; this.incrementerFactoryClassName = incrementerFactoryClassName; this.incrementerFactoryClass = null; this.incrementerFactoryClassRealName = null; getEventSupport().firePropertyChange("incrementerFactoryClassName", old, this.incrementerFactoryClassName); } public void setName(String name) { Object old = this.name; this.name = name; this.designVariable.setName(name); getEventSupport().firePropertyChange("name", old, this.name); } public void setPercentageOfType(byte percentageOfType) { byte old = this.percentageOfType; this.percentageOfType = percentageOfType; getEventSupport().firePropertyChange("percentageOfType", old, this.percentageOfType); } public void setPercentageCalculatorClassName(String percentageCalculatorClassName) { Object old = this.percentageCalculatorClassName; this.percentageCalculatorClassName = percentageCalculatorClassName; this.percentageCalculatorClass = null; this.percentageCalculatorClassRealName = null; getEventSupport().firePropertyChange("percentageCalculatorClassName", old, this.percentageCalculatorClassName); } public void setValueClassName(String valueClassName) { String old = this.valueClassName; this.valueClassName = valueClassName; this.valueClass = null; this.valueClassRealName = null; this.designVariable.setValueClassName(valueClassName); getEventSupport().firePropertyChange("valueClassName", old, this.valueClassName); } public void addPropertyChangeListener(PropertyChangeListener l) { getPropertyChangeSupport().addPropertyChangeListener(l); } public void addPropertyChangeListener(String propName, PropertyChangeListener l) { getPropertyChangeSupport().addPropertyChangeListener(propName, l); } public void removePropertyChangeListener(PropertyChangeListener l) { getPropertyChangeSupport().removePropertyChangeListener(l); } public void removePropertyChangeListener(String propName, PropertyChangeListener l) { getPropertyChangeSupport().removePropertyChangeListener(propName, l); } protected PropertyChangeSupport getPropertyChangeSupport() { return (PropertyChangeSupport)getEventSupport(); } public Object clone() { return null; } public JRPropertyChangeSupport getEventSupport() { synchronized (this) { if (this.eventSupport == null) this.eventSupport = new JRPropertyChangeSupport(this); } return this.eventSupport; } }