001: /* ===========================================================
002: * JFreeChart : a free chart library for the Java(tm) platform
003: * ===========================================================
004: *
005: * (C) Copyright 2000-2006, 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: * DrawableLegendItem.java
029: * -----------------------
030: * (C) Copyright 2002-2006, by Object Refinery Limited and Contributors.
031: *
032: * Original Author: David Gilbert (for Object Refinery Limited);
033: * Contributor(s): Luke Quinane;
034: * Barak Naveh;
035: *
036: * $Id: DrawableLegendItem.java,v 1.3.2.2 2006/08/01 16:10:44 mungady Exp $
037: *
038: * Changes
039: * -------
040: * 07-Feb-2002 : Version 1 (DG);
041: * 23-Sep-2002 : Renamed LegendItem --> DrawableLegendItem (DG);
042: * 02-Oct-2002 : Fixed errors reported by Checkstyle (DG);
043: * 08-Oct-2003 : Applied patch for displaying series line style, contributed by
044: * Luke Quinane (DG);
045: * 27-Mar-2004 : Added getMaxX() and getMaxY() methods (BN);
046: * 27-Jan-2005 : Cleared out code that belongs in the LegendItem class (DG);
047: *
048: */
049:
050: package org.jfree.chart;
051:
052: import java.awt.Shape;
053: import java.awt.geom.Line2D;
054: import java.awt.geom.Point2D;
055:
056: /**
057: * This class contains a single legend item along with position details for
058: * drawing the item on a particular chart.
059: *
060: * @deprecated This class is not used by JFreeChart.
061: */
062: public class DrawableLegendItem {
063:
064: /**
065: * The legend item (encapsulates information about the label, color and
066: * shape).
067: */
068: private LegendItem item;
069:
070: /** The x-coordinate for the item's location. */
071: private double x;
072:
073: /** The y-coordinate for the item's location. */
074: private double y;
075:
076: /** The width of the item. */
077: private double width;
078:
079: /** The height of the item. */
080: private double height;
081:
082: /** A shape used to indicate color on the legend. */
083: private Shape marker;
084:
085: /** A line used to indicate the series stroke on the legend */
086: private Line2D line;
087:
088: /** The label position within the item. */
089: private Point2D labelPosition;
090:
091: /**
092: * Create a legend item.
093: *
094: * @param item the legend item for display.
095: */
096: public DrawableLegendItem(LegendItem item) {
097: this .item = item;
098: }
099:
100: /**
101: * Returns the legend item.
102: *
103: * @return The legend item.
104: */
105: public LegendItem getItem() {
106: return this .item;
107: }
108:
109: /**
110: * Get the x-coordinate for the item's location.
111: *
112: * @return The x-coordinate for the item's location.
113: */
114: public double getX() {
115: return this .x;
116: }
117:
118: /**
119: * Set the x-coordinate for the item's location.
120: *
121: * @param x the x-coordinate.
122: */
123: public void setX(double x) {
124: this .x = x;
125: }
126:
127: /**
128: * Get the y-coordinate for the item's location.
129: *
130: * @return The y-coordinate for the item's location.
131: */
132: public double getY() {
133: return this .y;
134: }
135:
136: /**
137: * Set the y-coordinate for the item's location.
138: *
139: * @param y the y-coordinate.
140: */
141: public void setY(double y) {
142: this .y = y;
143: }
144:
145: /**
146: * Get the width of this item.
147: *
148: * @return The width.
149: */
150: public double getWidth() {
151: return this .width;
152: }
153:
154: /**
155: * Get the height of this item.
156: *
157: * @return The height.
158: */
159: public double getHeight() {
160: return this .height;
161: }
162:
163: /**
164: * Returns the largest X coordinate of the framing rectangle of this legend
165: * item.
166: *
167: * @return The largest x coordinate of the framing rectangle of this legend
168: * item.
169: */
170: public double getMaxX() {
171: return getX() + getWidth();
172: }
173:
174: /**
175: * Returns the largest Y coordinate of the framing rectangle of this legend
176: * item.
177: *
178: * @return The largest Y coordinate of the framing rectangle of this legend
179: * item.
180: */
181: public double getMaxY() {
182: return getY() + getHeight();
183: }
184:
185: /**
186: * Get the marker.
187: *
188: * @return The shape used to indicate color on the legend for this item.
189: */
190: public Shape getMarker() {
191: return this .marker;
192: }
193:
194: /**
195: * Set the marker.
196: *
197: * @param marker a shape used to indicate color on the legend for this
198: * item.
199: */
200: public void setMarker(Shape marker) {
201: this .marker = marker;
202: }
203:
204: /**
205: * Sets the line used to label this series.
206: *
207: * @param l the new line to use.
208: */
209: public void setLine(Line2D l) {
210: this .line = l;
211: }
212:
213: /**
214: * Returns the list.
215: *
216: * @return The line.
217: */
218: public Line2D getLine() {
219: return this .line;
220: }
221:
222: /**
223: * Returns the label position.
224: *
225: * @return The label position.
226: */
227: public Point2D getLabelPosition() {
228: return this .labelPosition;
229: }
230:
231: /**
232: * Sets the label position.
233: *
234: * @param position the label position.
235: */
236: public void setLabelPosition(Point2D position) {
237: this .labelPosition = position;
238: }
239:
240: /**
241: * Set the bounds of this item.
242: *
243: * @param x x-coordinate for the item's location.
244: * @param y y-coordinate for the item's location.
245: * @param width the width of this item.
246: * @param height the height of this item.
247: */
248: public void setBounds(double x, double y, double width,
249: double height) {
250: this.x = x;
251: this.y = y;
252: this.width = width;
253: this.height = height;
254: }
255:
256: }
|