KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > entity > LegendItemEntity


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 License
20  * along with this library; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
24  * in the United States and other countries.]
25  *
26  * ---------------------
27  * LegendItemEntity.java
28  * ---------------------
29  * (C) Copyright 2003-2005, by Object Refinery Limited and Contributors.
30  *
31  * Original Author: David Gilbert (for Object Refinery Limited);
32  * Contributor(s): -;
33  *
34  * $Id: LegendItemEntity.java,v 1.3 2005/05/19 15:42:54 mungady Exp $
35  *
36  * Changes:
37  * --------
38  * 05-Jun-2003 : Version 1 (DG);
39  * 20-May-2004 : Added equals() method and implemented Cloneable and
40  * Serializable (DG);
41  *
42  */

43
44 package org.jfree.chart.entity;
45
46 import java.awt.Shape JavaDoc;
47 import java.io.Serializable JavaDoc;
48
49 /**
50  * An entity that represents an item within a legend.
51  */

52 public class LegendItemEntity extends ChartEntity
53                               implements Cloneable JavaDoc, Serializable JavaDoc {
54
55     /** For serialization. */
56     private static final long serialVersionUID = -7435683933545666702L;
57     
58     /** The series index. */
59     private int seriesIndex;
60
61     /**
62      * Creates a legend item entity.
63      *
64      * @param area the area.
65      */

66     public LegendItemEntity(Shape JavaDoc area) {
67         super(area);
68     }
69
70     /**
71      * Returns the series index.
72      *
73      * @return The series index.
74      */

75     public int getSeriesIndex() {
76         return this.seriesIndex;
77     }
78
79     /**
80      * Sets the series index.
81      *
82      * @param index the series index.
83      */

84     public void setSeriesIndex(int index) {
85         this.seriesIndex = index;
86     }
87     
88     /**
89      * Tests this object for equality with an arbitrary object.
90      *
91      * @param obj the object (<code>null</code> permitted).
92      *
93      * @return A boolean.
94      */

95     public boolean equals(Object JavaDoc obj) {
96         if (obj == this) {
97             return true;
98         }
99         if (obj instanceof LegendItemEntity && super.equals(obj)) {
100             LegendItemEntity e = (LegendItemEntity) obj;
101             if (this.seriesIndex != e.seriesIndex) {
102                 return false;
103             }
104             return true;
105         }
106         return false;
107     }
108     
109     /**
110      * Returns a clone of the entity.
111      *
112      * @return A clone.
113      *
114      * @throws CloneNotSupportedException if there is a problem cloning the
115      * object.
116      */

117     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
118         return super.clone();
119     }
120
121 }
122
Popular Tags