Package net.sf.jasperreports.charts.base

Source Code of net.sf.jasperreports.charts.base.JRBaseAreaPlot

/*
* JasperReports - Free Java Reporting Library.
* Copyright (C) 2001 - 2009 Jaspersoft Corporation. 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 <http://www.gnu.org/licenses/>.
*/
package net.sf.jasperreports.charts.base;

import java.awt.Color;

import net.sf.jasperreports.charts.JRAreaPlot;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartPlot;
import net.sf.jasperreports.engine.JRConstants;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRFont;
import net.sf.jasperreports.engine.base.JRBaseChartPlot;
import net.sf.jasperreports.engine.base.JRBaseFont;
import net.sf.jasperreports.engine.base.JRBaseObjectFactory;
import net.sf.jasperreports.engine.util.JRStyleResolver;

/**
* @author Flavius Sana (flavius_sana@users.sourceforge.net)
* @version $Id: JRBaseAreaPlot.java 3938 2010-08-19 14:59:36Z teodord $
*/
public class JRBaseAreaPlot extends JRBaseChartPlot implements JRAreaPlot
{
  private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
 
  protected JRExpression categoryAxisLabelExpression;
  protected JRFont categoryAxisLabelFont;
  protected Color categoryAxisLabelColor;
  protected JRFont categoryAxisTickLabelFont;
  protected Color categoryAxisTickLabelColor;
  protected String categoryAxisTickLabelMask;
  protected Boolean categoryAxisVerticalTickLabels;
  protected Color categoryAxisLineColor;

  protected JRExpression valueAxisLabelExpression;
  protected JRExpression rangeAxisMinValueExpression;
  protected JRExpression rangeAxisMaxValueExpression;
  protected JRExpression domainAxisMinValueExpression;
  protected JRExpression domainAxisMaxValueExpression;
  protected JRFont valueAxisLabelFont;
  protected Color valueAxisLabelColor;
  protected JRFont valueAxisTickLabelFont;
  protected Color valueAxisTickLabelColor;
  protected String valueAxisTickLabelMask;
  protected Boolean valueAxisVerticalTickLabels;
  protected Color valueAxisLineColor;
 

  /**
   *
   */
  public JRBaseAreaPlot(JRChartPlot plot, JRChart chart)
  {
    super(plot, chart);
   
    JRAreaPlot areaPlot = plot instanceof JRAreaPlot ? (JRAreaPlot)plot : null;
    if (areaPlot == null)//FIXMECHART make a common interface and try copy props that are common to different plots
    {
      categoryAxisLabelFont = new JRBaseFont(chart, null);
      categoryAxisTickLabelFont = new JRBaseFont(chart, null);
      valueAxisLabelFont = new JRBaseFont(chart, null);
      valueAxisTickLabelFont = new JRBaseFont(chart, null);
    }
    else
    {
      categoryAxisLabelFont = new JRBaseFont(chart, areaPlot.getCategoryAxisLabelFont());
      categoryAxisTickLabelFont = new JRBaseFont(chart, areaPlot.getCategoryAxisTickLabelFont());
      valueAxisLabelFont = new JRBaseFont(chart, areaPlot.getValueAxisLabelFont());
      valueAxisTickLabelFont = new JRBaseFont(chart, areaPlot.getValueAxisTickLabelFont());
    }
  }


  /**
   *
   */
  public JRBaseAreaPlot( JRAreaPlot areaPlot, JRBaseObjectFactory factory )
  {
    super( areaPlot, factory );
   
    categoryAxisLabelExpression = factory.getExpression( areaPlot.getCategoryAxisLabelExpression() );
    categoryAxisLabelFont = new JRBaseFont(areaPlot.getChart(), areaPlot.getCategoryAxisLabelFont());
    categoryAxisLabelColor = areaPlot.getOwnCategoryAxisLabelColor();
    categoryAxisTickLabelFont = new JRBaseFont(areaPlot.getChart(), areaPlot.getCategoryAxisTickLabelFont());
    categoryAxisTickLabelColor = areaPlot.getOwnCategoryAxisTickLabelColor();
    categoryAxisTickLabelMask = areaPlot.getCategoryAxisTickLabelMask();
    categoryAxisVerticalTickLabels = areaPlot.getCategoryAxisVerticalTickLabels();
    categoryAxisLineColor = areaPlot.getOwnCategoryAxisLineColor();
    labelRotationDouble = areaPlot.getCategoryAxisTickLabelRotation();
   
    valueAxisLabelExpression = factory.getExpression( areaPlot.getValueAxisLabelExpression() );
    domainAxisMinValueExpression = factory.getExpression( areaPlot.getDomainAxisMinValueExpression() );
    domainAxisMaxValueExpression = factory.getExpression( areaPlot.getDomainAxisMaxValueExpression() );
    rangeAxisMinValueExpression = factory.getExpression( areaPlot.getRangeAxisMinValueExpression() );
    rangeAxisMaxValueExpression = factory.getExpression( areaPlot.getRangeAxisMaxValueExpression() );
    valueAxisLabelFont = new JRBaseFont(areaPlot.getChart(), areaPlot.getValueAxisLabelFont());
    valueAxisLabelColor = areaPlot.getOwnValueAxisLabelColor();
    valueAxisTickLabelFont = new JRBaseFont(areaPlot.getChart(), areaPlot.getValueAxisTickLabelFont());
    valueAxisTickLabelColor = areaPlot.getOwnValueAxisTickLabelColor();
    valueAxisTickLabelMask = areaPlot.getValueAxisTickLabelMask();
    valueAxisVerticalTickLabels = areaPlot.getValueAxisVerticalTickLabels();
    valueAxisLineColor = areaPlot.getOwnValueAxisLineColor();
  }
 
