001: /* ===========================================================
002: * JFreeChart : a free chart library for the Java(tm) platform
003: * ===========================================================
004: *
005: * (C) Copyright 2000-2005, 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: * ItemLabelAnchor.java
029: * --------------------
030: * (C) Copyright 2003-2005, by Object Refinery Limited.
031: *
032: * Original Author: David Gilbert (for Object Refinery Limited);
033: * Contributor(s): -;
034: *
035: * $Id: ItemLabelAnchor.java,v 1.5.2.1 2005/10/25 20:49:02 mungady Exp $
036: *
037: * Changes
038: * -------
039: * 29-Apr-2003 : Version 1 (DG);
040: * 19-Feb-2004 : Moved to org.jfree.chart.labels package, added readResolve()
041: * method (DG);
042: * 11-Jan-2005 : Removed deprecated code in preparation for the 1.0.0
043: * release (DG);
044: *
045: */
046:
047: package org.jfree.chart.labels;
048:
049: import java.io.ObjectStreamException;
050: import java.io.Serializable;
051:
052: /**
053: * An enumeration of the positions that a value label can take, relative to an
054: * item in a {@link org.jfree.chart.plot.CategoryPlot}.
055: */
056: public final class ItemLabelAnchor implements Serializable {
057:
058: /** For serialization. */
059: private static final long serialVersionUID = -1233101616128695658L;
060:
061: /** CENTER. */
062: public static final ItemLabelAnchor CENTER = new ItemLabelAnchor(
063: "ItemLabelAnchor.CENTER");
064:
065: /** INSIDE1. */
066: public static final ItemLabelAnchor INSIDE1 = new ItemLabelAnchor(
067: "ItemLabelAnchor.INSIDE1");
068:
069: /** INSIDE2. */
070: public static final ItemLabelAnchor INSIDE2 = new ItemLabelAnchor(
071: "ItemLabelAnchor.INSIDE2");
072:
073: /** INSIDE3. */
074: public static final ItemLabelAnchor INSIDE3 = new ItemLabelAnchor(
075: "ItemLabelAnchor.INSIDE3");
076:
077: /** INSIDE4. */
078: public static final ItemLabelAnchor INSIDE4 = new ItemLabelAnchor(
079: "ItemLabelAnchor.INSIDE4");
080:
081: /** INSIDE5. */
082: public static final ItemLabelAnchor INSIDE5 = new ItemLabelAnchor(
083: "ItemLabelAnchor.INSIDE5");
084:
085: /** INSIDE6. */
086: public static final ItemLabelAnchor INSIDE6 = new ItemLabelAnchor(
087: "ItemLabelAnchor.INSIDE6");
088:
089: /** INSIDE7. */
090: public static final ItemLabelAnchor INSIDE7 = new ItemLabelAnchor(
091: "ItemLabelAnchor.INSIDE7");
092:
093: /** INSIDE8. */
094: public static final ItemLabelAnchor INSIDE8 = new ItemLabelAnchor(
095: "ItemLabelAnchor.INSIDE8");
096:
097: /** INSIDE9. */
098: public static final ItemLabelAnchor INSIDE9 = new ItemLabelAnchor(
099: "ItemLabelAnchor.INSIDE9");
100:
101: /** INSIDE10. */
102: public static final ItemLabelAnchor INSIDE10 = new ItemLabelAnchor(
103: "ItemLabelAnchor.INSIDE10");
104:
105: /** INSIDE11. */
106: public static final ItemLabelAnchor INSIDE11 = new ItemLabelAnchor(
107: "ItemLabelAnchor.INSIDE11");
108:
109: /** INSIDE12. */
110: public static final ItemLabelAnchor INSIDE12 = new ItemLabelAnchor(
111: "ItemLabelAnchor.INSIDE12");
112:
113: /** OUTSIDE1. */
114: public static final ItemLabelAnchor OUTSIDE1 = new ItemLabelAnchor(
115: "ItemLabelAnchor.OUTSIDE1");
116:
117: /** OUTSIDE2. */
118: public static final ItemLabelAnchor OUTSIDE2 = new ItemLabelAnchor(
119: "ItemLabelAnchor.OUTSIDE2");
120:
121: /** OUTSIDE3. */
122: public static final ItemLabelAnchor OUTSIDE3 = new ItemLabelAnchor(
123: "ItemLabelAnchor.OUTSIDE3");
124:
125: /** OUTSIDE4. */
126: public static final ItemLabelAnchor OUTSIDE4 = new ItemLabelAnchor(
127: "ItemLabelAnchor.OUTSIDE4");
128:
129: /** OUTSIDE5. */
130: public static final ItemLabelAnchor OUTSIDE5 = new ItemLabelAnchor(
131: "ItemLabelAnchor.OUTSIDE5");
132:
133: /** OUTSIDE6. */
134: public static final ItemLabelAnchor OUTSIDE6 = new ItemLabelAnchor(
135: "ItemLabelAnchor.OUTSIDE6");
136:
137: /** OUTSIDE7. */
138: public static final ItemLabelAnchor OUTSIDE7 = new ItemLabelAnchor(
139: "ItemLabelAnchor.OUTSIDE7");
140:
141: /** OUTSIDE8. */
142: public static final ItemLabelAnchor OUTSIDE8 = new ItemLabelAnchor(
143: "ItemLabelAnchor.OUTSIDE8");
144:
145: /** OUTSIDE9. */
146: public static final ItemLabelAnchor OUTSIDE9 = new ItemLabelAnchor(
147: "ItemLabelAnchor.OUTSIDE9");
148:
149: /** OUTSIDE10. */
150: public static final ItemLabelAnchor OUTSIDE10 = new ItemLabelAnchor(
151: "ItemLabelAnchor.OUTSIDE10");
152:
153: /** OUTSIDE11. */
154: public static final ItemLabelAnchor OUTSIDE11 = new ItemLabelAnchor(
155: "ItemLabelAnchor.OUTSIDE11");
156:
157: /** OUTSIDE12. */
158: public static final ItemLabelAnchor OUTSIDE12 = new ItemLabelAnchor(
159: "ItemLabelAnchor.OUTSIDE12");
160:
161: /** The name. */
162: private String name;
163:
164: /**
165: * Private constructor.
166: *
167: * @param name the name.
168: */
169: private ItemLabelAnchor(String name) {
170: this .name = name;
171: }
172:
173: /**
174: * Returns a string representing the object.
175: *
176: * @return The string.
177: */
178: public String 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 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 readResolve() throws ObjectStreamException {
216: ItemLabelAnchor result = null;
217: if (this.equals(ItemLabelAnchor.CENTER)) {
218: result = ItemLabelAnchor.CENTER;
219: } else if (this.equals(ItemLabelAnchor.INSIDE1)) {
220: result = ItemLabelAnchor.INSIDE1;
221: } else if (this.equals(ItemLabelAnchor.INSIDE2)) {
222: result = ItemLabelAnchor.INSIDE2;
223: } else if (this.equals(ItemLabelAnchor.INSIDE3)) {
224: result = ItemLabelAnchor.INSIDE3;
225: } else if (this.equals(ItemLabelAnchor.INSIDE4)) {
226: result = ItemLabelAnchor.INSIDE4;
227: } else if (this.equals(ItemLabelAnchor.INSIDE5)) {
228: result = ItemLabelAnchor.INSIDE5;
229: } else if (this.equals(ItemLabelAnchor.INSIDE6)) {
230: result = ItemLabelAnchor.INSIDE6;
231: } else if (this.equals(ItemLabelAnchor.INSIDE7)) {
232: result = ItemLabelAnchor.INSIDE7;
233: } else if (this.equals(ItemLabelAnchor.INSIDE8)) {
234: result = ItemLabelAnchor.INSIDE8;
235: } else if (this.equals(ItemLabelAnchor.INSIDE9)) {
236: result = ItemLabelAnchor.INSIDE9;
237: } else if (this.equals(ItemLabelAnchor.INSIDE10)) {
238: result = ItemLabelAnchor.INSIDE10;
239: } else if (this.equals(ItemLabelAnchor.INSIDE11)) {
240: result = ItemLabelAnchor.INSIDE11;
241: } else if (this.equals(ItemLabelAnchor.INSIDE12)) {
242: result = ItemLabelAnchor.INSIDE12;
243: } else if (this.equals(ItemLabelAnchor.OUTSIDE1)) {
244: result = ItemLabelAnchor.OUTSIDE1;
245: } else if (this.equals(ItemLabelAnchor.OUTSIDE2)) {
246: result = ItemLabelAnchor.OUTSIDE2;
247: } else if (this.equals(ItemLabelAnchor.OUTSIDE3)) {
248: result = ItemLabelAnchor.OUTSIDE3;
249: } else if (this.equals(ItemLabelAnchor.OUTSIDE4)) {
250: result = ItemLabelAnchor.OUTSIDE4;
251: } else if (this.equals(ItemLabelAnchor.OUTSIDE5)) {
252: result = ItemLabelAnchor.OUTSIDE5;
253: } else if (this.equals(ItemLabelAnchor.OUTSIDE6)) {
254: result = ItemLabelAnchor.OUTSIDE6;
255: } else if (this.equals(ItemLabelAnchor.OUTSIDE7)) {
256: result = ItemLabelAnchor.OUTSIDE7;
257: } else if (this.equals(ItemLabelAnchor.OUTSIDE8)) {
258: result = ItemLabelAnchor.OUTSIDE8;
259: } else if (this.equals(ItemLabelAnchor.OUTSIDE9)) {
260: result = ItemLabelAnchor.OUTSIDE9;
261: } else if (this.equals(ItemLabelAnchor.OUTSIDE10)) {
262: result = ItemLabelAnchor.OUTSIDE10;
263: } else if (this.equals(ItemLabelAnchor.OUTSIDE11)) {
264: result = ItemLabelAnchor.OUTSIDE11;
265: } else if (this.equals(ItemLabelAnchor.OUTSIDE12)) {
266: result = ItemLabelAnchor.OUTSIDE12;
267: }
268: return result;
269: }
270:
271: }
|