/** * Receives notification of a renderer change event. * * @param event the event. */ @Override public void rendererChanged(RendererChangeEvent event) { Plot parent = getParent(); if (parent != null) { if (parent instanceof RendererChangeListener) { RendererChangeListener rcl = (RendererChangeListener) parent; rcl.rendererChanged(event); } else { // this should never happen with the existing code, but throw // an exception in case future changes make it possible... throw new RuntimeException( "The renderer has changed and I don't know what to do!"); } } else { configureRangeAxes(); PlotChangeEvent e = new PlotChangeEvent(this); notifyListeners(e); } }
/** * Receives notification of a renderer change event. * * @param event the event. */ public void rendererChanged(RendererChangeEvent event) { Plot parent = getParent(); if (parent != null) { if (parent instanceof RendererChangeListener) { RendererChangeListener rcl = (RendererChangeListener) parent; rcl.rendererChanged(event); } else { // this should never happen with the existing code, but throw // an exception in case future changes make it possible... throw new RuntimeException( "The renderer has changed and I don't know what to do!"); } } else { configureRangeAxes(); PlotChangeEvent e = new PlotChangeEvent(this); notifyListeners(e); } }
/** * Sets the renderer to use for the dataset with the specified index and, * if requested, sends a change event to all registered listeners. Note * that each dataset should have its own renderer, you should not use one * renderer for multiple datasets. * * @param index the index. * @param renderer the renderer ({@code null} permitted). * @param notify notify listeners? * * @see #getRenderer(int) */ public void setRenderer(int index, CategoryItemRenderer renderer, boolean notify) { CategoryItemRenderer existing = this.renderers.get(index); if (existing != null) { existing.removeChangeListener(this); } this.renderers.put(index, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); } configureDomainAxes(); configureRangeAxes(); if (notify) { fireChangeEvent(); } }
/** * Sets a renderer. A {@link PlotChangeEvent} is sent to all registered * listeners. * * @param index the index. * @param renderer the renderer (<code>null</code> permitted). * @param notify notify listeners? * * @see #getRenderer(int) */ public void setRenderer(int index, CategoryItemRenderer renderer, boolean notify) { // stop listening to the existing renderer... CategoryItemRenderer existing = (CategoryItemRenderer) this.renderers.get(index); if (existing != null) { existing.removeChangeListener(this); } // register the new renderer... this.renderers.set(index, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); } configureDomainAxes(); configureRangeAxes(); if (notify) { fireChangeEvent(); } }