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. * AbstractRenderer.java
  28. * ---------------------
  29. * (C) Copyright 2002-2005, by Object Refinery Limited.
  30. *
  31. * Original Author: David Gilbert (for Object Refinery Limited);
  32. * Contributor(s): Nicolas Brodu;
  33. *
  34. * $Id: AbstractRenderer.java,v 1.14 2005/03/09 22:06:36 mungady Exp $
  35. *
  36. * Changes:
  37. * --------
  38. * 22-Aug-2002 : Version 1, draws code out of AbstractXYItemRenderer to share
  39. * with AbstractCategoryItemRenderer (DG);
  40. * 01-Oct-2002 : Fixed errors reported by Checkstyle (DG);
  41. * 06-Nov-2002 : Moved to the com.jrefinery.chart.renderer package (DG);
  42. * 21-Nov-2002 : Added a paint table for the renderer to use (DG);
  43. * 17-Jan-2003 : Moved plot classes into a separate package (DG);
  44. * 25-Mar-2003 : Implemented Serializable (DG);
  45. * 29-Apr-2003 : Added valueLabelFont and valueLabelPaint attributes, based on
  46. * code from Arnaud Lelievre (DG);
  47. * 29-Jul-2003 : Amended code that doesn't compile with JDK 1.2.2 (DG);
  48. * 13-Aug-2003 : Implemented Cloneable (DG);
  49. * 15-Sep-2003 : Fixed serialization (NB);
  50. * 17-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG);
  51. * 07-Oct-2003 : Moved PlotRenderingInfo into RendererState to allow for
  52. * multiple threads using a single renderer (DG);
  53. * 20-Oct-2003 : Added missing setOutlinePaint() method (DG);
  54. * 23-Oct-2003 : Split item label attributes into 'positive' and 'negative'
  55. * values (DG);
  56. * 26-Nov-2003 : Added methods to get the positive and negative item label
  57. * positions (DG);
  58. * 01-Mar-2004 : Modified readObject() method to prevent null pointer exceptions
  59. * after deserialization (DG);
  60. * 19-Jul-2004 : Fixed bug in getItemLabelFont(int, int) method (DG);
  61. * 04-Oct-2004 : Updated equals() method, eliminated use of NumberUtils,
  62. * renamed BooleanUtils --> BooleanUtilities, ShapeUtils -->
  63. * ShapeUtilities (DG);
  64. *
  65. */
  66. package org.jfree.chart.renderer;
  67. import java.awt.BasicStroke;
  68. import java.awt.Color;
  69. import java.awt.Font;
  70. import java.awt.Paint;
  71. import java.awt.Shape;
  72. import java.awt.Stroke;
  73. import java.awt.geom.Point2D;
  74. import java.awt.geom.Rectangle2D;
  75. import java.io.IOException;
  76. import java.io.ObjectInputStream;
  77. import java.io.ObjectOutputStream;
  78. import java.io.Serializable;
  79. import javax.swing.event.EventListenerList;
  80. import org.jfree.chart.event.RendererChangeEvent;
  81. import org.jfree.chart.event.RendererChangeListener;
  82. import org.jfree.chart.labels.ItemLabelAnchor;
  83. import org.jfree.chart.labels.ItemLabelPosition;
  84. import org.jfree.chart.plot.DrawingSupplier;
  85. import org.jfree.chart.plot.PlotOrientation;
  86. import org.jfree.io.SerialUtilities;
  87. import org.jfree.ui.TextAnchor;
  88. import org.jfree.util.BooleanList;
  89. import org.jfree.util.BooleanUtilities;
  90. import org.jfree.util.ObjectList;
  91. import org.jfree.util.ObjectUtilities;
  92. import org.jfree.util.PaintList;
  93. import org.jfree.util.ShapeList;
  94. import org.jfree.util.ShapeUtilities;
  95. import org.jfree.util.StrokeList;
  96. /**
  97. * Base class providing common services for renderers. Most methods that update
  98. * attributes of the renderer will fire a {@link RendererChangeEvent}, which
  99. * normally means the plot that owns the renderer will receive notification that
  100. * the renderer has been changed (the plot will, in turn, notify the chart).
  101. */
  102. public abstract class AbstractRenderer implements Cloneable, Serializable {
  103. /** A useful constant. */
  104. public static final Double ZERO = new Double(0.0);
  105. /** The default paint. */
  106. public static final Paint DEFAULT_PAINT = Color.blue;
  107. /** The default outline paint. */
  108. public static final Paint DEFAULT_OUTLINE_PAINT = Color.gray;
  109. /** The default stroke. */
  110. public static final Stroke DEFAULT_STROKE = new BasicStroke(1.0f);
  111. /** The default outline stroke. */
  112. public static final Stroke DEFAULT_OUTLINE_STROKE = new BasicStroke(1.0f);
  113. /** The default shape. */
  114. public static final Shape DEFAULT_SHAPE
  115. = new Rectangle2D.Double(-3.0, -3.0, 6.0, 6.0);
  116. /** The default value label font. */
  117. public static final Font DEFAULT_VALUE_LABEL_FONT
  118. = new Font("SansSerif", Font.PLAIN, 10);
  119. /** The default value label paint. */
  120. public static final Paint DEFAULT_VALUE_LABEL_PAINT = Color.black;
  121. /** A flag that controls the visibility of ALL series. */
  122. private Boolean seriesVisible;
  123. /** A list of flags that controls whether or not each series is visible. */
  124. private BooleanList seriesVisibleList;
  125. /** The default visibility for each series. */
  126. private boolean baseSeriesVisible;
  127. /** A flag that controls the visibility of ALL series in the legend. */
  128. private Boolean seriesVisibleInLegend;
  129. /**
  130. * A list of flags that controls whether or not each series is visible in
  131. * the legend.
  132. */
  133. private BooleanList seriesVisibleInLegendList;
  134. /** The default visibility for each series in the legend. */
  135. private boolean baseSeriesVisibleInLegend;
  136. /** The paint for ALL series (optional). */
  137. private transient Paint paint;
  138. /** The paint list. */
  139. private PaintList paintList;
  140. /** The base paint. */
  141. private transient Paint basePaint;
  142. /** The fill paint for ALL series (optional). */
  143. private transient Paint fillPaint;
  144. /** The fill paint list. */
  145. private PaintList fillPaintList;
  146. /** The base fill paint. */
  147. private transient Paint baseFillPaint;
  148. /** The outline paint for ALL series (optional). */
  149. private transient Paint outlinePaint;
  150. /** The outline paint list. */
  151. private PaintList outlinePaintList;
  152. /** The base outline paint. */
  153. private transient Paint baseOutlinePaint;
  154. /** The stroke for ALL series (optional). */
  155. private transient Stroke stroke;
  156. /** The stroke list. */
  157. private StrokeList strokeList;
  158. /** The base stroke. */
  159. private transient Stroke baseStroke;
  160. /** The outline stroke for ALL series (optional). */
  161. private transient Stroke outlineStroke;
  162. /** The outline stroke list. */
  163. private StrokeList outlineStrokeList;
  164. /** The base outline stroke. */
  165. private transient Stroke baseOutlineStroke;
  166. /** The shape for ALL series (optional). */
  167. private transient Shape shape;
  168. /** A shape list. */
  169. private ShapeList shapeList;
  170. /** The base shape. */
  171. private transient Shape baseShape;
  172. /** Visibility of the item labels for ALL series (optional). */
  173. private Boolean itemLabelsVisible;
  174. /** Visibility of the item labels PER series. */
  175. private BooleanList itemLabelsVisibleList;
  176. /** The base item labels visible. */
  177. private Boolean baseItemLabelsVisible;
  178. /** The item label font for ALL series (optional). */
  179. private Font itemLabelFont;
  180. /** The item label font list (one font per series). */
  181. private ObjectList itemLabelFontList;
  182. /** The base item label font. */
  183. private Font baseItemLabelFont;
  184. /** The item label paint for ALL series. */
  185. private transient Paint itemLabelPaint;
  186. /** The item label paint list (one paint per series). */
  187. private PaintList itemLabelPaintList;
  188. /** The base item label paint. */
  189. private transient Paint baseItemLabelPaint;
  190. /** The positive item label position for ALL series (optional). */
  191. private ItemLabelPosition positiveItemLabelPosition;
  192. /** The positive item label position (per series). */
  193. private ObjectList positiveItemLabelPositionList;
  194. /** The fallback positive item label position. */
  195. private ItemLabelPosition basePositiveItemLabelPosition;
  196. /** The negative item label position for ALL series (optional). */
  197. private ItemLabelPosition negativeItemLabelPosition;
  198. /** The negative item label position (per series). */
  199. private ObjectList negativeItemLabelPositionList;
  200. /** The fallback negative item label position. */
  201. private ItemLabelPosition baseNegativeItemLabelPosition;
  202. /** The item label anchor offset. */
  203. private double itemLabelAnchorOffset = 2.0;
  204. /**
  205. * A flag that controls whether or not entities are generated for
  206. * ALL series (optional).
  207. */
  208. private Boolean createEntities;
  209. /**
  210. * Flags that control whether or not entities are generated for each
  211. * series. This will be overridden by 'createEntities'.
  212. */
  213. private BooleanList createEntitiesList;
  214. /**
  215. * The default flag that controls whether or not entities are generated.
  216. * This flag is used when both the above flags return null.
  217. */
  218. private boolean baseCreateEntities;
  219. /** Storage for registered change listeners. */
  220. private transient EventListenerList listenerList;
  221. /**
  222. * Default constructor.
  223. */
  224. public AbstractRenderer() {
  225. this.seriesVisible = null;
  226. this.seriesVisibleList = new BooleanList();
  227. this.baseSeriesVisible = true;
  228. this.seriesVisibleInLegend = null;
  229. this.seriesVisibleInLegendList = new BooleanList();
  230. this.baseSeriesVisibleInLegend = true;
  231. this.paint = null;
  232. this.paintList = new PaintList();
  233. this.basePaint = DEFAULT_PAINT;
  234. this.fillPaint = null;
  235. this.fillPaintList = new PaintList();
  236. this.baseFillPaint = Color.white;
  237. this.outlinePaint = null;
  238. this.outlinePaintList = new PaintList();
  239. this.baseOutlinePaint = DEFAULT_OUTLINE_PAINT;
  240. this.stroke = null;
  241. this.strokeList = new StrokeList();
  242. this.baseStroke = DEFAULT_STROKE;
  243. this.outlineStroke = null;
  244. this.outlineStrokeList = new StrokeList();
  245. this.baseOutlineStroke = DEFAULT_OUTLINE_STROKE;
  246. this.shape = null;
  247. this.shapeList = new ShapeList();
  248. this.baseShape = DEFAULT_SHAPE;
  249. this.itemLabelsVisible = null;
  250. this.itemLabelsVisibleList = new BooleanList();
  251. this.baseItemLabelsVisible = Boolean.FALSE;
  252. this.itemLabelFont = null;
  253. this.itemLabelFontList = new ObjectList();
  254. this.baseItemLabelFont = new Font("SansSerif", Font.PLAIN, 10);
  255. this.itemLabelPaint = null;
  256. this.itemLabelPaintList = new PaintList();
  257. this.baseItemLabelPaint = Color.black;
  258. this.positiveItemLabelPosition = null;
  259. this.positiveItemLabelPositionList = new ObjectList();
  260. this.basePositiveItemLabelPosition = new ItemLabelPosition(
  261. ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER
  262. );
  263. this.negativeItemLabelPosition = null;
  264. this.negativeItemLabelPositionList = new ObjectList();
  265. this.baseNegativeItemLabelPosition = new ItemLabelPosition(
  266. ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER
  267. );
  268. this.createEntities = null;
  269. this.createEntitiesList = new BooleanList();
  270. this.baseCreateEntities = true;
  271. this.listenerList = new EventListenerList();
  272. }
  273. /**
  274. * Returns the drawing supplier from the plot.
  275. *
  276. * @return The drawing supplier.
  277. */
  278. public abstract DrawingSupplier getDrawingSupplier();
  279. // SERIES VISIBLE (not yet respected by all renderers)
  280. /**
  281. * Returns a boolean that indicates whether or not the specified item
  282. * should be drawn (this is typically used to hide an entire series).
  283. *
  284. * @param series the series index.
  285. * @param item the item index.
  286. *
  287. * @return A boolean.
  288. */
  289. public boolean getItemVisible(int series, int item) {
  290. boolean result = this.baseSeriesVisible;
  291. if (this.seriesVisible != null) {
  292. result = this.seriesVisible.booleanValue();
  293. }
  294. else {
  295. Boolean b = this.seriesVisibleList.getBoolean(series);
  296. if (b != null) {
  297. result = b.booleanValue();
  298. }
  299. }
  300. return result;
  301. }
  302. /**
  303. * Returns the flag that controls the visibility of ALL series. This flag
  304. * overrides the per series and default settings - you must set it to
  305. * <code>null</code> if you want the other settings to apply.
  306. *
  307. * @return The flag (possibly <code>null</code>).
  308. */
  309. public Boolean getSeriesVisible() {
  310. return this.seriesVisible;
  311. }
  312. /**
  313. * Sets the flag that controls the visibility of ALL series and sends a
  314. * {@link RendererChangeEvent} to all registered listeners. This flag
  315. * overrides the per series and default settings - you must set it to
  316. * <code>null</code> if you want the other settings to apply.
  317. *
  318. * @param visible the flag (<code>null</code> permitted).
  319. */
  320. public void setSeriesVisible(Boolean visible) {
  321. setSeriesVisible(visible, true);
  322. }
  323. /**
  324. * Sets the flag that controls the visibility of ALL series and sends a
  325. * {@link RendererChangeEvent} to all registered listeners. This flag
  326. * overrides the per series and default settings - you must set it to
  327. * <code>null</code> if you want the other settings to apply.
  328. *
  329. * @param visible the flag (<code>null</code> permitted).
  330. * @param notify notify listeners?
  331. */
  332. public void setSeriesVisible(Boolean visible, boolean notify) {
  333. this.seriesVisible = visible;
  334. if (notify) {
  335. notifyListeners(new RendererChangeEvent(this));
  336. }
  337. }
  338. /**
  339. * Returns the flag that controls whether a series is visible.
  340. *
  341. * @param series the series index (zero-based).
  342. *
  343. * @return The flag (possibly <code>null</code>).
  344. */
  345. public Boolean getSeriesVisible(int series) {
  346. return this.seriesVisibleList.getBoolean(series);
  347. }
  348. /**
  349. * Sets the flag that controls whether a series is visible and sends a
  350. * {@link RendererChangeEvent} to all registered listeners.
  351. *
  352. * @param series the series index (zero-based).
  353. * @param visible the flag (<code>null</code> permitted).
  354. */
  355. public void setSeriesVisible(int series, Boolean visible) {
  356. setSeriesVisible(series, visible, true);
  357. }
  358. /**
  359. * Sets the flag that controls whether a series is visible and, if
  360. * requested, sends a {@link RendererChangeEvent} to all registered
  361. * listeners.
  362. *
  363. * @param series the series index.
  364. * @param visible the flag (<code>null</code> permitted).
  365. * @param notify notify listeners?
  366. */
  367. public void setSeriesVisible(int series, Boolean visible, boolean notify) {
  368. this.seriesVisibleList.setBoolean(series, visible);
  369. if (notify) {
  370. notifyListeners(new RendererChangeEvent(this));
  371. }
  372. }
  373. /**
  374. * Returns the base visibility for all series.
  375. *
  376. * @return The base visibility.
  377. */
  378. public boolean getBaseSeriesVisible() {
  379. return this.baseSeriesVisible;
  380. }
  381. /**
  382. * Sets the base visibility and sends a {@link RendererChangeEvent}
  383. * to all registered listeners.
  384. *
  385. * @param visible the flag.
  386. */
  387. public void setBaseSeriesVisible(boolean visible) {
  388. // defer argument checking...
  389. setBaseSeriesVisible(visible, true);
  390. }
  391. /**
  392. * Sets the base visibility and, if requested, sends
  393. * a {@link RendererChangeEvent} to all registered listeners.
  394. *
  395. * @param visible the visibility.
  396. * @param notify notify listeners?
  397. */
  398. public void setBaseSeriesVisible(boolean visible, boolean notify) {
  399. this.baseSeriesVisible = visible;
  400. if (notify) {
  401. notifyListeners(new RendererChangeEvent(this));
  402. }
  403. }
  404. // SERIES VISIBLE IN LEGEND (not yet respected by all renderers)
  405. /**
  406. * Returns <code>true</code> if the series should be shown in the legend,
  407. * and <code>false</code> otherwise.
  408. *
  409. * @param series the series index.
  410. *
  411. * @return A boolean.
  412. */
  413. public boolean isSeriesVisibleInLegend(int series) {
  414. boolean result = this.baseSeriesVisibleInLegend;
  415. if (this.seriesVisibleInLegend != null) {
  416. result = this.seriesVisibleInLegend.booleanValue();
  417. }
  418. else {
  419. Boolean b = this.seriesVisibleInLegendList.getBoolean(series);
  420. if (b != null) {
  421. result = b.booleanValue();
  422. }
  423. }
  424. return result;
  425. }
  426. /**
  427. * Returns the flag that controls the visibility of ALL series in the
  428. * legend. This flag overrides the per series and default settings - you
  429. * must set it to <code>null</code> if you want the other settings to
  430. * apply.
  431. *
  432. * @return The flag (possibly <code>null</code>).
  433. */
  434. public Boolean getSeriesVisibleInLegend() {
  435. return this.seriesVisibleInLegend;
  436. }
  437. /**
  438. * Sets the flag that controls the visibility of ALL series in the legend
  439. * and sends a {@link RendererChangeEvent} to all registered listeners.
  440. * This flag overrides the per series and default settings - you must set
  441. * it to <code>null</code> if you want the other settings to apply.
  442. *
  443. * @param visible the flag (<code>null</code> permitted).
  444. */
  445. public void setSeriesVisibleInLegend(Boolean visible) {
  446. setSeriesVisibleInLegend(visible, true);
  447. }
  448. /**
  449. * Sets the flag that controls the visibility of ALL series in the legend
  450. * and sends a {@link RendererChangeEvent} to all registered listeners.
  451. * This flag overrides the per series and default settings - you must set
  452. * it to <code>null</code> if you want the other settings to apply.
  453. *
  454. * @param visible the flag (<code>null</code> permitted).
  455. * @param notify notify listeners?
  456. */
  457. public void setSeriesVisibleInLegend(Boolean visible, boolean notify) {
  458. this.seriesVisibleInLegend = visible;
  459. if (notify) {
  460. notifyListeners(new RendererChangeEvent(this));
  461. }
  462. }
  463. /**
  464. * Returns the flag that controls whether a series is visible in the
  465. * legend. This method returns only the "per series" settings - to
  466. * incorporate the override and base settings as well, you need to use the
  467. * {@link #isSeriesVisibleInLegend(int)} method.
  468. *
  469. * @param series the series index (zero-based).
  470. *
  471. * @return The flag (possibly <code>null</code>).
  472. */
  473. public Boolean getSeriesVisibleInLegend(int series) {
  474. return this.seriesVisibleInLegendList.getBoolean(series);
  475. }
  476. /**
  477. * Sets the flag that controls whether a series is visible in the legend
  478. * and sends a {@link RendererChangeEvent} to all registered listeners.
  479. *
  480. * @param series the series index (zero-based).
  481. * @param visible the flag (<code>null</code> permitted).
  482. */
  483. public void setSeriesVisibleInLegend(int series, Boolean visible) {
  484. setSeriesVisibleInLegend(series, visible, true);
  485. }
  486. /**
  487. * Sets the flag that controls whether a series is visible in the legend
  488. * and, if requested, sends a {@link RendererChangeEvent} to all registered
  489. * listeners.
  490. *
  491. * @param series the series index.
  492. * @param visible the flag (<code>null</code> permitted).
  493. * @param notify notify listeners?
  494. */
  495. public void setSeriesVisibleInLegend(int series, Boolean visible,
  496. boolean notify) {
  497. this.seriesVisibleInLegendList.setBoolean(series, visible);
  498. if (notify) {
  499. notifyListeners(new RendererChangeEvent(this));
  500. }
  501. }
  502. /**
  503. * Returns the base visibility in the legend for all series.
  504. *
  505. * @return The base visibility.
  506. */
  507. public boolean getBaseSeriesVisibleInLegend() {
  508. return this.baseSeriesVisibleInLegend;
  509. }
  510. /**
  511. * Sets the base visibility in the legend and sends a
  512. * {@link RendererChangeEvent} to all registered listeners.
  513. *
  514. * @param visible the flag.
  515. */
  516. public void setBaseSeriesVisibleInLegend(boolean visible) {
  517. // defer argument checking...
  518. setBaseSeriesVisibleInLegend(visible, true);
  519. }
  520. /**
  521. * Sets the base visibility in the legend and, if requested, sends
  522. * a {@link RendererChangeEvent} to all registered listeners.
  523. *
  524. * @param visible the visibility.
  525. * @param notify notify listeners?
  526. */
  527. public void setBaseSeriesVisibleInLegend(boolean visible, boolean notify) {
  528. this.baseSeriesVisibleInLegend = visible;
  529. if (notify) {
  530. notifyListeners(new RendererChangeEvent(this));
  531. }
  532. }
  533. // PAINT
  534. /**
  535. * Returns the paint used to fill data items as they are drawn.
  536. * <p>
  537. * The default implementation passes control to the
  538. * <code>getSeriesPaint</code> method. You can override this method if you
  539. * require different behaviour.
  540. *
  541. * @param row the row (or series) index (zero-based).
  542. * @param column the column (or category) index (zero-based).
  543. *
  544. * @return The paint (never <code>null</code>).
  545. */
  546. public Paint getItemPaint(int row, int column) {
  547. return getSeriesPaint(row);
  548. }
  549. /**
  550. * Returns the paint used to fill an item drawn by the renderer.
  551. *
  552. * @param series the series index (zero-based).
  553. *
  554. * @return The paint (never <code>null</code>).
  555. */
  556. public Paint getSeriesPaint(int series) {
  557. // return the override, if there is one...
  558. if (this.paint != null) {
  559. return this.paint;
  560. }
  561. // otherwise look up the paint list
  562. Paint seriesPaint = this.paintList.getPaint(series);
  563. if (seriesPaint == null) {
  564. DrawingSupplier supplier = getDrawingSupplier();
  565. if (supplier != null) {
  566. seriesPaint = supplier.getNextPaint();
  567. this.paintList.setPaint(series, seriesPaint);
  568. }
  569. else {
  570. seriesPaint = this.basePaint;
  571. }
  572. }
  573. return seriesPaint;
  574. }
  575. /**
  576. * Sets the paint to be used for ALL series, and sends a
  577. * {@link RendererChangeEvent} to all registered listeners. If this is
  578. * <code>null</code>, the renderer will use the paint for the series.
  579. *
  580. * @param paint the paint (<code>null</code> permitted).
  581. */
  582. public void setPaint(Paint paint) {
  583. setPaint(paint, true);
  584. }
  585. /**
  586. * Sets the paint to be used for all series and, if requested, sends a
  587. * {@link RendererChangeEvent} to all registered listeners.
  588. *
  589. * @param paint the paint (<code>null</code> permitted).
  590. * @param notify notify listeners?
  591. */
  592. public void setPaint(Paint paint, boolean notify) {
  593. this.paint = paint;
  594. if (notify) {
  595. notifyListeners(new RendererChangeEvent(this));
  596. }
  597. }
  598. /**
  599. * Sets the paint used for a series and sends a {@link RendererChangeEvent}
  600. * to all registered listeners.
  601. *
  602. * @param series the series index (zero-based).
  603. * @param paint the paint (<code>null</code> permitted).
  604. */
  605. public void setSeriesPaint(int series, Paint paint) {
  606. setSeriesPaint(series, paint, true);
  607. }
  608. /**
  609. * Sets the paint used for a series and, if requested, sends a
  610. * {@link RendererChangeEvent} to all registered listeners.
  611. *
  612. * @param series the series index.
  613. * @param paint the paint (<code>null</code> permitted).
  614. * @param notify notify listeners?
  615. */
  616. public void setSeriesPaint(int series, Paint paint, boolean notify) {
  617. this.paintList.setPaint(series, paint);
  618. if (notify) {
  619. notifyListeners(new RendererChangeEvent(this));
  620. }
  621. }
  622. /**
  623. * Returns the base paint.
  624. *
  625. * @return The base paint (never <code>null</code>).
  626. */
  627. public Paint getBasePaint() {
  628. return this.basePaint;
  629. }
  630. /**
  631. * Sets the base paint and sends a {@link RendererChangeEvent} to all
  632. * registered listeners.
  633. *
  634. * @param paint the paint (<code>null</code> not permitted).
  635. */
  636. public void setBasePaint(Paint paint) {
  637. // defer argument checking...
  638. setBasePaint(paint, true);
  639. }
  640. /**
  641. * Sets the base paint and, if requested, sends a
  642. * {@link RendererChangeEvent} to all registered listeners.
  643. *
  644. * @param paint the paint (<code>null</code> not permitted).
  645. * @param notify notify listeners?
  646. */
  647. public void setBasePaint(Paint paint, boolean notify) {
  648. this.basePaint = paint;
  649. if (notify) {
  650. notifyListeners(new RendererChangeEvent(this));
  651. }
  652. }
  653. //// FILL PAINT //////////////////////////////////////////////////////////
  654. /**
  655. * Returns the paint used to fill data items as they are drawn. The
  656. * default implementation passes control to the
  657. * {@link #getSeriesFillPaint(int)} method - you can override this method
  658. * if you require different behaviour.
  659. *
  660. * @param row the row (or series) index (zero-based).
  661. * @param column the column (or category) index (zero-based).
  662. *
  663. * @return The paint (never <code>null</code>).
  664. */
  665. public Paint getItemFillPaint(int row, int column) {
  666. return getSeriesFillPaint(row);
  667. }
  668. /**
  669. * Returns the paint used to fill an item drawn by the renderer.
  670. *
  671. * @param series the series (zero-based index).
  672. *
  673. * @return The paint (never <code>null</code>).
  674. */
  675. public Paint getSeriesFillPaint(int series) {
  676. // return the override, if there is one...
  677. if (this.fillPaint != null) {
  678. return this.fillPaint;
  679. }
  680. // otherwise look up the paint table
  681. Paint seriesFillPaint = this.fillPaintList.getPaint(series);
  682. if (seriesFillPaint == null) {
  683. seriesFillPaint = this.baseFillPaint;
  684. }
  685. return seriesFillPaint;
  686. }
  687. /**
  688. * Sets the paint used for a series fill and sends a
  689. * {@link RendererChangeEvent} to all registered listeners.
  690. *
  691. * @param series the series index (zero-based).
  692. * @param paint the paint (<code>null</code> permitted).
  693. */
  694. public void setSeriesFillPaint(int series, Paint paint) {
  695. setSeriesFillPaint(series, paint, true);
  696. }
  697. /**
  698. * Sets the paint used to fill a series and, if requested,
  699. * sends a {@link RendererChangeEvent} to all registered listeners.
  700. *
  701. * @param series the series index (zero-based).
  702. * @param paint the paint (<code>null</code> permitted).
  703. * @param notify notify listeners?
  704. */
  705. public void setSeriesFillPaint(int series, Paint paint, boolean notify) {
  706. this.fillPaintList.setPaint(series, paint);
  707. if (notify) {
  708. notifyListeners(new RendererChangeEvent(this));
  709. }
  710. }
  711. /**
  712. * Sets the fill paint for ALL series (optional).
  713. *
  714. * @param paint the paint (<code>null</code> permitted).
  715. */
  716. public void setFillPaint(Paint paint) {
  717. setFillPaint(paint, true);
  718. }
  719. /**
  720. * Sets the fill paint for ALL series and, if requested, sends a
  721. * {@link RendererChangeEvent} to all registered listeners.
  722. *
  723. * @param paint the paint (<code>null</code> permitted).
  724. * @param notify notify listeners?
  725. */
  726. public void setFillPaint(Paint paint, boolean notify) {
  727. this.fillPaint = paint;
  728. if (notify) {
  729. notifyListeners(new RendererChangeEvent(this));
  730. }
  731. }
  732. /**
  733. * Returns the base fill paint.
  734. *
  735. * @return The paint (never <code>null</code>).
  736. */
  737. public Paint getBaseFillPaint() {
  738. return this.baseFillPaint;
  739. }
  740. /**
  741. * Sets the base fill paint and sends a {@link RendererChangeEvent} to
  742. * all registered listeners.
  743. *
  744. * @param paint the paint (<code>null</code> not permitted).
  745. */
  746. public void setBaseFillPaint(Paint paint) {
  747. // defer argument checking...
  748. setBaseFillPaint(paint, true);
  749. }
  750. /**
  751. * Sets the base fill paint and, if requested, sends a
  752. * {@link RendererChangeEvent} to all registered listeners.
  753. *
  754. * @param paint the paint (<code>null</code> not permitted).
  755. * @param notify notify listeners?
  756. */
  757. public void setBaseFillPaint(Paint paint, boolean notify) {
  758. if (paint == null) {
  759. throw new IllegalArgumentException("Null 'paint' argument.");
  760. }
  761. this.baseFillPaint = paint;
  762. if (notify) {
  763. notifyListeners(new RendererChangeEvent(this));
  764. }
  765. }
  766. // OUTLINE PAINT //////////////////////////////////////////////////////////
  767. /**
  768. * Returns the paint used to outline data items as they are drawn.
  769. * <p>
  770. * The default implementation passes control to the getSeriesOutlinePaint
  771. * method. You can override this method if you require different behaviour.
  772. *
  773. * @param row the row (or series) index (zero-based).
  774. * @param column the column (or category) index (zero-based).
  775. *
  776. * @return The paint (never <code>null</code>).
  777. */
  778. public Paint getItemOutlinePaint(int row, int column) {
  779. return getSeriesOutlinePaint(row);
  780. }
  781. /**
  782. * Returns the paint used to outline an item drawn by the renderer.
  783. *
  784. * @param series the series (zero-based index).
  785. *
  786. * @return The paint (never <code>null</code>).
  787. */
  788. public Paint getSeriesOutlinePaint(int series) {
  789. // return the override, if there is one...
  790. if (this.outlinePaint != null) {
  791. return this.outlinePaint;
  792. }
  793. // otherwise look up the paint table
  794. Paint seriesOutlinePaint = this.outlinePaintList.getPaint(series);
  795. if (seriesOutlinePaint == null) {
  796. DrawingSupplier supplier = getDrawingSupplier();
  797. if (supplier != null) {
  798. seriesOutlinePaint = supplier.getNextOutlinePaint();
  799. this.outlinePaintList.setPaint(series, seriesOutlinePaint);
  800. }
  801. else {
  802. seriesOutlinePaint = this.baseOutlinePaint;
  803. }
  804. }
  805. return seriesOutlinePaint;
  806. }
  807. /**
  808. * Sets the paint used for a series outline and sends a
  809. * {@link RendererChangeEvent} to all registered listeners.
  810. *
  811. * @param series the series index (zero-based).
  812. * @param paint the paint (<code>null</code> permitted).
  813. */
  814. public void setSeriesOutlinePaint(int series, Paint paint) {
  815. setSeriesOutlinePaint(series, paint, true);
  816. }
  817. /**
  818. * Sets the paint used to draw the outline for a series and, if requested,
  819. * sends a {@link RendererChangeEvent} to all registered listeners.
  820. *
  821. * @param series the series index (zero-based).
  822. * @param paint the paint (<code>null</code> permitted).
  823. * @param notify notify listeners?
  824. */
  825. public void setSeriesOutlinePaint(int series, Paint paint, boolean notify) {
  826. this.outlinePaintList.setPaint(series, paint);
  827. if (notify) {
  828. notifyListeners(new RendererChangeEvent(this));
  829. }
  830. }
  831. /**
  832. * Sets the outline paint for ALL series (optional).
  833. *
  834. * @param paint the paint (<code>null</code> permitted).
  835. */
  836. public void setOutlinePaint(Paint paint) {
  837. setOutlinePaint(paint, true);
  838. }
  839. /**
  840. * Sets the outline paint for ALL series and, if requested, sends a
  841. * {@link RendererChangeEvent} to all registered listeners.
  842. *
  843. * @param paint the paint (<code>null</code> permitted).
  844. * @param notify notify listeners?
  845. */
  846. public void setOutlinePaint(Paint paint, boolean notify) {
  847. this.outlinePaint = paint;
  848. if (notify) {
  849. notifyListeners(new RendererChangeEvent(this));
  850. }
  851. }
  852. /**
  853. * Returns the base outline paint.
  854. *
  855. * @return The paint (never <code>null</code>).
  856. */
  857. public Paint getBaseOutlinePaint() {
  858. return this.baseOutlinePaint;
  859. }
  860. /**
  861. * Sets the base outline paint and sends a {@link RendererChangeEvent} to
  862. * all registered listeners.
  863. *
  864. * @param paint the paint (<code>null</code> not permitted).
  865. */
  866. public void setBaseOutlinePaint(Paint paint) {
  867. // defer argument checking...
  868. setBaseOutlinePaint(paint, true);
  869. }
  870. /**
  871. * Sets the base outline paint and, if requested, sends a
  872. * {@link RendererChangeEvent} to all registered listeners.
  873. *
  874. * @param paint the paint (<code>null</code> not permitted).
  875. * @param notify notify listeners?
  876. */
  877. public void setBaseOutlinePaint(Paint paint, boolean notify) {
  878. if (paint == null) {
  879. throw new IllegalArgumentException("Null 'paint' argument.");
  880. }
  881. this.baseOutlinePaint = paint;
  882. if (notify) {
  883. notifyListeners(new RendererChangeEvent(this));
  884. }
  885. }
  886. // STROKE
  887. /**
  888. * Returns the stroke used to draw data items.
  889. * <p>
  890. * The default implementation passes control to the getSeriesStroke method.
  891. * You can override this method if you require different behaviour.
  892. *
  893. * @param row the row (or series) index (zero-based).
  894. * @param column the column (or category) index (zero-based).
  895. *
  896. * @return The stroke (never <code>null</code>).
  897. */
  898. public Stroke getItemStroke(int row, int column) {
  899. return getSeriesStroke(row);
  900. }
  901. /**
  902. * Returns the stroke used to draw the items in a series.
  903. *
  904. * @param series the series (zero-based index).
  905. *
  906. * @return The stroke (never <code>null</code>).
  907. */
  908. public Stroke getSeriesStroke(int series) {
  909. // return the override, if there is one...
  910. if (this.stroke != null) {
  911. return this.stroke;
  912. }
  913. // otherwise look up the paint table
  914. Stroke result = this.strokeList.getStroke(series);
  915. if (result == null) {
  916. DrawingSupplier supplier = getDrawingSupplier();
  917. if (supplier != null) {
  918. result = supplier.getNextStroke();
  919. this.strokeList.setStroke(series, result);
  920. }
  921. else {
  922. result = this.baseStroke;
  923. }
  924. }
  925. return result;
  926. }
  927. /**
  928. * Sets the stroke for ALL series and sends a {@link RendererChangeEvent}
  929. * to all registered listeners.
  930. *
  931. * @param stroke the stroke (<code>null</code> permitted).
  932. */
  933. public void setStroke(Stroke stroke) {
  934. setStroke(stroke, true);
  935. }
  936. /**
  937. * Sets the stroke for ALL series and, if requested, sends a
  938. * {@link RendererChangeEvent} to all registered listeners.
  939. *
  940. * @param stroke the stroke (<code>null</code> permitted).
  941. * @param notify notify listeners?
  942. */
  943. public void setStroke(Stroke stroke, boolean notify) {
  944. this.stroke = stroke;
  945. if (notify) {
  946. notifyListeners(new RendererChangeEvent(this));
  947. }
  948. }
  949. /**
  950. * Sets the stroke used for a series and sends a {@link RendererChangeEvent}
  951. * to all registered listeners.
  952. *
  953. * @param series the series index (zero-based).
  954. * @param stroke the stroke (<code>null</code> permitted).
  955. */
  956. public void setSeriesStroke(int series, Stroke stroke) {
  957. setSeriesStroke(series, stroke, true);
  958. }
  959. /**
  960. * Sets the stroke for a series and, if requested, sends a
  961. * {@link RendererChangeEvent} to all registered listeners.
  962. *
  963. * @param series the series index (zero-based).
  964. * @param stroke the stroke (<code>null</code> permitted).
  965. * @param notify notify listeners?
  966. */
  967. public void setSeriesStroke(int series, Stroke stroke, boolean notify) {
  968. this.strokeList.setStroke(series, stroke);
  969. if (notify) {
  970. notifyListeners(new RendererChangeEvent(this));
  971. }
  972. }
  973. /**
  974. * Returns the base stroke.
  975. *
  976. * @return The base stroke (never <code>null</code>).
  977. */
  978. public Stroke getBaseStroke() {
  979. return this.baseStroke;
  980. }
  981. /**
  982. * Sets the base stroke.
  983. *
  984. * @param stroke the stroke (<code>null</code> not permitted).
  985. */
  986. public void setBaseStroke(Stroke stroke) {
  987. // defer argument checking...
  988. setBaseStroke(stroke, true);
  989. }
  990. /**
  991. * Sets the base stroke and, if requested, sends a
  992. * {@link RendererChangeEvent} to all registered listeners.
  993. *
  994. * @param stroke the stroke (<code>null</code> not permitted).
  995. * @param notify notify listeners?
  996. */
  997. public void setBaseStroke(Stroke stroke, boolean notify) {
  998. if (stroke == null) {
  999. throw new IllegalArgumentException("Null 'stroke' argument.");
  1000. }
  1001. this.baseStroke = stroke;
  1002. if (notify) {
  1003. notifyListeners(new RendererChangeEvent(this));
  1004. }
  1005. }
  1006. // OUTLINE STROKE
  1007. /**
  1008. * Returns the stroke used to outline data items.
  1009. * <p>
  1010. * The default implementation passes control to the getSeriesOutlineStroke
  1011. * method. You can override this method if you require different behaviour.
  1012. *
  1013. * @param row the row (or series) index (zero-based).
  1014. * @param column the column (or category) index (zero-based).
  1015. *
  1016. * @return The stroke (never <code>null</code>).
  1017. */
  1018. public Stroke getItemOutlineStroke(int row, int column) {
  1019. return getSeriesOutlineStroke(row);
  1020. }
  1021. /**
  1022. * Returns the stroke used to outline the items in a series.
  1023. *
  1024. * @param series the series (zero-based index).
  1025. *
  1026. * @return The stroke (never <code>null</code>).
  1027. */
  1028. public Stroke getSeriesOutlineStroke(int series) {
  1029. // return the override, if there is one...
  1030. if (this.outlineStroke != null) {
  1031. return this.outlineStroke;
  1032. }
  1033. // otherwise look up the stroke table
  1034. Stroke result = this.outlineStrokeList.getStroke(series);
  1035. if (result == null) {
  1036. DrawingSupplier supplier = getDrawingSupplier();
  1037. if (supplier != null) {
  1038. result = supplier.getNextOutlineStroke();
  1039. this.outlineStrokeList.setStroke(series, result);
  1040. }
  1041. else {
  1042. result = this.baseOutlineStroke;
  1043. }
  1044. }
  1045. return result;
  1046. }
  1047. /**
  1048. * Sets the outline stroke for ALL series and sends a
  1049. * {@link RendererChangeEvent} to all registered listeners.
  1050. *
  1051. * @param stroke the stroke (<code>null</code> permitted).
  1052. */
  1053. public void setOutlineStroke(Stroke stroke) {
  1054. setOutlineStroke(stroke, true);
  1055. }
  1056. /**
  1057. * Sets the outline stroke for ALL series and, if requested, sends a
  1058. * {@link RendererChangeEvent} to all registered listeners.
  1059. *
  1060. * @param stroke the stroke (<code>null</code> permitted).
  1061. * @param notify notify listeners?
  1062. */
  1063. public void setOutlineStroke(Stroke stroke, boolean notify) {
  1064. this.outlineStroke = stroke;
  1065. if (notify) {
  1066. notifyListeners(new RendererChangeEvent(this));
  1067. }
  1068. }
  1069. /**
  1070. * Sets the outline stroke used for a series and sends a
  1071. * {@link RendererChangeEvent} to all registered listeners.
  1072. *
  1073. * @param series the series index (zero-based).
  1074. * @param stroke the stroke (<code>null</code> permitted).
  1075. */
  1076. public void setSeriesOutlineStroke(int series, Stroke stroke) {
  1077. setSeriesOutlineStroke(series, stroke, true);
  1078. }
  1079. /**
  1080. * Sets the outline stroke for a series and, if requested, sends a
  1081. * {@link RendererChangeEvent} to all registered listeners.
  1082. *
  1083. * @param series the series index.
  1084. * @param stroke the stroke (<code>null</code> permitted).
  1085. * @param notify notify listeners?
  1086. */
  1087. public void setSeriesOutlineStroke(int series, Stroke stroke,
  1088. boolean notify) {
  1089. this.outlineStrokeList.setStroke(series, stroke);
  1090. if (notify) {
  1091. notifyListeners(new RendererChangeEvent(this));
  1092. }
  1093. }
  1094. /**
  1095. * Returns the base outline stroke.
  1096. *
  1097. * @return The stroke (possibly <code>null</code>).
  1098. */
  1099. public Stroke getBaseOutlineStroke() {
  1100. return this.baseOutlineStroke;
  1101. }
  1102. /**
  1103. * Sets the base outline stroke and sends a {@link RendererChangeEvent} to
  1104. * all registered listeners.
  1105. *
  1106. * @param stroke the stroke (<code>null</code> permitted).
  1107. */
  1108. public void setBaseOutlineStroke(Stroke stroke) {
  1109. setBaseOutlineStroke(stroke, true);
  1110. }
  1111. /**
  1112. * Sets the base outline stroke and, if requested, sends a
  1113. * {@link RendererChangeEvent} to all registered listeners.
  1114. *
  1115. * @param stroke the stroke (<code>null</code> permitted).
  1116. * @param notify a flag that controls whether or not listeners are
  1117. * notified.
  1118. */
  1119. public void setBaseOutlineStroke(Stroke stroke, boolean notify) {
  1120. this.baseOutlineStroke = stroke;
  1121. if (notify) {
  1122. notifyListeners(new RendererChangeEvent(this));
  1123. }
  1124. }
  1125. // SHAPE
  1126. /**
  1127. * Returns a shape used to represent a data item.
  1128. * <p>
  1129. * The default implementation passes control to the getSeriesShape method.
  1130. * You can override this method if you require different behaviour.
  1131. *
  1132. * @param row the row (or series) index (zero-based).
  1133. * @param column the column (or category) index (zero-based).
  1134. *
  1135. * @return The shape (never <code>null</code>).
  1136. */
  1137. public Shape getItemShape(int row, int column) {
  1138. return getSeriesShape(row);
  1139. }
  1140. /**
  1141. * Returns a shape used to represent the items in a series.
  1142. *
  1143. * @param series the series (zero-based index).
  1144. *
  1145. * @return The shape (never <code>null</code>).
  1146. */
  1147. public Shape getSeriesShape(int series) {
  1148. // return the override, if there is one...
  1149. if (this.shape != null) {
  1150. return this.shape;
  1151. }
  1152. // otherwise look up the shape list
  1153. Shape result = this.shapeList.getShape(series);
  1154. if (result == null) {
  1155. DrawingSupplier supplier = getDrawingSupplier();
  1156. if (supplier != null) {
  1157. result = supplier.getNextShape();
  1158. this.shapeList.setShape(series, result);
  1159. }
  1160. else {
  1161. result = this.baseShape;
  1162. }
  1163. }
  1164. return result;
  1165. }
  1166. /**
  1167. * Sets the shape for ALL series (optional) and sends a
  1168. * {@link RendererChangeEvent} to all registered listeners.
  1169. *
  1170. * @param shape the shape (<code>null</code> permitted).
  1171. */
  1172. public void setShape(Shape shape) {
  1173. setShape(shape, true);
  1174. }
  1175. /**
  1176. * Sets the shape for ALL series and, if requested, sends a
  1177. * {@link RendererChangeEvent} to all registered listeners.
  1178. *
  1179. * @param shape the shape (<code>null</code> permitted).
  1180. * @param notify notify listeners?
  1181. */
  1182. public void setShape(Shape shape, boolean notify) {
  1183. this.shape = shape;
  1184. if (notify) {
  1185. notifyListeners(new RendererChangeEvent(this));
  1186. }
  1187. }
  1188. /**
  1189. * Sets the shape used for a series and sends a {@link RendererChangeEvent}
  1190. * to all registered listeners.
  1191. *
  1192. * @param series the series index (zero-based).
  1193. * @param shape the shape (<code>null</code> permitted).
  1194. */
  1195. public void setSeriesShape(int series, Shape shape) {
  1196. setSeriesShape(series, shape, true);
  1197. }
  1198. /**
  1199. * Sets the shape for a series and, if requested, sends a
  1200. * {@link RendererChangeEvent} to all registered listeners.
  1201. *
  1202. * @param series the series index (zero based).
  1203. * @param shape the shape (<code>null</code> permitted).
  1204. * @param notify notify listeners?
  1205. */
  1206. public void setSeriesShape(int series, Shape shape, boolean notify) {
  1207. this.shapeList.setShape(series, shape);
  1208. if (notify) {
  1209. notifyListeners(new RendererChangeEvent(this));
  1210. }
  1211. }
  1212. /**
  1213. * Returns the base shape.
  1214. *
  1215. * @return The shape (never <code>null</code>).
  1216. */
  1217. public Shape getBaseShape() {
  1218. return this.baseShape;
  1219. }
  1220. /**
  1221. * Sets the base shape and sends a {@link RendererChangeEvent} to all
  1222. * registered listeners.
  1223. *
  1224. * @param shape the shape (<code>null</code> not permitted).
  1225. */
  1226. public void setBaseShape(Shape shape) {
  1227. // defer argument checking...
  1228. setBaseShape(shape, true);
  1229. }
  1230. /**
  1231. * Sets the base shape and, if requested, sends a
  1232. * {@link RendererChangeEvent} to all registered listeners.
  1233. *
  1234. * @param shape the shape (<code>null</code> not permitted).
  1235. * @param notify notify listeners?
  1236. */
  1237. public void setBaseShape(Shape shape, boolean notify) {
  1238. if (shape == null) {
  1239. throw new IllegalArgumentException("Null 'shape' argument.");
  1240. }
  1241. this.baseShape = shape;
  1242. if (notify) {
  1243. notifyListeners(new RendererChangeEvent(this));
  1244. }
  1245. }
  1246. // ITEM LABEL VISIBILITY...
  1247. /**
  1248. * Returns <code>true</code> if an item label is visible, and
  1249. * <code>false</code> otherwise.
  1250. *
  1251. * @param row the row index (zero-based).
  1252. * @param column the column index (zero-based).
  1253. *
  1254. * @return A boolean.
  1255. */
  1256. public boolean isItemLabelVisible(int row, int column) {
  1257. return isSeriesItemLabelsVisible(row);
  1258. }
  1259. /**
  1260. * Returns <code>true</code> if the item labels for a series are visible,
  1261. * and <code>false</code> otherwise.
  1262. *
  1263. * @param series the series index (zero-based).
  1264. *
  1265. * @return A boolean.
  1266. */
  1267. public boolean isSeriesItemLabelsVisible(int series) {
  1268. // return the override, if there is one...
  1269. if (this.itemLabelsVisible != null) {
  1270. return this.itemLabelsVisible.booleanValue();
  1271. }
  1272. // otherwise look up the boolean table
  1273. Boolean b = this.itemLabelsVisibleList.getBoolean(series);
  1274. if (b == null) {
  1275. b = this.baseItemLabelsVisible;
  1276. }
  1277. if (b == null) {
  1278. b = Boolean.FALSE;
  1279. }
  1280. return b.booleanValue();
  1281. }
  1282. /**
  1283. * Sets the visibility of the item labels for ALL series.
  1284. *
  1285. * @param visible the flag.
  1286. */
  1287. public void setItemLabelsVisible(boolean visible) {
  1288. setItemLabelsVisible(BooleanUtilities.valueOf(visible));
  1289. // The following alternative is only supported in JDK 1.4 - we support
  1290. // JDK 1.2.2
  1291. // setItemLabelsVisible(Boolean.valueOf(visible));
  1292. }
  1293. /**
  1294. * Sets the visibility of the item labels for ALL series (optional).
  1295. *
  1296. * @param visible the flag (<code>null</code> permitted).
  1297. */
  1298. public void setItemLabelsVisible(Boolean visible) {
  1299. setItemLabelsVisible(visible, true);
  1300. }
  1301. /**
  1302. * Sets the visibility of item labels for ALL series and, if requested,
  1303. * sends a {@link RendererChangeEvent} to all registered listeners.
  1304. *
  1305. * @param visible a flag that controls whether or not the item labels are