  /**
   *
   */
  public JRExpression getCategoryAxisLabelExpression(){
    return categoryAxisLabelExpression;
  }
 
  /**
   *
   */
  public JRFont getCategoryAxisLabelFont()
  {
    return categoryAxisLabelFont;
  }
 
  /**
   *
   */
  public Color getCategoryAxisLabelColor()
  {
    return JRStyleResolver.getCategoryAxisLabelColor(this, this);
  }
 
  /**
   *
   */
  public Color getOwnCategoryAxisLabelColor()
  {
    return categoryAxisLabelColor;
  }
 
  /**
   *
   */
  public JRFont getCategoryAxisTickLabelFont()
  {
    return categoryAxisTickLabelFont;
  }
 
  /**
   *
   */
  public Color getCategoryAxisTickLabelColor()
  {
    return JRStyleResolver.getCategoryAxisTickLabelColor(this, this);
  }

  /**
   *
   */
  public Color getOwnCategoryAxisTickLabelColor()
  {
    return categoryAxisTickLabelColor;
  }

  /**
   *
   */
  public String getCategoryAxisTickLabelMask()
  {
    return categoryAxisTickLabelMask;
  }

  /**
   *
   */
  public Boolean getCategoryAxisVerticalTickLabels()
  {
    return categoryAxisVerticalTickLabels;
  }

  /**
   *
   */
  public Double getCategoryAxisTickLabelRotation()
  {
    return labelRotationDouble;
  }

  /**
   *
   */
  public void setCategoryAxisTickLabelRotation(Double labelRotationDouble)
  {
    Object old = this.labelRotationDouble;
    this.labelRotationDouble = labelRotationDouble;
    getEventSupport().firePropertyChange(PROPERTY_CATEGORY_AXIS_TICK_LABEL_ROTATION, old, this.labelRotationDouble);
  }

  /**
   *
   */
  public Color getCategoryAxisLineColor()
  {
    return JRStyleResolver.getCategoryAxisLineColor(this, this);
  }
   
  /**
   *
   */
  public Color getOwnCategoryAxisLineColor()
  {
    return categoryAxisLineColor;
  }
   
  /**
   *
   */
  public JRExpression getValueAxisLabelExpression(){
    return valueAxisLabelExpression;
  }

  /**
   *
   */
  public JRExpression getDomainAxisMinValueExpression(){
    return domainAxisMinValueExpression;
  }

  /**
   *
   */
  public JRExpression getDomainAxisMaxValueExpression(){
    return domainAxisMaxValueExpression;
  }

  /**
   *
   */
  public JRExpression getRangeAxisMinValueExpression(){
    return rangeAxisMinValueExpression;
  }

  /**
   *
   */
  public JRExpression getRangeAxisMaxValueExpression(){
    return rangeAxisMaxValueExpression;
  }

  /**
   *
   */
  public JRFont getValueAxisLabelFont()
  {
    return valueAxisLabelFont;
  }
 
  /**
   *
   */
  public Color getValueAxisLabelColor()
  {
    return JRStyleResolver.getValueAxisLabelColor(this, this);
  }
 
  /**
   *
   */
  public Color getOwnValueAxisLabelColor()
  {
    return valueAxisLabelColor;
  }
 
  /**
   *
   */
  public JRFont getValueAxisTickLabelFont()
  {
    return valueAxisTickLabelFont;
  }
 
  /**
   *
   */
  public Color getValueAxisTickLabelColor()
  {
    return JRStyleResolver.getValueAxisTickLabelColor(this, this);
  }

  /**
   *
   */
  public Color getOwnValueAxisTickLabelColor()
  {
    return valueAxisTickLabelColor;
  }

  /**
   *
   */
  public String getValueAxisTickLabelMask()
  {
    return valueAxisTickLabelMask;
  }

  /**
   *
   */
  public Boolean getValueAxisVerticalTickLabels()
  {
    return valueAxisVerticalTickLabels;
  }

  /**
   *
   */
  public Color getValueAxisLineColor()
  {
    return JRStyleResolver.getValueAxisLineColor(this, this);
  }
 
  /**
   *
   */
  public Color getOwnValueAxisLineColor()
  {
    return valueAxisLineColor;
  }
 
  /**
   *
   */
  public void collectExpressions(JRExpressionCollector collector)
  {
    collector.collect(this);
  }

  /**
   *
   */
  public Object clone(JRChart parentChart)
  {
    JRBaseAreaPlot clone = (JRBaseAreaPlot)super.clone(parentChart);
    if (categoryAxisLabelExpression != null)
    {
      clone.categoryAxisLabelExpression = (JRExpression)categoryAxisLabelExpression.clone();
    }
    if (valueAxisLabelExpression != null)
    {
      clone.valueAxisLabelExpression = (JRExpression)valueAxisLabelExpression.clone();
    }
    if (domainAxisMinValueExpression != null)
    {
      clone.domainAxisMinValueExpression = (JRExpression)domainAxisMinValueExpression.clone();
    }
    if (domainAxisMaxValueExpression != null)
    {
      clone.domainAxisMaxValueExpression = (JRExpression)domainAxisMaxValueExpression.clone();
    }
    if (rangeAxisMinValueExpression != null)
    {
      clone.rangeAxisMinValueExpression = (JRExpression)rangeAxisMinValueExpression.clone();
    }
    if (rangeAxisMaxValueExpression != null)
    {
      clone.rangeAxisMaxValueExpression = (JRExpression)rangeAxisMaxValueExpression.clone();
    }
    return clone;
  }
}
TOP

Related Classes of net.sf.jasperreports.charts.base.JRBaseAreaPlot

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.