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     * CategoryItemRenderer.java
029     * -------------------------
030     *
031     * (C) Copyright 2001-2005, by Object Refinery Limited and Contributors.
032     *
033     * Original Author:  David Gilbert (for Object Refinery Limited);
034     * Contributor(s):   Mark Watson (www.markwatson.com);
035     *
036     * $Id: CategoryItemRenderer.java,v 1.10.2.1 2005/10/25 20:54:16 mungady Exp $
037     *
038     * Changes
039     * -------
040     * 23-Oct-2001 : Version 1 (DG);
041     * 16-Jan-2002 : Renamed HorizontalCategoryItemRenderer.java 
042     *               --> CategoryItemRenderer.java (DG);
043     * 05-Feb-2002 : Changed return type of the drawCategoryItem method from void 
044     *               to Shape, as part of the tooltips implementation (DG)        
045     *
046     *               NOTE (30-May-2002) : this has subsequently been changed back 
047     *               to void, tooltips are now collected along with entities in 
048     *               ChartRenderingInfo (DG);
049     *
050     * 14-Mar-2002 : Added the initialise method, and changed all bar plots to use 
051     *               this renderer (DG);
052     * 23-May-2002 : Added ChartRenderingInfo to the initialise method (DG);
053     * 29-May-2002 : Added the getAxisArea(Rectangle2D) method (DG);
054     * 06-Jun-2002 : Updated Javadoc comments (DG);
055     * 26-Jun-2002 : Added range axis to the initialise method (DG);
056     * 24-Sep-2002 : Added getLegendItem() method (DG);
057     * 23-Oct-2002 : Added methods to get/setToolTipGenerator (DG);
058     * 05-Nov-2002 : Replaced references to CategoryDataset with TableDataset (DG);
059     * 06-Nov-2002 : Added the domain axis to the drawCategoryItem method.  Renamed
060     *               drawCategoryItem() --> drawItem() (DG);
061     * 20-Nov-2002 : Changed signature of drawItem() method to reflect use of 
062     *               TableDataset (DG);
063     * 26-Nov-2002 : Replaced the isStacked() method with the getRangeType() 
064     *               method (DG);
065     * 08-Jan-2003 : Changed getSeriesCount() --> getRowCount() and
066     *               getCategoryCount() --> getColumnCount() (DG);
067     * 09-Jan-2003 : Changed name of grid-line methods (DG);
068     * 21-Jan-2003 : Merged TableDataset with CategoryDataset (DG);
069     * 10-Apr-2003 : Changed CategoryDataset to KeyedValues2DDataset in 
070     *               drawItem() method (DG);
071     * 29-Apr-2003 : Eliminated Renderer interface (DG);
072     * 02-Sep-2003 : Fix for bug 790407 (DG);
073     * 16-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG);
074     * 20-Oct-2003 : Added setOutlinePaint() method (DG);
075     * 06-Feb-2004 : Added missing methods, and moved deprecated methods (DG);
076     * 19-Feb-2004 : Added extra setXXXLabelsVisible() methods (DG);
077     * 29-Apr-2004 : Changed Integer --> int in initialise() method (DG);
078     * 18-May-2004 : Added methods for item label paint (DG);
079     * 05-Nov-2004 : Added getPassCount() method and 'pass' parameter to drawItem() 
080     *               method (DG);
081     * 07-Jan-2005 : Renamed getRangeExtent() --> findRangeBounds (DG);
082     * 11-Jan-2005 : Removed deprecated code in preparation for 1.0.0 release (DG);
083     * 23-Feb-2005 : Now extends LegendItemSource (DG);
084     * 20-Apr-2005 : Renamed CategoryLabelGenerator 
085     *               --> CategoryItemLabelGenerator (DG);
086     * 20-May-2005 : Added drawDomainMarker() method (DG);
087     * 
088     */
089    
090    package org.jfree.chart.renderer.category;
091    
092    import java.awt.Font;
093    import java.awt.Graphics2D;
094    import java.awt.Paint;
095    import java.awt.Shape;
096    import java.awt.Stroke;
097    import java.awt.geom.Rectangle2D;
098    
099    import org.jfree.chart.LegendItem;
100    import org.jfree.chart.LegendItemSource;
101    import org.jfree.chart.axis.CategoryAxis;
102    import org.jfree.chart.axis.ValueAxis;
103    import org.jfree.chart.event.RendererChangeEvent;
104    import org.jfree.chart.event.RendererChangeListener;
105    import org.jfree.chart.labels.CategoryItemLabelGenerator;
106    import org.jfree.chart.labels.CategoryToolTipGenerator;
107    import org.jfree.chart.labels.ItemLabelPosition;
108    import org.jfree.chart.plot.CategoryMarker;
109    import org.jfree.chart.plot.CategoryPlot;
110    import org.jfree.chart.plot.Marker;
111    import org.jfree.chart.plot.PlotRenderingInfo;
112    import org.jfree.chart.urls.CategoryURLGenerator;
113    import org.jfree.data.Range;
114    import org.jfree.data.category.CategoryDataset;
115    
116    /**
117     * A plug-in object that is used by the {@link CategoryPlot} class to display 
118     * individual data items from a {@link CategoryDataset}.
119     * <p>
120     * This interface defines the methods that must be provided by all renderers.  
121     * If you are implementing a custom renderer, you should consider extending the
122     * {@link AbstractCategoryItemRenderer} class.
123     * <p>
124     * Most renderer attributes are defined using a "three layer" approach.  When 
125     * looking up an attribute (for example, the outline paint) the renderer first 
126     * checks to see if there is a setting (in layer 0) that applies to ALL items 
127     * that the renderer draws.  If there is, that setting is used, but if it is 
128     * <code>null</code> the renderer looks up the next layer, which contains 
129     * "per series" settings for the attribute (many attributes are defined on a
130     * per series basis, so this is the layer that is most commonly used).  If the 
131     * layer 1 setting is <code>null</code>, the renderer will look up the final 
132     * layer, which provides a default or "base" setting.  Some attributes allow 
133     * the base setting to be <code>null</code>, while other attributes enforce 
134     * non-<code>null</code> values.
135     */
136    
137    public interface CategoryItemRenderer extends LegendItemSource {
138    
139        /**
140         * Returns the number of passes through the dataset required by the 
141         * renderer.  Usually this will be one, but some renderers may use
142         * a second or third pass to overlay items on top of things that were
143         * drawn in an earlier pass.
144         * 
145         * @return The pass count.
146         */
147        public int getPassCount();
148    
149        /**
150         * Returns the plot that the renderer has been assigned to (where 
151         * <code>null</code> indicates that the renderer is not currently assigned 
152         * to a plot).
153         *
154         * @return The plot (possibly <code>null</code>).
155         */
156        public CategoryPlot getPlot();
157    
158        /**
159         * Sets the plot that the renderer has been assigned to.  This method is 
160         * usually called by the {@link CategoryPlot}, in normal usage you 
161         * shouldn't need to call this method directly.
162         *
163         * @param plot  the plot (<code>null</code> not permitted).
164         */
165        public void setPlot(CategoryPlot plot);
166    
167        /**
168         * Adds a change listener.
169         * 
170         * @param listener  the listener.
171         */
172        public void addChangeListener(RendererChangeListener listener);
173        
174        /**
175         * Removes a change listener.
176         * 
177         * @param listener  the listener.
178         */
179        public void removeChangeListener(RendererChangeListener listener);
180    
181        /**
182         * Returns the range of values the renderer requires to display all the 
183         * items from the specified dataset.
184         * 
185         * @param dataset  the dataset (<code>null</code> permitted).
186         * 
187         * @return The range (or <code>null</code> if the dataset is 
188         *         <code>null</code> or empty).
189         */
190        public Range findRangeBounds(CategoryDataset dataset);
191        
192        /**
193         * Initialises the renderer.  This method will be called before the first 
194         * item is rendered, giving the renderer an opportunity to initialise any 
195         * state information it wants to maintain. The renderer can do nothing if 
196         * it chooses.
197         *
198         * @param g2  the graphics device.
199         * @param dataArea  the area inside the axes.
200         * @param plot  the plot.
201         * @param rendererIndex  the renderer index.
202         * @param info  collects chart rendering information for return to caller.
203         * 
204         * @return A state object (maintains state information relevant to one 
205         *         chart drawing).
206         */
207        public CategoryItemRendererState initialise(Graphics2D g2,
208                                                    Rectangle2D dataArea,
209                                                    CategoryPlot plot,
210                                                    int rendererIndex,
211                                                    PlotRenderingInfo info);
212                               
213        /**
214         * Returns a boolean that indicates whether or not the specified item 
215         * should be drawn (this is typically used to hide an entire series).
216         * 
217         * @param series  the series index.
218         * @param item  the item index.
219         * 
220         * @return A boolean.
221         */
222        public boolean getItemVisible(int series, int item);
223        
224        /**
225         * Returns a boolean that indicates whether or not the specified series 
226         * should be drawn (this is typically used to hide an entire series).
227         * 
228         * @param series  the series index.
229         * 
230         * @return A boolean.
231         */
232        public boolean isSeriesVisible(int series);
233        
234        /**
235         * Returns the flag that controls the visibility of ALL series.  This flag 
236         * overrides the per series and default settings - you must set it to 
237         * <code>null</code> if you want the other settings to apply.
238         * 
239         * @return The flag (possibly <code>null</code>).
240         */
241        public Boolean getSeriesVisible();
242        
243        /**
244         * Sets the flag that controls the visibility of ALL series and sends a 
245         * {@link RendererChangeEvent} to all registered listeners.  This flag 
246         * overrides the per series and default settings - you must set it to 
247         * <code>null</code> if you want the other settings to apply.
248         * 
249         * @param visible  the flag (<code>null</code> permitted).
250         */
251        public void setSeriesVisible(Boolean visible);
252        
253        /**
254         * Sets the flag that controls the visibility of ALL series and sends a 
255         * {@link RendererChangeEvent} to all registered listeners.  This flag 
256         * overrides the per series and default settings - you must set it to 
257         * <code>null</code> if you want the other settings to apply.
258         * 
259         * @param visible  the flag (<code>null</code> permitted).
260         * @param notify  notify listeners?
261         */
262        public void setSeriesVisible(Boolean visible, boolean notify);
263        
264        /**
265         * Returns the flag that controls whether a series is visible.
266         *
267         * @param series  the series index (zero-based).
268         *
269         * @return The flag (possibly <code>null</code>).
270         */
271        public Boolean getSeriesVisible(int series);
272        
273        /**
274         * Sets the flag that controls whether a series is visible and sends a 
275         * {@link RendererChangeEvent} to all registered listeners.
276         *
277         * @param series  the series index (zero-based).
278         * @param visible  the flag (<code>null</code> permitted).
279         */
280        public void setSeriesVisible(int series, Boolean visible);
281        
282        /**
283         * Sets the flag that controls whether a series is visible and, if 
284         * requested, sends a {@link RendererChangeEvent} to all registered 
285         * listeners.
286         * 
287         * @param series  the series index.
288         * @param visible  the flag (<code>null</code> permitted).
289         * @param notify  notify listeners?
290         */
291        public void setSeriesVisible(int series, Boolean visible, boolean notify);
292    
293        /**
294         * Returns the base visibility for all series.
295         *
296         * @return The base visibility.
297         */
298        public boolean getBaseSeriesVisible();
299    
300        /**
301         * Sets the base visibility and sends a {@link RendererChangeEvent} to all
302         * registered listeners.
303         *
304         * @param visible  the flag.
305         */
306        public void setBaseSeriesVisible(boolean visible);
307        
308        /**
309         * Sets the base visibility and, if requested, sends 
310         * a {@link RendererChangeEvent} to all registered listeners.
311         * 
312         * @param visible  the visibility.
313         * @param notify  notify listeners?
314         */
315        public void setBaseSeriesVisible(boolean visible, boolean notify);
316    
317        // SERIES VISIBLE IN LEGEND (not yet respected by all renderers)
318        
319        /**
320         * Returns <code>true</code> if the series should be shown in the legend,
321         * and <code>false</code> otherwise.
322         * 
323         * @param series  the series index.
324         * 
325         * @return A boolean.
326         */
327        public boolean isSeriesVisibleInLegend(int series);
328        
329        /**
330         * Returns the flag that controls the visibility of ALL series in the 
331         * legend.  This flag overrides the per series and default settings - you 
332         * must set it to <code>null</code> if you want the other settings to 
333         * apply.
334         * 
335         * @return The flag (possibly <code>null</code>).
336         */
337        public Boolean getSeriesVisibleInLegend();
338        
339        /**
340         * Sets the flag that controls the visibility of ALL series in the legend 
341         * and sends a {@link RendererChangeEvent} to all registered listeners.  
342         * This flag overrides the per series and default settings - you must set 
343         * it to <code>null</code> if you want the other settings to apply.
344         * 
345         * @param visible  the flag (<code>null</code> permitted).
346         */
347        public void setSeriesVisibleInLegend(Boolean visible);
348        
349        /**
350         * Sets the flag that controls the visibility of ALL series in the legend 
351         * and sends a {@link RendererChangeEvent} to all registered listeners.  
352         * This flag overrides the per series and default settings - you must set 
353         * it to <code>null</code> if you want the other settings to apply.
354         * 
355         * @param visible  the flag (<code>null</code> permitted).
356         * @param notify  notify listeners?
357         */
358        public void setSeriesVisibleInLegend(Boolean visible, boolean notify);
359        
360        /**
361         * Returns the flag that controls whether a series is visible in the 
362         * legend.  This method returns only the "per series" settings - to 
363         * incorporate the override and base settings as well, you need to use the 
364         * {@link #isSeriesVisibleInLegend(int)} method.
365         *
366         * @param series  the series index (zero-based).
367         *
368         * @return The flag (possibly <code>null</code>).
369         */
370        public Boolean getSeriesVisibleInLegend(int series);
371        
372        /**
373         * Sets the flag that controls whether a series is visible in the legend 
374         * and sends a {@link RendererChangeEvent} to all registered listeners.
375         *
376         * @param series  the series index (zero-based).
377         * @param visible  the flag (<code>null</code> permitted).
378         */
379        public void setSeriesVisibleInLegend(int series, Boolean visible);
380        
381        /**
382         * Sets the flag that controls whether a series is visible in the legend
383         * and, if requested, sends a {@link RendererChangeEvent} to all registered 
384         * listeners.
385         * 
386         * @param series  the series index.
387         * @param visible  the flag (<code>null</code> permitted).
388         * @param notify  notify listeners?
389         */
390        public void setSeriesVisibleInLegend(int series, Boolean visible, 
391                                             boolean notify);
392    
393        /**
394         * Returns the base visibility in the legend for all series.
395         *
396         * @return The base visibility.
397         */
398        public boolean getBaseSeriesVisibleInLegend();
399    
400        /**
401         * Sets the base visibility in the legend and sends a 
402         * {@link RendererChangeEvent} to all registered listeners.
403         *
404         * @param visible  the flag.
405         */
406        public void setBaseSeriesVisibleInLegend(boolean visible);
407        
408        /**
409         * Sets the base visibility in the legend and, if requested, sends 
410         * a {@link RendererChangeEvent} to all registered listeners.
411         * 
412         * @param visible  the visibility.
413         * @param notify  notify listeners?
414         */
415        public void setBaseSeriesVisibleInLegend(boolean visible, boolean notify);
416    
417    
418        //// PAINT /////////////////////////////////////////////////////////////////
419        
420        /**
421         * Returns the paint used to fill data items as they are drawn.
422         *
423         * @param row  the row (or series) index (zero-based).
424         * @param column  the column (or category) index (zero-based).
425         *
426         * @return The paint (never <code>null</code>).
427         */
428        public Paint getItemPaint(int row, int column);
429    
430        /**
431         * Sets the paint to be used for ALL series, and sends a 
432         * {@link RendererChangeEvent} to all registered listeners.  If this is 
433         * <code>null</code>, the renderer will use the paint for the series.
434         * 
435         * @param paint  the paint (<code>null</code> permitted).
436         */
437        public void setPaint(Paint paint);
438        
439        /**
440         * Returns the paint used to fill an item drawn by the renderer.
441         *
442         * @param series  the series index (zero-based).
443         *
444         * @return The paint (never <code>null</code>).
445         */
446        public Paint getSeriesPaint(int series);
447    
448        /**
449         * Sets the paint used for a series and sends a {@link RendererChangeEvent}
450         * to all registered listeners.
451         *
452         * @param series  the series index (zero-based).
453         * @param paint  the paint (<code>null</code> permitted).
454         */
455        public void setSeriesPaint(int series, Paint paint);
456        
457        /**
458         * Returns the base paint.
459         *
460         * @return The base paint (never <code>null</code>).
461         */
462        public Paint getBasePaint();
463    
464        /**
465         * Sets the base paint and sends a {@link RendererChangeEvent} to all 
466         * registered listeners.
467         *
468         * @param paint  the paint (<code>null</code> not permitted).
469         */
470        public void setBasePaint(Paint paint);
471        
472        //// OUTLINE PAINT /////////////////////////////////////////////////////////
473        
474        /**
475         * Returns the paint used to outline data items as they are drawn.
476         *
477         * @param row  the row (or series) index (zero-based).
478         * @param column  the column (or category) index (zero-based).
479         *
480         * @return The paint (never <code>null</code>).
481         */
482        public Paint getItemOutlinePaint(int row, int column);
483    
484        /**
485         * Sets the outline paint for ALL series (optional).
486         * 
487         * @param paint  the paint (<code>null</code> permitted).
488         */
489        public void setOutlinePaint(Paint paint);
490        
491        /**
492         * Returns the paint used to outline an item drawn by the renderer.
493         *
494         * @param series  the series (zero-based index).
495         *
496         * @return The paint (never <code>null</code>).
497         */
498        public Paint getSeriesOutlinePaint(int series);
499    
500        /**
501         * Sets the paint used for a series outline and sends a 
502         * {@link RendererChangeEvent} to all registered listeners.
503         *
504         * @param series  the series index (zero-based).
505         * @param paint  the paint (<code>null</code> permitted).
506         */
507        public void setSeriesOutlinePaint(int series, Paint paint);
508    
509        /**
510         * Returns the base outline paint.
511         *
512         * @return The paint (never <code>null</code>).
513         */
514        public Paint getBaseOutlinePaint();
515    
516        /**
517         * Sets the base outline paint and sends a {@link RendererChangeEvent} to 
518         * all registered listeners.
519         *
520         * @param paint  the paint (<code>null</code> not permitted).
521         */
522        public void setBaseOutlinePaint(Paint paint);
523    
524        //// STROKE ////////////////////////////////////////////////////////////////
525        
526        /**
527         * Returns the stroke used to draw data items.
528         *
529         * @param row  the row (or series) index (zero-based).
530         * @param column  the column (or category) index (zero-based).
531         *
532         * @return The stroke (never <code>null</code>).
533         */
534        public Stroke getItemStroke(int row, int column);
535    
536        /**
537         * Sets the stroke for ALL series and sends a {@link RendererChangeEvent} 
538         * to all registered listeners.
539         * 
540         * @param stroke  the stroke (<code>null</code> permitted).
541         */
542        public void setStroke(Stroke stroke);
543    
544        /**
545         * Returns the stroke used to draw the items in a series.
546         *
547         * @param series  the series (zero-based index).
548         *
549         * @return The stroke (never <code>null</code>).
550         */
551        public Stroke getSeriesStroke(int series);
552        
553        /**
554         * Sets the stroke used for a series and sends a 
555         * {@link RendererChangeEvent} to all registered listeners.
556         *
557         * @param series  the series index (zero-based).
558         * @param stroke  the stroke (<code>null</code> permitted).
559         */
560        public void setSeriesStroke(int series, Stroke stroke);
561    
562        /**
563         * Returns the base stroke.
564         *
565         * @return The base stroke (never <code>null</code>).
566         */
567        public Stroke getBaseStroke();
568    
569        /**
570         * Sets the base stroke.
571         *
572         * @param stroke  the stroke (<code>null</code> not permitted).
573         */
574        public void setBaseStroke(Stroke stroke);
575        
576        //// OUTLINE STROKE ////////////////////////////////////////////////////////
577        
578        /**
579         * Returns the stroke used to outline data items.
580         * <p>
581         * The default implementation passes control to the getSeriesOutlineStroke 
582         * method.  You can override this method if you require different behaviour.
583         *
584         * @param row  the row (or series) index (zero-based).
585         * @param column  the column (or category) index (zero-based).
586         *
587         * @return The stroke (never <code>null</code>).
588         */
589        public Stroke getItemOutlineStroke(int row, int column);
590    
591        /**
592         * Sets the outline stroke for ALL series and sends a 
593         * {@link RendererChangeEvent} to all registered listeners.
594         *
595         * @param stroke  the stroke (<code>null</code> permitted).
596         */
597        public void setOutlineStroke(Stroke stroke);
598        
599        /**
600         * Returns the stroke used to outline the items in a series.
601         *
602         * @param series  the series (zero-based index).
603         *
604         * @return The stroke (never <code>null</code>).
605         */
606        public Stroke getSeriesOutlineStroke(int series);
607    
608        /**
609         * Sets the outline stroke used for a series and sends a 
610         * {@link RendererChangeEvent} to all registered listeners.
611         *
612         * @param series  the series index (zero-based).
613         * @param stroke  the stroke (<code>null</code> permitted).
614         */
615        public void setSeriesOutlineStroke(int series, Stroke stroke);
616        
617        /**
618         * Returns the base outline stroke.
619         *
620         * @return The stroke (never <code>null</code>).
621         */
622        public Stroke getBaseOutlineStroke();
623    
624        /**
625         * Sets the base outline stroke and sends a {@link RendererChangeEvent} to 
626         * all registered listeners.
627         *
628         * @param stroke  the stroke (<code>null</code> not permitted).
629         */
630        public void setBaseOutlineStroke(Stroke stroke);
631        
632        //// SHAPE /////////////////////////////////////////////////////////////////
633        
634        /**
635         * Returns a shape used to represent a data item.
636         *
637         * @param row  the row (or series) index (zero-based).
638         * @param column  the column (or category) index (zero-based).
639         *
640         * @return The shape (never <code>null</code>).
641         */
642        public Shape getItemShape(int row, int column);
643    
644        /**
645         * Sets the shape for ALL series (optional) and sends a 
646         * {@link RendererChangeEvent} to all registered listeners.
647         * 
648         * @param shape  the shape (<code>null</code> permitted).
649         */
650        public void setShape(Shape shape);
651        
652        /**
653         * Returns a shape used to represent the items in a series.
654         *
655         * @param series  the series (zero-based index).
656         *
657         * @return The shape (never <code>null</code>).
658         */
659        public Shape getSeriesShape(int series);
660    
661        /**
662         * Sets the shape used for a series and sends a {@link RendererChangeEvent}
663         * to all registered listeners.
664         *
665         * @param series  the series index (zero-based).
666         * @param shape  the shape (<code>null</code> permitted).
667         */
668        public void setSeriesShape(int series, Shape shape);
669        
670        /**
671         * Returns the base shape.
672         *
673         * @return The shape (never <code>null</code>).
674         */
675        public Shape getBaseShape();
676    
677        /**
678         * Sets the base shape and sends a {@link RendererChangeEvent} to all 
679         * registered listeners.
680         *
681         * @param shape  the shape (<code>null</code> not permitted).
682         */
683        public void setBaseShape(Shape shape);
684        
685        // ITEM LABELS VISIBLE 
686        
687        /**
688         * Returns <code>true</code> if an item label is visible, and 
689         * <code>false</code> otherwise.
690         * 
691         * @param row  the row index (zero-based).
692         * @param column  the column index (zero-based).
693         * 
694         * @return A boolean.
695         */
696        public boolean isItemLabelVisible(int row, int column);
697        
698        /**
699         * Returns <code>true</code> if the item labels for a series are visible, 
700         * and <code>false</code> otherwise.
701         * 
702         * @param series  the series index (zero-based).
703         * 
704         * @return A boolean.
705         */    
706        public boolean isSeriesItemLabelsVisible(int series);
707        
708        /**
709         * Sets a flag that controls whether or not the item labels for ALL series 
710         * are visible.
711         * 
712         * @param visible  the flag.
713         */
714        public void setItemLabelsVisible(boolean visible);
715    
716        /**
717         * Sets a flag that controls whether or not the item labels for ALL series 
718         * are visible.
719         * 
720         * @param visible  the flag (<code>null</code> permitted).
721         */
722        public void setItemLabelsVisible(Boolean visible);
723    
724        /**
725         * Sets the visibility of item labels for ALL series and, if requested, 
726         * sends a {@link RendererChangeEvent} to all registered listeners.
727         * 
728         * @param visible  a flag that controls whether or not the item labels are
729         *                 visible (<code>null</code> permitted).
730         * @param notify  a flag that controls whether or not listeners are 
731         *                notified.
732         */
733        public void setItemLabelsVisible(Boolean visible, boolean notify);
734    
735        /**
736         * Sets a flag that controls the visibility of the item labels for a series.
737         * 
738         * @param series  the series index (zero-based).
739         * @param visible  the flag.
740         */
741        public void setSeriesItemLabelsVisible(int series, boolean visible);
742        
743        /**
744         * Sets a flag that controls the visibility of the item labels for a series.
745         * 
746         * @param series  the series index (zero-based).
747         * @param visible  the flag (<code>null</code> permitted).
748         */
749        public void setSeriesItemLabelsVisible(int series, Boolean visible);
750        
751        /**
752         * Sets the visibility of item labels for a series and, if requested, sends 
753         * a {@link RendererChangeEvent} to all registered listeners.
754         * 
755         * @param series  the series index (zero-based).
756         * @param visible  the visible flag.
757         * @param notify  a flag that controls whether or not listeners are 
758         *                notified.
759         */
760        public void setSeriesItemLabelsVisible(int series, Boolean visible, 
761                                               boolean notify);
762        
763        /**
764         * Returns the base setting for item label visibility.
765         * 
766         * @return A flag (possibly <code>null</code>).
767         */
768        public Boolean getBaseItemLabelsVisible();
769        
770        /**
771         * Sets the base flag that controls whether or not item labels are visible.
772         * 
773         * @param visible  the flag.
774         */
775        public void setBaseItemLabelsVisible(boolean visible);
776        
777        /**
778         * Sets the base setting for item label visibility.
779         * 
780         * @param visible  the flag (<code>null</code> permitted).
781         */
782        public void setBaseItemLabelsVisible(Boolean visible);
783        
784        /**
785         * Sets the base visibility for item labels and, if requested, sends a 
786         * {@link RendererChangeEvent} to all registered listeners.
787         * 
788         * @param visible  the visibility flag.
789         * @param notify  a flag that controls whether or not listeners are 
790         *                notified.
791         */
792        public void setBaseItemLabelsVisible(Boolean visible, boolean notify);
793        
794        // ITEM LABEL GENERATOR
795        
796        /**
797         * Returns the item label generator for the specified data item.
798         *
799         * @param series  the series index (zero-based).
800         * @param item  the item index (zero-based).
801         *
802         * @return The generator (possibly <code>null</code>).
803         */
804        public CategoryItemLabelGenerator getItemLabelGenerator(int series, 
805                int item);
806    
807        /**
808         * Returns the item label generator for a series.
809         *
810         * @param series  the series index (zero-based).
811         *
812         * @return The label generator (possibly <code>null</code>).
813         */
814        public CategoryItemLabelGenerator getSeriesItemLabelGenerator(int series);
815    
816        /**
817         * Sets the item label generator for ALL series and sends a 
818         * {@link RendererChangeEvent} to all registered listeners.  This overrides 
819         * the per-series settings. 
820         * 
821         * @param generator  the generator (<code>null</code> permitted).
822         */
823        public void setItemLabelGenerator(CategoryItemLabelGenerator generator);
824        
825        /**
826         * Sets the item label generator for a series and sends a 
827         * {@link RendererChangeEvent} to all registered listeners.  
828         *
829         * @param series  the series index (zero-based).
830         * @param generator  the generator.
831         */
832        public void setSeriesItemLabelGenerator(
833                int series, CategoryItemLabelGenerator generator);
834    
835        /**
836         * Returns the base item label generator.
837         *
838         * @return The generator (possibly <code>null</code>).
839         */
840        public CategoryItemLabelGenerator getBaseItemLabelGenerator();
841    
842        /**
843         * Sets the base item label generator and sends a 
844         * {@link RendererChangeEvent} to all registered listeners.
845         *
846         * @param generator  the generator (<code>null</code> permitted).
847         */
848        public void setBaseItemLabelGenerator(CategoryItemLabelGenerator generator);
849    
850        // TOOL TIP GENERATOR
851        
852        /**
853         * Returns the tool tip generator that should be used for the specified 
854         * item.  This method looks up the generator using the "three-layer" 
855         * approach outlined in the general description of this interface.  
856         *
857         * @param row  the row index (zero-based).
858         * @param column  the column index (zero-based).
859         *
860         * @return The generator (possibly <code>null</code>).
861         */
862        public CategoryToolTipGenerator getToolTipGenerator(int row, int column);
863    
864        /**
865         * Returns the tool tip generator that will be used for ALL items in the 
866         * dataset (the "layer 0" generator).
867         * 
868         * @return A tool tip generator (possibly <code>null</code>).
869         */
870        public CategoryToolTipGenerator getToolTipGenerator();
871    
872        /**
873         * Sets the tool tip generator for ALL series and sends a 
874         * {@link org.jfree.chart.event.RendererChangeEvent} to all registered 
875         * listeners.
876         * 
877         * @param generator  the generator (<code>null</code> permitted).
878         */
879        public void setToolTipGenerator(CategoryToolTipGenerator generator);
880        
881        /**
882         * Returns the tool tip generator for the specified series (a "layer 1" 
883         * generator).
884         *
885         * @param series  the series index (zero-based).
886         *
887         * @return The tool tip generator (possibly <code>null</code>).
888         */
889        public CategoryToolTipGenerator getSeriesToolTipGenerator(int series);
890    
891        /**
892         * Sets the tool tip generator for a series and sends a 
893         * {@link org.jfree.chart.event.RendererChangeEvent} to all registered 
894         * listeners.
895         *
896         * @param series  the series index (zero-based).
897         * @param generator  the generator (<code>null</code> permitted).
898         */
899        public void setSeriesToolTipGenerator(int series, 
900                                              CategoryToolTipGenerator generator);
901    
902        /**
903         * Returns the base tool tip generator (the "layer 2" generator).
904         *
905         * @return The tool tip generator (possibly <code>null</code>).
906         */
907        public CategoryToolTipGenerator getBaseToolTipGenerator();
908    
909        /**
910         * Sets the base tool tip generator and sends a 
911         * {@link org.jfree.chart.event.RendererChangeEvent} to all registered 
912         * listeners.
913         *
914         * @param generator  the generator (<code>null</code> permitted).
915         */
916        public void setBaseToolTipGenerator(CategoryToolTipGenerator generator);
917    
918        //// ITEM LABEL FONT  //////////////////////////////////////////////////////
919        
920        /**
921         * Returns the font for an item label.
922         * 
923         * @param row  the row index (zero-based).
924         * @param column  the column index (zero-based).
925         * 
926         * @return The font (never <code>null</code>).
927         */
928        public Font getItemLabelFont(int row, int column);
929    
930        /**
931         * Returns the font used for all item labels.  This may be 
932         * <code>null</code>, in which case the per series font settings will apply.
933         * 
934         * @return The font (possibly <code>null</code>).
935         */
936        public Font getItemLabelFont();
937        
938        /**
939         * Sets the item label font for ALL series and sends a 
940         * {@link RendererChangeEvent} to all registered listeners.  You can set 
941         * this to <code>null</code> if you prefer to set the font on a per series 
942         * basis.
943         * 
944         * @param font  the font (<code>null</code> permitted).
945         */
946        public void setItemLabelFont(Font font);
947        
948        /**
949         * Returns the font for all the item labels in a series.
950         * 
951         * @param series  the series index (zero-based).
952         * 
953         * @return The font (possibly <code>null</code>).
954         */
955        public Font getSeriesItemLabelFont(int series);
956    
957        /**
958         * Sets the item label font for a series and sends a 
959         * {@link RendererChangeEvent} to all registered listeners.  
960         * 
961         * @param series  the series index (zero-based).
962         * @param font  the font (<code>null</code> permitted).
963         */
964        public void setSeriesItemLabelFont(int series, Font font);
965    
966        /**
967         * Returns the base item label font (this is used when no other font 
968         * setting is available).
969         * 
970         * @return The font (<code>never</code> null).
971         */
972        public Font getBaseItemLabelFont();
973    
974        /**
975         * Sets the base item label font and sends a {@link RendererChangeEvent} 
976         * to all registered listeners.  
977         * 
978         * @param font  the font (<code>null</code> not permitted).
979         */
980        public void setBaseItemLabelFont(Font font);
981        
982        //// ITEM LABEL PAINT  /////////////////////////////////////////////////////
983    
984        /**
985         * Returns the paint used to draw an item label.
986         * 
987         * @param row  the row index (zero based).
988         * @param column  the column index (zero based).
989         * 
990         * @return The paint (never <code>null</code>).
991         */
992        public Paint getItemLabelPaint(int row, int column);
993        
994        /**
995         * Returns the paint used for all item labels.  This may be 
996         * <code>null</code>, in which case the per series paint settings will 
997         * apply.
998         * 
999         * @return The paint (possibly <code>null</code>).
1000         */
1001        public Paint getItemLabelPaint();
1002    
1003        /**
1004         * Sets the item label paint for ALL series and sends a 
1005         * {@link RendererChangeEvent} to all registered listeners.
1006         * 
1007         * @param paint  the paint (<code>null</code> permitted).
1008         */
1009        public void setItemLabelPaint(Paint paint);
1010    
1011        /**
1012         * Returns the paint used to draw the item labels for a series.
1013         * 
1014         * @param series  the series index (zero based).
1015         * 
1016         * @return The paint (possibly <code>null<code>).
1017         */
1018        public Paint getSeriesItemLabelPaint(int series);
1019    
1020        /**
1021         * Sets the item label paint for a series and sends a 
1022         * {@link RendererChangeEvent} to all registered listeners.
1023         * 
1024         * @param series  the series (zero based index).
1025         * @param paint  the paint (<code>null</code> permitted).
1026         */
1027        public void setSeriesItemLabelPaint(int series, Paint paint);
1028        
1029        /**
1030         * Returns the base item label paint.
1031         * 
1032         * @return The paint (never <code>null<code>).
1033         */
1034        public Paint getBaseItemLabelPaint();
1035    
1036        /**
1037         * Sets the base item label paint and sends a {@link RendererChangeEvent} 
1038         * to all registered listeners.
1039         * 
1040         * @param paint  the paint (<code>null</code> not permitted).
1041         */
1042        public void setBaseItemLabelPaint(Paint paint);
1043        
1044        // POSITIVE ITEM LABEL POSITION...
1045    
1046        /**
1047         * Returns the item label position for positive values.
1048         * 
1049         * @param row  the row index (zero-based).
1050         * @param column  the column index (zero-based).
1051         * 
1052         * @return The item label position (never <code>null</code>).
1053         */
1054        public ItemLabelPosition getPositiveItemLabelPosition(int row, int column);
1055    
1056        /**
1057         * Returns the item label position for positive values in ALL series.
1058         * 
1059         * @return The item label position (possibly <code>null</code>).
1060         */
1061        public ItemLabelPosition getPositiveItemLabelPosition();
1062    
1063        /**
1064         * Sets the item label position for positive values in ALL series, and 
1065         * sends a {@link RendererChangeEvent} to all registered listeners.  You 
1066         * need to set this to <code>null</code> to expose the settings for 
1067         * individual series.
1068         * 
1069         * @param position  the position (<code>null</code> permitted).
1070         */
1071        public void setPositiveItemLabelPosition(ItemLabelPosition position);
1072        
1073        /**
1074         * Sets the positive item label position for ALL series and (if requested) 
1075         * sends a {@link RendererChangeEvent} to all registered listeners.
1076         * 
1077         * @param position  the position (<code>null</code> permitted).
1078         * @param notify  notify registered listeners?
1079         */
1080        public void setPositiveItemLabelPosition(ItemLabelPosition position, 
1081                                                 boolean notify);
1082    
1083        /**
1084         * Returns the item label position for all positive values in a series.
1085         * 
1086         * @param series  the series index (zero-based).
1087         * 
1088         * @return The item label position.
1089         */
1090        public ItemLabelPosition getSeriesPositiveItemLabelPosition(int series);
1091        
1092        /**
1093         * Sets the item label position for all positive values in a series and 
1094         * sends a {@link RendererChangeEvent} to all registered listeners.
1095         * 
1096         * @param series  the series index (zero-based).
1097         * @param position  the position (<code>null</code> permitted).
1098         */
1099        public void setSeriesPositiveItemLabelPosition(int series, 
1100                                                       ItemLabelPosition position);
1101    
1102        /**
1103         * Sets the item label position for all positive values in a series and (if
1104         * requested) sends a {@link RendererChangeEvent} to all registered 
1105         * listeners.
1106         * 
1107         * @param series  the series index (zero-based).
1108         * @param position  the position (<code>null</code> permitted).
1109         * @param notify  notify registered listeners?
1110         */
1111        public void setSeriesPositiveItemLabelPosition(int series, 
1112                                                       ItemLabelPosition position, 
1113            boolean notify);
1114    
1115        /**
1116         * Returns the base positive item label position.
1117         * 
1118         * @return The position.
1119         */
1120        public ItemLabelPosition getBasePositiveItemLabelPosition();
1121    
1122        /**
1123         * Sets the base positive item label position.
1124         * 
1125         * @param position  the position.
1126         */
1127        public void setBasePositiveItemLabelPosition(ItemLabelPosition position);
1128        
1129        /**
1130         * Sets the base positive item label position and, if requested, sends a 
1131         * {@link RendererChangeEvent} to all registered listeners.
1132         * 
1133         * @param position  the position.
1134         * @param notify  notify registered listeners?
1135         */
1136        public void setBasePositiveItemLabelPosition(ItemLabelPosition position, 
1137                                                     boolean notify);
1138        
1139        
1140        // NEGATIVE ITEM LABEL POSITION...
1141    
1142        /**
1143         * Returns the item label position for negative values.  This method can be
1144         * overridden to provide customisation of the item label position for 
1145         * individual data items.
1146         * 
1147         * @param row  the row index (zero-based).
1148         * @param column  the column (zero-based).
1149         * 
1150         * @return The item label position.
1151         */
1152        public ItemLabelPosition getNegativeItemLabelPosition(int row, int column);
1153    
1154        /**
1155         * Returns the item label position for negative values in ALL series.
1156         * 
1157         * @return The item label position (possibly <code>null</code>).
1158         */
1159        public ItemLabelPosition getNegativeItemLabelPosition();
1160    
1161        /**
1162         * Sets the item label position for negative values in ALL series, and 
1163         * sends a {@link RendererChangeEvent} to all registered listeners.  You 
1164         * need to set this to <code>null</code> to expose the settings for 
1165         * individual series.
1166         * 
1167         * @param position  the position (<code>null</code> permitted).
1168         */
1169        public void setNegativeItemLabelPosition(ItemLabelPosition position);
1170        
1171        /**
1172         * Sets the item label position for negative values in ALL series and (if 
1173         * requested) sends a {@link RendererChangeEvent} to all registered 
1174         * listeners.  
1175         * 
1176         * @param position  the position (<code>null</code> permitted).
1177         * @param notify  notify registered listeners?
1178         */
1179        public void setNegativeItemLabelPosition(ItemLabelPosition position, 
1180                                                 boolean notify);
1181    
1182        /**
1183         * Returns the item label position for all negative values in a series.
1184         * 
1185         * @param series  the series index (zero-based).
1186         * 
1187         * @return The item label position.
1188         */
1189        public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series);
1190    
1191        /**
1192         * Sets the item label position for negative values in a series and sends a 
1193         * {@link RendererChangeEvent} to all registered listeners.
1194         * 
1195         * @param series  the series index (zero-based).
1196         * @param position  the position (<code>null</code> permitted).
1197         */
1198        public void setSeriesNegativeItemLabelPosition(int series, 
1199                                                       ItemLabelPosition position);
1200    
1201        /**
1202         * Sets the item label position for negative values in a series and (if 
1203         * requested) sends a {@link RendererChangeEvent} to all registered 
1204         * listeners.
1205         * 
1206         * @param series  the series index (zero-based).
1207         * @param position  the position (<code>null</code> permitted).
1208         * @param notify  notify registered listeners?
1209         */
1210        public void setSeriesNegativeItemLabelPosition(int series, 
1211                                                       ItemLabelPosition position, 
1212                                                       boolean notify);
1213    
1214        /**
1215         * Returns the base item label position for negative values.
1216         * 
1217         * @return The position.
1218         */
1219        public ItemLabelPosition getBaseNegativeItemLabelPosition();
1220    
1221        /**
1222         * Sets the base item label position for negative values and sends a 
1223         * {@link RendererChangeEvent} to all registered listeners.
1224         * 
1225         * @param position  the position.
1226         */
1227        public void setBaseNegativeItemLabelPosition(ItemLabelPosition position);
1228        
1229        /**
1230         * Sets the base negative item label position and, if requested, sends a 
1231         * {@link RendererChangeEvent} to all registered listeners.
1232         * 
1233         * @param position  the position.
1234         * @param notify  notify registered listeners?
1235         */
1236        public void setBaseNegativeItemLabelPosition(ItemLabelPosition position, 
1237                                                     boolean notify);
1238        
1239        // ITEM URL GENERATOR
1240        
1241        /**
1242         * Returns the URL generator for an item.
1243         *
1244         * @param series  the series index (zero-based).
1245         * @param item  the item index (zero-based).
1246         *
1247         * @return The item URL generator.
1248         */
1249        public CategoryURLGenerator getItemURLGenerator(int series, int item);
1250    
1251        /**
1252         * Returns the item URL generator for a series.
1253         *
1254         * @param series  the series index (zero-based).
1255         *
1256         * @return The URL generator.
1257         */
1258        public CategoryURLGenerator getSeriesItemURLGenerator(int series);
1259    
1260        /**
1261         * Sets the item URL generator for ALL series. 
1262         * 
1263         * @param generator  the generator.
1264         */
1265        public void setItemURLGenerator(CategoryURLGenerator generator);
1266        
1267        /**
1268         * Sets the item URL generator for a series.
1269         *
1270         * @param series  the series index (zero-based).
1271         * @param generator  the generator.
1272         */
1273        public void setSeriesItemURLGenerator(int series, 
1274                                              CategoryURLGenerator generator);
1275    
1276        /**
1277         * Returns the base item URL generator.
1278         *
1279         * @return The item URL generator.
1280         */
1281        public CategoryURLGenerator getBaseItemURLGenerator();
1282    
1283        /**
1284         * Sets the base item URL generator.
1285         *
1286         * @param generator  the item URL generator.
1287         */
1288        public void setBaseItemURLGenerator(CategoryURLGenerator generator);
1289    
1290        /**
1291         * Returns a legend item for a series.
1292         *
1293         * @param datasetIndex  the dataset index (zero-based).
1294         * @param series  the series (zero-based index).
1295         *
1296         * @return The legend item (possibly <code>null</code>).
1297         */
1298        public LegendItem getLegendItem(int datasetIndex, int series);
1299    
1300        /**
1301         * Draws a background for the data area.
1302         *
1303         * @param g2  the graphics device.
1304         * @param plot  the plot.
1305         * @param dataArea  the data area.
1306         */
1307        public void drawBackground(Graphics2D g2,
1308                                   CategoryPlot plot,
1309                                   Rectangle2D dataArea);
1310    
1311        /**
1312         * Draws an outline for the data area.
1313         *
1314         * @param g2  the graphics device.
1315         * @param plot  the plot.
1316         * @param dataArea  the data area.
1317         */
1318        public void drawOutline(Graphics2D g2,
1319                                CategoryPlot plot,
1320                                Rectangle2D dataArea);
1321    
1322        /**
1323         * Draws a single data item.
1324         *
1325         * @param g2  the graphics device.
1326         * @param state  state information for one chart.
1327         * @param dataArea  the data plot area.
1328         * @param plot  the plot.
1329         * @param domainAxis  the domain axis.
1330         * @param rangeAxis  the range axis.
1331         * @param dataset  the data.
1332         * @param row  the row index (zero-based).
1333         * @param column  the column index (zero-based).
1334         * @param pass  the pass index.
1335         */
1336        public void drawItem(Graphics2D g2,
1337                             CategoryItemRendererState state,
1338                             Rectangle2D dataArea,
1339                             CategoryPlot plot,
1340                             CategoryAxis domainAxis,
1341                             ValueAxis rangeAxis,
1342                             CategoryDataset dataset,
1343                             int row,
1344                             int column,
1345                             int pass);
1346    
1347        /**
1348         * Draws a grid line against the domain axis.
1349         *
1350         * @param g2  the graphics device.
1351         * @param plot  the plot.
1352         * @param dataArea  the area for plotting data (not yet adjusted for any 
1353         *                  3D effect).
1354         * @param value  the value.
1355         */
1356        public void drawDomainGridline(Graphics2D g2,
1357                                       CategoryPlot plot,
1358                                       Rectangle2D dataArea,
1359                                       double value);
1360    
1361        /**
1362         * Draws a grid line against the range axis.
1363         *
1364         * @param g2  the graphics device.
1365         * @param plot  the plot.
1366         * @param axis  the value axis.
1367         * @param dataArea  the area for plotting data (not yet adjusted for any 
1368         *                  3D effect).
1369         * @param value  the value.
1370         */
1371        public void drawRangeGridline(Graphics2D g2,
1372                                      CategoryPlot plot,
1373                                      ValueAxis axis,
1374                                      Rectangle2D dataArea,
1375                                      double value);
1376    
1377        /**
1378         * Draws a line (or some other marker) to indicate a particular category on 
1379         * the domain axis.
1380         *
1381         * @param g2  the graphics device.
1382         * @param plot  the plot.
1383         * @param axis  the category axis.
1384         * @param marker  the marker.
1385         * @param dataArea  the area for plotting data (not including 3D effect).
1386         */
1387        public void drawDomainMarker(Graphics2D g2,
1388                                     CategoryPlot plot,
1389                                     CategoryAxis axis,
1390                                     CategoryMarker marker,
1391                                     Rectangle2D dataArea);
1392    
1393        /**
1394         * Draws a line (or some other marker) to indicate a particular value on 
1395         * the range axis.
1396         *
1397         * @param g2  the graphics device.
1398         * @param plot  the plot.
1399         * @param axis  the value axis.
1400         * @param marker  the marker.
1401         * @param dataArea  the area for plotting data (not including 3D effect).
1402         */
1403        public void drawRangeMarker(Graphics2D g2,
1404                                    CategoryPlot plot,
1405                                    ValueAxis axis,
1406                                    Marker marker,
1407                                    Rectangle2D dataArea);
1408    
1409    }