package net.sf.jasperreports.engine.design;

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

public class JRDesignExpressionChunk extends JRBaseExpressionChunk implements JRChangeEventsSupport {
  private static final long serialVersionUID = 10200L;
  
  public static final String PROPERTY_TEXT = "text";
  
  public static final String PROPERTY_TYPE = "type";
  
  private transient JRPropertyChangeSupport eventSupport;
  
  public void setType(byte type) {
    byte old = this.type;
    this.type = type;
    getEventSupport().firePropertyChange("type", old, this.type);
  }
  
  public void setText(String text) {
    Object old = this.text;
    this.text = text;
    getEventSupport().firePropertyChange("text", old, this.text);
  }
  
  public JRPropertyChangeSupport getEventSupport() {
    synchronized (this) {
      if (this.eventSupport == null)
        this.eventSupport = new JRPropertyChangeSupport(this); 
    } 
    return this.eventSupport;
  }
}
