Package jsynoptic.plugins.jfreechart

Source Code of jsynoptic.plugins.jfreechart.JSynopticStandardXYItemRenderer

/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This program 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 2.1 of the License, or (at your option) any later version.
*
* This program 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 this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2003, by :
*     Corporate:
*         Astrium SAS
*         EADS CRC
*     Individual:
*         Nicolas Brodu
*
* $Id: JSynopticStandardXYItemRenderer.java,v 1.3 2004/02/23 11:22:14 brodu Exp $
*
* Changes
* -------
* 25-Sep-2003 : Initial public release (NB);
* 10-Oct-2003 : Dynamic color changes, revert to older version, new color handling (NB)
*
*/

package jsynoptic.plugins.jfreechart;

import java.awt.Paint;

import org.jfree.chart.LegendItem;
import org.jfree.chart.labels.TimeSeriesToolTipGenerator;
import org.jfree.chart.labels.XYToolTipGenerator;
import org.jfree.chart.plot.DrawingSupplier;
import org.jfree.chart.renderer.StandardXYItemRenderer;
import org.jfree.chart.urls.StandardXYURLGenerator;
import org.jfree.chart.urls.XYURLGenerator;

import simtools.data.DataSource;
import simtools.ui.ColorMapper;

/**
* Extended XY Item Renderer that makes distiction between primary, secondary, etc... sources
* of information. Color and legend items change according to the x_ary parameter.
*
*/
public class JSynopticStandardXYItemRenderer extends StandardXYItemRenderer implements JSynopticXYItemRenderer {

  static final long serialVersionUID = 1522980710470825601L;

  protected JSynopticXYItemRendererHelper helper;

  /**
   * Default is to build a renderer for the primary source of information
   */
  public JSynopticStandardXYItemRenderer() {
    this(1);
  }

  /**
   * @param x_ary Set to 1,2,3... if the renderer is destinated to primary, secondary, tertiary... information
   */
  public JSynopticStandardXYItemRenderer(int x_ary) {
    this(x_ary, StandardXYItemRenderer.LINES);
  }

  public JSynopticStandardXYItemRenderer(int x_ary, int type) {
    this(x_ary, type,new TimeSeriesToolTipGenerator());
  }

  /**
   * @param type
   * @param toolTipGenerator
   */
  public JSynopticStandardXYItemRenderer(
    int x_ary,
    int type,
    XYToolTipGenerator toolTipGenerator) {
    this(x_ary,type, toolTipGenerator, new StandardXYURLGenerator());
  }

  /**
   * @param type
   * @param toolTipGenerator
   * @param urlGenerator
   */
  public JSynopticStandardXYItemRenderer(
    int x_ary,
    int type,
    XYToolTipGenerator toolTipGenerator,
    XYURLGenerator urlGenerator) {
    super(type, toolTipGenerator, urlGenerator);
    helper = new JSynopticXYItemRendererHelper(x_ary);
  }

 
  public LegendItem getLegendItem(int datasetIndex, int series) {
    return helper.getLegendItem(this, datasetIndex,series);
  }

  /* (non-Javadoc)
   * @see org.jfree.chart.renderer.AbstractRenderer#getItemPaint(int, int)
   */
  public Paint getItemPaint(int row, int column) {
    return helper.getItemPaint(this,row,column);
  }

  /* (non-Javadoc)
   * @see org.jfree.chart.renderer.AbstractRenderer#getSeriesPaint(int)
   */
  public Paint getSeriesPaint(int series) {
    return helper.getSeriesPaint(this,series);
  }

  /* (non-Javadoc)
   * @see jsynoptic.plugins.jfreechart.JSynopticXYItemRenderer#getDefaultLegendItem(int, int)
   */
  public LegendItem getDefaultLegendItem(int datasetIndex, int series) {
    return super.getLegendItem(datasetIndex,series);
  }

  /* (non-Javadoc)
   * @see jsynoptic.plugins.jfreechart.JSynopticXYItemRenderer#getDefaultItemPaint(int, int)
   */
  public Paint getDefaultItemPaint(int row, int column) {
    return super.getItemPaint(row,column);
  }

  /* (non-Javadoc)
   * @see jsynoptic.plugins.jfreechart.JSynopticXYItemRenderer#getDefaultSeriesPaint(int)
   */
  public Paint getDefaultSeriesPaint(int series) {
    return super.getSeriesPaint(series);
  }

  public DrawingSupplier getDrawingSupplier() {
    return helper.getDrawingSupplier();
  }

  /**
   * @param i
   * @return
   */
  public ColorMapper getColorMapper(int i) {
    return helper.getColorMapper(i);
  }

  /**
   * @param i
   * @return
   */
  public DataSource getDataSource(int i) {
    return helper.getDataSource(i);
  }

  /**
   * @param i
   * @return
   */
  public ColorMapper removeColorMapper(int i) {
    return helper.removeColorMapper(i);
  }

  /**
   * @param i
   * @return
   */
  public DataSource removeDataSource(int i) {
    return helper.removeDataSource(i);
  }

  /**
   * @param i
   * @param colorMapper
   */
  public void setColorMapper(int i, ColorMapper colorMapper) {
    helper.setColorMapper(i, colorMapper);
  }

  /**
   * @param i
   * @param ds
   */
  public void setDataSource(int i, DataSource ds) {
    helper.setDataSource(i, ds);
  }

    /* (non-Javadoc)
     * @see jsynoptic.plugins.jfreechart.JSynopticXYItemRenderer#cloneRenderer()
     */
    public JSynopticXYItemRenderer cloneRenderer() {
        try {
            JSynopticStandardXYItemRenderer clone = (JSynopticStandardXYItemRenderer)super.clone();
            clone.helper = helper.cloneHelper();
            return clone;
        } catch (CloneNotSupportedException e) {
            return this; // JFreeChart default behaviour
        }
    }

}

TOP

Related Classes of jsynoptic.plugins.jfreechart.JSynopticStandardXYItemRenderer

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.