/** * Adds a subplot and sends a {@link PlotChangeEvent} to all registered * listeners. * <br><br> * You must ensure that the subplot has a non-null domain axis. The range * axis for the subplot will be set to <code>null</code>. * * @param subplot the subplot (<code>null</code> not permitted). * @param weight the weight (must be >= 1). */ public void add(CategoryPlot subplot, int weight) { if (subplot == null) { throw new IllegalArgumentException("Null 'subplot' argument."); } if (weight <= 0) { throw new IllegalArgumentException("Require weight >= 1."); } // store the plot and its weight subplot.setParent(this); subplot.setWeight(weight); subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); subplot.setRangeAxis(null); subplot.setOrientation(getOrientation()); subplot.addChangeListener(this); this.subplots.add(subplot); this.totalWeight += weight; // configure the range axis... ValueAxis axis = getRangeAxis(); if (axis != null) { axis.configure(); } notifyListeners(new PlotChangeEvent(this)); }
/** * Sets a domain axis. * * @param index the axis index. * @param axis the axis. */ public void setDomainAxis(int index, CategoryAxis axis) { CategoryAxis existing = (CategoryAxis) this.domainAxes.get(index); if (existing != null) { existing.removeChangeListener(this); } if (axis != null) { axis.setPlot(this); } this.domainAxes.set(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); } notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the paint used to draw the outline of the plot area and sends a {@link PlotChangeEvent} * to all registered listeners. If you set this attribute to <code>null</code>, no outline * will be drawn. * * @param paint the paint (<code>null</code> permitted). */ public void setOutlinePaint(Paint paint) { if (paint == null) { if (this.outlinePaint != null) { this.outlinePaint = null; notifyListeners(new PlotChangeEvent(this)); } } else { if (this.outlinePaint != null) { if (this.outlinePaint.equals(paint)) { return; // nothing to do } } this.outlinePaint = paint; notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the range axis for the plot and sends a {@link PlotChangeEvent} to all registered * listeners. * * @param axis the axis (<code>null</code> permitted). * */ public void setRangeAxis(ValueAxis axis) { if (axis != null) { axis.setPlot(this); } // plot is likely registered as a listener with the existing axis... ValueAxis existing = getRangeAxis(); if (existing != null) { existing.removeChangeListener(this); } this.rangeAxes.set(0, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); } notifyListeners(new PlotChangeEvent(this)); }
/** * Sets a range axis and sends a {@link PlotChangeEvent} to all registered listeners. * * @param index the axis index. * @param axis the axis (<code>null</code> permitted). */ public void setRangeAxis(int index, ValueAxis axis) { ValueAxis existing = getRangeAxis(index); if (existing != null) { existing.removeChangeListener(this); } if (axis != null) { axis.setPlot(this); } this.rangeAxes.set(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); } notifyListeners(new PlotChangeEvent(this)); }
/** * 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) { notifyListeners(new PlotChangeEvent(this)); } }
/** * Adds a subplot and sends a {@link PlotChangeEvent} to all registered listeners. * * @param subplot the subplot (<code>null</code> not permitted). * @param weight the weight (must be >= 1). */ public void add(CategoryPlot subplot, int weight) { if (subplot == null) { throw new IllegalArgumentException("Null 'subplot' argument."); } if (weight <= 0) { throw new IllegalArgumentException("Require weight >= 1."); } // store the plot and its weight subplot.setParent(this); subplot.setWeight(weight); subplot.setInsets(new Insets(0, 0, 0, 0)); subplot.setRangeAxis(null); subplot.setOrientation(getOrientation()); subplot.addChangeListener(this); this.subplots.add(subplot); this.totalWeight += weight; // configure the range axis... ValueAxis axis = getRangeAxis(); if (axis != null) { axis.configure(); } notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the range axis for the plot. * <P> * An exception is thrown if the new axis and the plot are not mutually * compatible. * * @param axis The new axis (null permitted). */ public void setRangeAxis(ValueAxis axis) { if (axis != null) { axis.setPlot(this); axis.addChangeListener(this); } // plot is likely registered as a listener with the existing axis... if (this.rangeAxis != null) { this.rangeAxis.removeChangeListener(this); } this.rangeAxis = axis; notifyListeners(new PlotChangeEvent(this)); }
/** * Receives notification of a change to the plot's dataset. * <P> * The chart reacts by passing on a chart change event to all registered * listeners. * * @param event Information about the event (not used here). */ public void datasetChanged(DatasetChangeEvent event) { if (this.domainAxis != null) { this.domainAxis.configure(); } if (this.rangeAxis != null) { this.rangeAxis.configure(); } if (this.colorBar != null) { this.colorBar.configure(this); } 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 { PlotChangeEvent e = new PlotChangeEvent(this); notifyListeners(e); } }
/** * Sets the flag indicating whether or not the domain crosshair is visible. * * @param flag the new value of the flag. */ public void setDomainCrosshairVisible(boolean flag) { if (this.domainCrosshairVisible != flag) { this.domainCrosshairVisible = flag; notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the stroke used to draw the thermometer outline. * * @param s the new stroke (null ignored). */ public void setThermometerStroke(Stroke s) { if (s != null) { this.thermometerStroke = s; notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the item renderer, and notifies all listeners of a change to the plot. * <P> * If the renderer is set to <code>null</code>, no chart will be drawn. * * @param renderer the new renderer (<code>null</code> permitted). */ public void setRenderer(WaferMapRenderer renderer) { if (this.renderer != null) { this.renderer.removeChangeListener(this); } this.renderer = renderer; if (renderer != null) { renderer.setPlot(this); } notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the tick label font and sends a {@link PlotChangeEvent} to all registered listeners. * * @param font the font (<code>null</code> not permitted). */ public void setTickLabelFont(Font font) { if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } if (!this.tickLabelFont.equals(font)) { this.tickLabelFont = font; notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the alpha transparency of the plot area background, and notifies * registered listeners that the plot has been modified. * * @param alpha the new alpha value. */ public void setBackgroundAlpha(float alpha) { if (this.backgroundAlpha != alpha) { this.backgroundAlpha = alpha; notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the flag indicating whether or not the range crosshair is visible. * * @param flag the new value of the flag. */ public void setRangeCrosshairVisible(boolean flag) { if (this.rangeCrosshairVisible != flag) { this.rangeCrosshairVisible = flag; notifyListeners(new PlotChangeEvent(this)); } }
/** * Clears all the domain markers. */ public void clearDomainMarkers() { if (this.domainMarkers != null) { this.domainMarkers.clear(); notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the section label font and sends a {@link PlotChangeEvent} to all registered listeners. * * @param font the font (<code>null</code> not permitted). */ public void setLabelFont(Font font) { if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } this.labelFont = font; notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the base series paint. * * @param paint the paint (<code>null</code> not permitted). * * @see #getBaseSeriesPaint() */ public void setBaseSeriesPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.baseSeriesPaint = paint; notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the paint used to display the current value. * * @param p the new paint. */ public void setValuePaint(Paint p) { if ((p != null) && (!this.valuePaint.equals(p))) { this.valuePaint = p; notifyListeners(new PlotChangeEvent(this)); } }
/** * Notifies all registered listeners that the plot has been modified. * * @param event information about the change event. */ public void notifyListeners(PlotChangeEvent event) { Object[] listeners = this.listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == PlotChangeListener.class) { ((PlotChangeListener) listeners[i + 1]).plotChanged(event); } } }
/** * Sets the range for the dial and sends a {@link PlotChangeEvent} to all * registered listeners. * * @param range the range (<code>null</code> not permitted and zero-length * ranges not permitted). * * @see #getRange() */ public void setRange(Range range) { if (range == null) { throw new IllegalArgumentException("Null 'range' argument."); } if (!(range.getLength() > 0.0)) { throw new IllegalArgumentException( "Range length must be positive."); } this.range = range; notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the flag that controls whether or not grid-lines are drawn against the range axis. * If the flag changes value, a {@link PlotChangeEvent} is sent to all registered listeners. * * @param visible the new value of the flag. */ public void setRangeGridlinesVisible(boolean visible) { if (this.rangeGridlinesVisible != visible) { this.rangeGridlinesVisible = visible; notifyListeners(new PlotChangeEvent(this)); } }
/** * Removes a subplot from the combined chart. Potentially, this removes some unique categories * from the overall union of the datasets...so the domain axis is reconfigured, then a * {@link PlotChangeEvent} is sent to all registered listeners. * * @param subplot the subplot (<code>null</code> not permitted). */ public void remove(CategoryPlot subplot) { if (subplot == null) { throw new IllegalArgumentException("Null 'subplot' argument."); } int position = -1; int size = this.subplots.size(); int i = 0; while (position == -1 && i < size) { if (this.subplots.get(i) == subplot) { position = i; } i++; } if (position != -1) { this.subplots.remove(position); subplot.setParent(null); subplot.removeChangeListener(this); this.totalWeight -= subplot.getWeight(); CategoryAxis domain = getDomainAxis(); if (domain != null) { domain.configure(); } notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the orientation for the plot and sends a {@link PlotChangeEvent} to all registered * listeners. * * @param orientation the orientation (<code>null</code> not permitted). */ public void setOrientation(PlotOrientation orientation) { if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } this.orientation = orientation; notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the insets for the plot and, if requested, and sends a * {@link PlotChangeEvent} to all registered listeners. * * @param insets the new insets (<code>null</code> not permitted). * @param notify a flag that controls whether the registered listeners are * notified. * * @see #getInsets() * @see #setInsets(RectangleInsets) */ public void setInsets(RectangleInsets insets, boolean notify) { if (insets == null) { throw new IllegalArgumentException("Null 'insets' argument."); } if (!this.insets.equals(insets)) { this.insets = insets; if (notify) { notifyListeners(new PlotChangeEvent(this)); } } }
/** * Clears all the (foreground and background) domain markers and sends a * {@link PlotChangeEvent} to all registered listeners. */ public void clearDomainMarkers() { if (this.foregroundDomainMarkers != null) { this.foregroundDomainMarkers.clear(); } if (this.backgroundDomainMarkers != null) { this.backgroundDomainMarkers.clear(); } notifyListeners(new PlotChangeEvent(this)); }
/** * Clears all the annotations and sends a {@link PlotChangeEvent} to all registered * listeners. */ public void clearAnnotations() { if (this.annotations != null) { this.annotations.clear(); notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the flag indicating whether or not the domain crosshair should "lock-on" * to actual data values. * * @param flag the flag. */ public void setDomainCrosshairLockedOnData(boolean flag) { if (this.domainCrosshairLockedOnData != flag) { this.domainCrosshairLockedOnData = flag; notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the item renderer, and notifies all listeners of a change to the * plot. If the renderer is set to <code>null</code>, no chart will be * drawn. * * @param renderer the new renderer (<code>null</code> permitted). */ public void setRenderer(WaferMapRenderer renderer) { if (this.renderer != null) { this.renderer.removeChangeListener(this); } this.renderer = renderer; if (renderer != null) { renderer.setPlot(this); } notifyListeners(new PlotChangeEvent(this)); }
/** * Receives notification of a change to the plot's dataset. * <P> * The axis ranges are updated if necessary. * * @param event information about the event (not used here). */ public void datasetChanged(DatasetChangeEvent event) { configureDomainAxes(); configureRangeAxes(); if (getParent() != null) { getParent().datasetChanged(event); } else { PlotChangeEvent e = new PlotChangeEvent(this); e.setType(ChartChangeEventType.DATASET_UPDATED); notifyListeners(e); } }
/** * Removes a subplot from the combined chart. * * @param subplot the subplot. */ public void remove(CategoryPlot subplot) { if (subplot == null) { throw new IllegalArgumentException(" Null 'subplot' argument."); } int position = -1; int size = this.subplots.size(); int i = 0; while (position == -1 && i < size) { if (this.subplots.get(i) == subplot) { position = i; } i++; } if (position != -1) { subplot.setParent(null); subplot.removeChangeListener(this); this.totalWeight -= subplot.getWeight(); ValueAxis range = getRangeAxis(); if (range != null) { range.configure(); } ValueAxis range2 = getRangeAxis(1); if (range2 != null) { range2.configure(); } notifyListeners(new PlotChangeEvent(this)); } }
/** * Sets the rendering order and sends a {@link PlotChangeEvent} to all registered listeners. * By default, the plot renders the primary dataset last (so that * the primary dataset overlays the secondary datasets). You can reverse this if you want to. * * @param order the rendering order (<code>null</code> not permitted). */ public void setDatasetRenderingOrder(DatasetRenderingOrder order) { if (order == null) { throw new IllegalArgumentException("Null 'order' argument."); } this.renderingOrder = order; notifyListeners(new PlotChangeEvent(this)); }
/** * Adds an annotation to the plot and sends a {@link PlotChangeEvent} to all * registered listeners. * * @param annotation the annotation (<code>null</code> not permitted). * * @see #removeAnnotation(CategoryAnnotation) */ public void addAnnotation(CategoryAnnotation annotation) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } this.annotations.add(annotation); notifyListeners(new PlotChangeEvent(this)); }
/** * Sets the units to be displayed in the thermometer. * <p> * Use one of the following constants: * * <ul> * <li>UNITS_NONE : no units displayed.</li> * <li>UNITS_FAHRENHEIT : units displayed in Fahrenheit.</li> * <li>UNITS_CELCIUS : units displayed in Celcius.</li> * <li>UNITS_KELVIN : units displayed in Kelvin.</li> * </ul> * * @param u the new unit type. */ public void setUnits(int u) { if ((u >= 0) && (u < UNITS.length)) { if (this.units != u) { this.units = u; notifyListeners(new PlotChangeEvent(this)); } } }
/** * Sets the paint used to draw the crosshairs (if visible) and sends a * {@link PlotChangeEvent} to all registered listeners. * * @param paint the new crosshair paint (<code>null</code> not permitted). * * @see #getDomainCrosshairPaint() */ public void setDomainCrosshairPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.domainCrosshairPaint = paint; notifyListeners(new PlotChangeEvent(this)); }