package net.sf.jasperreports.engine.base;

import net.sf.jasperreports.engine.JRAbstractObjectFactory;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRConditionalStyle;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRPenContainer;
import net.sf.jasperreports.engine.JRStyle;

public class JRBaseConditionalStyle extends JRBaseStyle implements JRConditionalStyle {
  private static final long serialVersionUID = 10200L;
  
  protected JRExpression conditionExpression = null;
  
  public JRBaseConditionalStyle() {}
  
  public JRBaseConditionalStyle(JRConditionalStyle style, JRStyle parentStyle, JRAbstractObjectFactory factory) {
    this.parentStyle = parentStyle;
    this.mode = style.getOwnMode();
    this.forecolor = style.getOwnForecolor();
    this.backcolor = style.getOwnBackcolor();
    this.linePen = style.getLinePen().clone((JRPenContainer)this);
    this.fill = style.getOwnFill();
    this.radius = style.getOwnRadius();
    this.scaleImage = style.getOwnScaleImage();
    this.horizontalAlignment = style.getOwnHorizontalAlignment();
    this.verticalAlignment = style.getOwnVerticalAlignment();
    this.lineBox = style.getLineBox().clone((JRBoxContainer)this);
    this.rotation = style.getOwnRotation();
    this.lineSpacing = style.getOwnLineSpacing();
    this.markup = style.getOwnMarkup();
    this.pattern = style.getOwnPattern();
    this.fontName = style.getOwnFontName();
    this.isBold = style.isOwnBold();
    this.isItalic = style.isOwnItalic();
    this.isUnderline = style.isOwnUnderline();
    this.isStrikeThrough = style.isOwnStrikeThrough();
    this.fontSize = style.getOwnFontSize();
    this.pdfFontName = style.getOwnPdfFontName();
    this.pdfEncoding = style.getOwnPdfEncoding();
    this.isPdfEmbedded = style.isOwnPdfEmbedded();
    this.conditionExpression = factory.getExpression(style.getConditionExpression(), true);
  }
  
  public JRExpression getConditionExpression() {
    return this.conditionExpression;
  }
}
