package net.sf.jasperreports.crosstabs.design;

import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabCell;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;

public class JRDesignCrosstabCell extends JRBaseCrosstabCell implements JRChangeEventsSupport {
  private static final long serialVersionUID = 10200L;
  
  public static final String PROPERTY_COLUMN_TOTAL_GROUP = "columnTotalGroup";
  
  public static final String PROPERTY_CONTENTS = "contents";
  
  public static final String PROPERTY_HEIGHT = "height";
  
  public static final String PROPERTY_ROW_TOTAL_GROUP = "rowTotalGroup";
  
  public static final String PROPERTY_WIDTH = "width";
  
  private transient JRPropertyChangeSupport eventSupport;
  
  public void setColumnTotalGroup(String columnTotalGroup) {
    Object old = this.columnTotalGroup;
    this.columnTotalGroup = columnTotalGroup;
    getEventSupport().firePropertyChange("columnTotalGroup", old, this.columnTotalGroup);
  }
  
  public void setContents(JRDesignCellContents contents) {
    Object old = this.contents;
    if (contents == null)
      contents = new JRDesignCellContents(); 
    this.contents = contents;
    getEventSupport().firePropertyChange("contents", old, this.contents);
  }
  
  public void setRowTotalGroup(String rowTotalGroup) {
    Object old = this.rowTotalGroup;
    this.rowTotalGroup = rowTotalGroup;
    getEventSupport().firePropertyChange("rowTotalGroup", old, this.rowTotalGroup);
  }
  
  public void setWidth(Integer width) {
    Object old = this.width;
    this.width = width;
    getEventSupport().firePropertyChange("width", old, this.width);
  }
  
  public void setHeight(Integer height) {
    Object old = this.height;
    this.height = height;
    getEventSupport().firePropertyChange("height", old, this.height);
  }
  
  public JRPropertyChangeSupport getEventSupport() {
    synchronized (this) {
      if (this.eventSupport == null)
        this.eventSupport = new JRPropertyChangeSupport(this); 
    } 
    return this.eventSupport;
  }
}
