001    /* ===========================================================
002     * JFreeChart : a free chart library for the Java(tm) platform
003     * ===========================================================
004     *
005     * (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.
006     *
007     * Project Info:  http://www.jfree.org/jfreechart/index.html
008     *
009     * This library is free software; you can redistribute it and/or modify it
010     * under the terms of the GNU Lesser General Public License as published by
011     * the Free Software Foundation; either version 2.1 of the License, or
012     * (at your option) any later version.
013     *
014     * This library is distributed in the hope that it will be useful, but
015     * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016     * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017     * License for more details.
018     *
019     * You should have received a copy of the GNU Lesser General Public
020     * License along with this library; if not, write to the Free Software
021     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
022     * USA.
023     *
024     * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025     * in the United States and other countries.]
026     *
027     * ----------------
028     * BlockParams.java
029     * ----------------
030     * (C) Copyright 2005-2008, by Object Refinery Limited.
031     *
032     * Original Author:  David Gilbert (for Object Refinery Limited);
033     * Contributor(s):   -;
034     *
035     * Changes:
036     * --------
037     * 19-Apr-2005 : Version 1 (DG);
038     *
039     */
040    
041    package org.jfree.chart.block;
042    
043    /**
044     * A standard parameter object that can be passed to the draw() method defined
045     * by the {@link Block} class.
046     */
047    public class BlockParams implements EntityBlockParams {
048    
049        /**
050         * A flag that controls whether or not the block should generate and
051         * return chart entities for the items it draws.
052         */
053        private boolean generateEntities;
054    
055        /**
056         * The x-translation (used to enable chart entities to use global
057         * coordinates rather than coordinates that are local to the container
058         * they are within).
059         */
060        private double translateX;
061    
062        /**
063         * The y-translation (used to enable chart entities to use global
064         * coordinates rather than coordinates that are local to the container
065         * they are within).
066         */
067        private double translateY;
068    
069        /**
070         * Creates a new instance.
071         */
072        public BlockParams() {
073            this.translateX = 0.0;
074            this.translateY = 0.0;
075            this.generateEntities = false;
076        }
077    
078        /**
079         * Returns the flag that controls whether or not chart entities are
080         * generated.
081         *
082         * @return A boolean.
083         */
084        public boolean getGenerateEntities() {
085            return this.generateEntities;
086        }
087    
088        /**
089         * Sets the flag that controls whether or not chart entities are generated.
090         *
091         * @param generate  the flag.
092         */
093        public void setGenerateEntities(boolean generate) {
094            this.generateEntities = generate;
095        }
096    
097        /**
098         * Returns the translation required to convert local x-coordinates back to
099         * the coordinate space of the container.
100         *
101         * @return The x-translation amount.
102         */
103        public double getTranslateX() {
104            return this.translateX;
105        }
106    
107        /**
108         * Sets the translation required to convert local x-coordinates into the
109         * coordinate space of the container.
110         *
111         * @param x  the x-translation amount.
112         */
113        public void setTranslateX(double x) {
114            this.translateX = x;
115        }
116    
117        /**
118         * Returns the translation required to convert local y-coordinates back to
119         * the coordinate space of the container.
120         *
121         * @return The y-translation amount.
122         */
123        public double getTranslateY() {
124            return this.translateY;
125        }
126    
127        /**
128         * Sets the translation required to convert local y-coordinates into the
129         * coordinate space of the container.
130         *
131         * @param y  the y-translation amount.
132         */
133        public void setTranslateY(double y) {
134            this.translateY = y;
135        }
136    
137    }