KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > labels > ItemLabelAnchor


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  * ItemLabelAnchor.java
29  * --------------------
30  * (C) Copyright 2003-2005, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: ItemLabelAnchor.java,v 1.5.2.1 2005/10/25 20:49:02 mungady Exp $
36  *
37  * Changes
38  * -------
39  * 29-Apr-2003 : Version 1 (DG);
40  * 19-Feb-2004 : Moved to org.jfree.chart.labels package, added readResolve()
41  * method (DG);
42  * 11-Jan-2005 : Removed deprecated code in preparation for the 1.0.0
43  * release (DG);
44  *
45  */

46
47 package org.jfree.chart.labels;
48
49 import java.io.ObjectStreamException JavaDoc;
50 import java.io.Serializable JavaDoc;
51
52 /**
53  * An enumeration of the positions that a value label can take, relative to an
54  * item in a {@link org.jfree.chart.plot.CategoryPlot}.
55  */

56 public final class ItemLabelAnchor implements Serializable JavaDoc {
57
58     /** For serialization. */
59     private static final long serialVersionUID = -1233101616128695658L;
60     
61     /** CENTER. */
62     public static final ItemLabelAnchor CENTER
63         = new ItemLabelAnchor("ItemLabelAnchor.CENTER");
64
65     /** INSIDE1. */
66     public static final ItemLabelAnchor INSIDE1
67         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE1");
68
69     /** INSIDE2. */
70     public static final ItemLabelAnchor INSIDE2
71         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE2");
72
73     /** INSIDE3. */
74     public static final ItemLabelAnchor INSIDE3
75         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE3");
76
77     /** INSIDE4. */
78     public static final ItemLabelAnchor INSIDE4
79         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE4");
80
81     /** INSIDE5. */
82     public static final ItemLabelAnchor INSIDE5
83         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE5");
84
85     /** INSIDE6. */
86     public static final ItemLabelAnchor INSIDE6
87         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE6");
88
89     /** INSIDE7. */
90     public static final ItemLabelAnchor INSIDE7
91         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE7");
92
93     /** INSIDE8. */
94     public static final ItemLabelAnchor INSIDE8
95         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE8");
96
97     /** INSIDE9. */
98     public static final ItemLabelAnchor INSIDE9
99         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE9");
100
101     /** INSIDE10. */
102     public static final ItemLabelAnchor INSIDE10
103         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE10");
104
105     /** INSIDE11. */
106     public static final ItemLabelAnchor INSIDE11
107         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE11");
108
109     /** INSIDE12. */
110     public static final ItemLabelAnchor INSIDE12
111         = new ItemLabelAnchor("ItemLabelAnchor.INSIDE12");
112
113     /** OUTSIDE1. */
114     public static final ItemLabelAnchor OUTSIDE1
115         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE1");
116
117     /** OUTSIDE2. */
118     public static final ItemLabelAnchor OUTSIDE2
119         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE2");
120
121     /** OUTSIDE3. */
122     public static final ItemLabelAnchor OUTSIDE3
123         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE3");
124
125     /** OUTSIDE4. */
126     public static final ItemLabelAnchor OUTSIDE4
127         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE4");
128
129     /** OUTSIDE5. */
130     public static final ItemLabelAnchor OUTSIDE5
131         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE5");
132
133     /** OUTSIDE6. */
134     public static final ItemLabelAnchor OUTSIDE6
135         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE6");
136
137     /** OUTSIDE7. */
138     public static final ItemLabelAnchor OUTSIDE7
139         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE7");
140
141     /** OUTSIDE8. */
142     public static final ItemLabelAnchor OUTSIDE8
143         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE8");
144
145     /** OUTSIDE9. */
146     public static final ItemLabelAnchor OUTSIDE9
147         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE9");
148
149     /** OUTSIDE10. */
150     public static final ItemLabelAnchor OUTSIDE10
151         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE10");
152
153     /** OUTSIDE11. */
154     public static final ItemLabelAnchor OUTSIDE11
155         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE11");
156
157     /** OUTSIDE12. */
158     public static final ItemLabelAnchor OUTSIDE12
159         = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE12");
160
161     /** The name. */
162     private String JavaDoc name;
163
164     /**
165      * Private constructor.
166      *
167      * @param name the name.
168      */

169     private ItemLabelAnchor(String JavaDoc name) {
170         this.name = name;
171     }
172
173     /**
174      * Returns a string representing the object.
175      *
176      * @return The string.
177      */

178     public String JavaDoc toString() {
179         return this.name;
180     }
181
182     /**
183      * Returns <code>true</code> if this object is equal to the specified
184      * object, and <code>false</code> otherwise.
185      *
186      * @param o the other object.
187      *
188      * @return A boolean.
189      */

190     public boolean equals(Object JavaDoc o) {
191
192         if (this == o) {
193             return true;
194         }
195         if (!(o instanceof ItemLabelAnchor)) {
196             return false;
197         }
198
199         ItemLabelAnchor order = (ItemLabelAnchor) o;
200         if (!this.name.equals(order.toString())) {
201             return false;
202         }
203
204         return true;
205
206     }
207     
208     /**
209      * Ensures that serialization returns the unique instances.
210      *
211      * @return The object.
212      *
213      * @throws ObjectStreamException if there is a problem.
214      */

215     private Object JavaDoc readResolve() throws ObjectStreamException JavaDoc {
216         ItemLabelAnchor result = null;
217         if (this.equals(ItemLabelAnchor.CENTER)) {
218             result = ItemLabelAnchor.CENTER;
219         }
220         else if (this.equals(ItemLabelAnchor.INSIDE1)) {
221             result = ItemLabelAnchor.INSIDE1;
222         }
223         else if (this.equals(ItemLabelAnchor.INSIDE2)) {
224             result = ItemLabelAnchor.INSIDE2;
225         }
226         else if (this.equals(ItemLabelAnchor.INSIDE3)) {
227             result = ItemLabelAnchor.INSIDE3;
228         }
229         else if (this.equals(ItemLabelAnchor.INSIDE4)) {
230             result = ItemLabelAnchor.INSIDE4;
231         }
232         else if (this.equals(ItemLabelAnchor.INSIDE5)) {
233             result = ItemLabelAnchor.INSIDE5;
234         }
235         else if (this.equals(ItemLabelAnchor.INSIDE6)) {
236             result = ItemLabelAnchor.INSIDE6;
237         }
238         else if (this.equals(ItemLabelAnchor.INSIDE7)) {
239             result = ItemLabelAnchor.INSIDE7;
240         }
241         else if (this.equals(ItemLabelAnchor.INSIDE8)) {
242             result = ItemLabelAnchor.INSIDE8;
243         }
244         else if (this.equals(ItemLabelAnchor.INSIDE9)) {
245             result = ItemLabelAnchor.INSIDE9;
246         }
247         else if (this.equals(ItemLabelAnchor.INSIDE10)) {
248             result = ItemLabelAnchor.INSIDE10;
249         }
250         else if (this.equals(ItemLabelAnchor.INSIDE11)) {
251             result = ItemLabelAnchor.INSIDE11;
252         }
253         else if (this.equals(ItemLabelAnchor.INSIDE12)) {
254             result = ItemLabelAnchor.INSIDE12;
255         }
256         else if (this.equals(ItemLabelAnchor.OUTSIDE1)) {
257             result = ItemLabelAnchor.OUTSIDE1;
258         }
259         else if (this.equals(ItemLabelAnchor.OUTSIDE2)) {
260             result = ItemLabelAnchor.OUTSIDE2;
261         }
262         else if (this.equals(ItemLabelAnchor.OUTSIDE3)) {
263             result = ItemLabelAnchor.OUTSIDE3;
264         }
265         else if (this.equals(ItemLabelAnchor.OUTSIDE4)) {
266             result = ItemLabelAnchor.OUTSIDE4;
267         }
268         else if (this.equals(ItemLabelAnchor.OUTSIDE5)) {
269             result = ItemLabelAnchor.OUTSIDE5;
270         }
271         else if (this.equals(ItemLabelAnchor.OUTSIDE6)) {
272             result = ItemLabelAnchor.OUTSIDE6;
273         }
274         else if (this.equals(ItemLabelAnchor.OUTSIDE7)) {
275             result = ItemLabelAnchor.OUTSIDE7;
276         }
277         else if (this.equals(ItemLabelAnchor.OUTSIDE8)) {
278             result = ItemLabelAnchor.OUTSIDE8;
279         }
280         else if (this.equals(ItemLabelAnchor.OUTSIDE9)) {
281             result = ItemLabelAnchor.OUTSIDE9;
282         }
283         else if (this.equals(ItemLabelAnchor.OUTSIDE10)) {
284             result = ItemLabelAnchor.OUTSIDE10;
285         }
286         else if (this.equals(ItemLabelAnchor.OUTSIDE11)) {
287             result = ItemLabelAnchor.OUTSIDE11;
288         }
289         else if (this.equals(ItemLabelAnchor.OUTSIDE12)) {
290             result = ItemLabelAnchor.OUTSIDE12;
291         }
292         return result;
293     }
294
295 }
296
Popular Tags