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