KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > block > BlockParams


1 /* ===========================================================
2  * JFreeChart : a free chart library for the Java(tm) platform
3  * ===========================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jfreechart/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ----------------
28  * BlockParams.java
29  * ----------------
30  * (C) Copyright 2005, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: BlockParams.java,v 1.1.2.1 2005/10/25 20:39:38 mungady Exp $
36  *
37  * Changes:
38  * --------
39  * 19-Apr-2005 : Version 1 (DG);
40  *
41  */

42
43 package org.jfree.chart.block;
44
45 /**
46  * A standard parameter object that can be passed to the draw() method defined
47  * by the {@link Block} class.
48  */

49 public class BlockParams implements EntityBlockParams {
50     
51     /**
52      * A flag that controls whether or not the block should generate and
53      * return chart entities for the items it draws.
54      */

55     private boolean generateEntities;
56     
57     /**
58      * The x-translation (used to enable chart entities to use global
59      * coordinates rather than coordinates that are local to the container
60      * they are within).
61      */

62     private double translateX;
63     
64     /**
65      * The y-translation (used to enable chart entities to use global
66      * coordinates rather than coordinates that are local to the container
67      * they are within).
68      */

69     private double translateY;
70     
71     /**
72      * Creates a new instance.
73      */

74     public BlockParams() {
75         this.translateX = 0.0;
76         this.translateY = 0.0;
77         this.generateEntities = false;
78     }
79     
80     /**
81      * Returns the flag that controls whether or not chart entities are
82      * generated.
83      *
84      * @return A boolean.
85      */

86     public boolean getGenerateEntities() {
87         return this.generateEntities;
88     }
89     
90     /**
91      * Sets the flag that controls whether or not chart entities are generated.
92      *
93      * @param generate the flag.
94      */

95     public void setGenerateEntities(boolean generate) {
96         this.generateEntities = generate;
97     }
98     
99     /**
100      * Returns the translation required to convert local x-coordinates back to
101      * the coordinate space of the container.
102      *
103      * @return The x-translation amount.
104      */

105     public double getTranslateX() {
106         return this.translateX;
107     }
108     
109     /**
110      * Sets the translation required to convert local x-coordinates into the
111      * coordinate space of the container.
112      *
113      * @param x the x-translation amount.
114      */

115     public void setTranslateX(double x) {
116         this.translateX = x;
117     }
118     
119     /**
120      * Returns the translation required to convert local y-coordinates back to
121      * the coordinate space of the container.
122      *
123      * @return The y-translation amount.
124      */

125     public double getTranslateY() {
126         return this.translateY;
127     }
128     
129     /**
130      * Sets the translation required to convert local y-coordinates into the
131      * coordinate space of the container.
132      *
133      * @param y the y-translation amount.
134      */

135     public void setTranslateY(double y) {
136         this.translateY = y;
137     }
138
139 }
140
Popular Tags