Logo
Distributed Genetic Programming Framework
print print

File org.jfree.chart.title.LegendItemBlockContainer.java

Here you can find all the information about the file org.jfree.chart.title.LegendItemBlockContainer.java. You may explore it here or download it onto your local disk.
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors.
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 *
 * This library 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 library 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
 * USA.  
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
 * in the United States and other countries.]
 * 
 * -----------------------------
 * LegendItemBlockContainer.java
 * -----------------------------
 * (C) Copyright 2006, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: LegendItemBlockContainer.java,v 1.1.2.1 2006/07/20 16:21:59 mungady Exp $
 *
 * Changes
 * -------
 * 20-Jul-2006 : Version 1 (DG);
 * 
 */


package org.jfree.chart.title;

import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;

import org.jfree.chart.block.Arrangement;
import org.jfree.chart.block.BlockContainer;
import org.jfree.chart.block.BlockResult;
import org.jfree.chart.block.EntityBlockParams;
import org.jfree.chart.block.EntityBlockResult;
import org.jfree.chart.entity.EntityCollection;
import org.jfree.chart.entity.LegendItemEntity;
import org.jfree.chart.entity.StandardEntityCollection;

/**
 * A container that holds all the pieces of a single legend item.
 *
 * @since 1.0.2
 */

public class LegendItemBlockContainer extends BlockContainer {

    /** The dataset index. */
    private int dataset;
    
    /** The series index. */
    private int series;
    
    /**
     * Creates a new legend item block.
     * 
     * @param arrangement
     * @param dataset
     * @param series
     */

    public LegendItemBlockContainer(Arrangement arrangement, int dataset,
            int series) {
        super(arrangement);
        this.dataset = dataset;
        this.series = series;
    }
    
    /**
     * Returns the dataset index.
     * 
     * @return The dataset index.
     */

    public int getDatasetIndex() {
        return this.dataset;
    }
   
    /**
     * Returns the series index.
     * 
     * @return The series index.
     */

    public int getSeriesIndex() {
        return this.series;
    }
    
    /**
     * Draws the block within the specified area.
     * 
     * @param g2  the graphics device.
     * @param area  the area.
     * @param params  passed on to blocks within the container 
     *                (<code>null</code> permitted).
     * 
     * @return An instance of {@link EntityBlockResult}, or <code>null</code>.
     */

    public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
        // draw the block without collecting entities
        super.draw(g2, area, null);
        EntityBlockParams ebp = null;
        BlockResult r = new BlockResult();
        if (params instanceof EntityBlockParams) {
            ebp = (EntityBlockParams) params;
            if (ebp.getGenerateEntities()) {
                EntityCollection ec = new StandardEntityCollection();
                LegendItemEntity entity = new LegendItemEntity(
                        (Shape) area.clone());
                entity.setSeriesIndex(this.series);
                ec.add(entity);
                r.setEntityCollection(ec);
            }
        }
        return r;
    }
}

File Information:

file name:LegendItemBlockContainer.java
package:org.jfree.chart.title
qualified name:org.jfree.chart.title.LegendItemBlockContainer.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/jfree/chart/title/LegendItemBlockContainer.java
size:4.164 KB (4264 B)
uploaded: 2015-07-22 04:11:05 GMT+0000
last update: 2006-08-25 12:16:44 GMT+0000
last access: 2017-11-18 06:38:45 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2015-07-22 04:10:53 GMT+0000 served at 2017-11-18 06:38:45 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo