/** * Adds an annotation to the plot and, if requested, sends a * {@link PlotChangeEvent} to all registered listeners. * * @param annotation the annotation (<code>null</code> not permitted). * @param notify notify listeners? * * @since 1.0.10 */ public void addAnnotation(XYAnnotation annotation, boolean notify) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } this.annotations.add(annotation); annotation.addChangeListener(this); if (notify) { fireChangeEvent(); } }
/** * Draws the annotations for the plot. * * @param g2 the graphics device. * @param dataArea the data area. * @param info the chart rendering info. */ public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info) { Iterator iterator = this.annotations.iterator(); while (iterator.hasNext()) { XYAnnotation annotation = (XYAnnotation) iterator.next(); ValueAxis xAxis = getDomainAxis(); ValueAxis yAxis = getRangeAxis(); annotation.draw(g2, this, dataArea, xAxis, yAxis, 0, info); } }
/** * Removes all annotations and sends a {@link RendererChangeEvent} * to all registered listeners. */ @Override public void removeAnnotations() { for (XYAnnotation annotation : this.foregroundAnnotations) { annotation.removeChangeListener(this); } for (XYAnnotation annotation : this.backgroundAnnotations) { annotation.removeChangeListener(this); } this.foregroundAnnotations.clear(); this.backgroundAnnotations.clear(); fireChangeEvent(); }
/** * Clears all the annotations and sends a {@link PlotChangeEvent} to all * registered listeners. * * @see #addAnnotation(XYAnnotation) */ public void clearAnnotations() { for (XYAnnotation annotation : this.annotations) { annotation.removeChangeListener(this); } this.annotations.clear(); fireChangeEvent(); }
/** * Draws the annotations for the plot. * * @param g2 the graphics device. * @param dataArea the data area. * @param info the chart rendering info. */ public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info) { Iterator iterator = this.annotations.iterator(); while (iterator.hasNext()) { XYAnnotation annotation = (XYAnnotation) iterator.next(); ValueAxis xAxis = getDomainAxis(); ValueAxis yAxis = getRangeAxis(); annotation.draw(g2, this, dataArea, xAxis, yAxis, 0, info); } }
/** * Adds an annotation to the plot and, if requested, sends a * {@link PlotChangeEvent} to all registered listeners. * * @param annotation the annotation ({@code null} not permitted). * @param notify notify listeners? * * @since 1.0.10 */ public void addAnnotation(XYAnnotation annotation, boolean notify) { Args.nullNotPermitted(annotation, "annotation"); this.annotations.add(annotation); annotation.addChangeListener(this); if (notify) { fireChangeEvent(); } }
/** * Clears all the annotations and sends a {@link PlotChangeEvent} to all * registered listeners. * * @see #addAnnotation(XYAnnotation) */ public void clearAnnotations() { for(int i = 0; i < this.annotations.size(); i++){ XYAnnotation annotation = (XYAnnotation) this.annotations.get(i); annotation.removeChangeListener(this); } this.annotations.clear(); fireChangeEvent(); }
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis, 0, info);
/** * Adds an annotation to the specified layer and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param annotation the annotation (<code>null</code> not permitted). * @param layer the layer (<code>null</code> not permitted). */ public void addAnnotation(XYAnnotation annotation, Layer layer) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } if (layer.equals(Layer.FOREGROUND)) { this.foregroundAnnotations.add(annotation); annotation.addChangeListener(this); fireChangeEvent(); } else if (layer.equals(Layer.BACKGROUND)) { this.backgroundAnnotations.add(annotation); annotation.addChangeListener(this); fireChangeEvent(); } else { // should never get here throw new RuntimeException("Unknown layer."); } } /**
/** * Removes all annotations and sends a {@link RendererChangeEvent} * to all registered listeners. */ public void removeAnnotations() { for(int i = 0; i < this.foregroundAnnotations.size(); i++){ XYAnnotation annotation = (XYAnnotation) this.foregroundAnnotations.get(i); annotation.removeChangeListener(this); } for(int i = 0; i < this.backgroundAnnotations.size(); i++){ XYAnnotation annotation = (XYAnnotation) this.backgroundAnnotations.get(i); annotation.removeChangeListener(this); } this.foregroundAnnotations.clear(); this.backgroundAnnotations.clear(); fireChangeEvent(); }
annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis, index, info);
/** * Adds an annotation to the specified layer and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param annotation the annotation ({@code null} not permitted). * @param layer the layer ({@code null} not permitted). */ @Override public void addAnnotation(XYAnnotation annotation, Layer layer) { Args.nullNotPermitted(annotation, "annotation"); if (layer.equals(Layer.FOREGROUND)) { this.foregroundAnnotations.add(annotation); annotation.addChangeListener(this); fireChangeEvent(); } else if (layer.equals(Layer.BACKGROUND)) { this.backgroundAnnotations.add(annotation); annotation.addChangeListener(this); fireChangeEvent(); } else { // should never get here throw new RuntimeException("Unknown layer."); } } /**
/** * Removes the specified annotation and sends a {@link RendererChangeEvent} * to all registered listeners. * * @param annotation the annotation to remove (<code>null</code> not * permitted). * * @return A boolean to indicate whether or not the annotation was * successfully removed. */ public boolean removeAnnotation(XYAnnotation annotation) { boolean removed = this.foregroundAnnotations.remove(annotation); removed = removed & this.backgroundAnnotations.remove(annotation); annotation.removeChangeListener(this); fireChangeEvent(); return removed; }
/** * Removes the specified annotation and sends a {@link RendererChangeEvent} * to all registered listeners. * * @param annotation the annotation to remove ({@code null} not * permitted). * * @return A boolean to indicate whether or not the annotation was * successfully removed. */ @Override public boolean removeAnnotation(XYAnnotation annotation) { boolean removed = this.foregroundAnnotations.remove(annotation); removed = removed & this.backgroundAnnotations.remove(annotation); annotation.removeChangeListener(this); fireChangeEvent(); return removed; }
/** * Removes an annotation from the plot and sends a {@link PlotChangeEvent} * to all registered listeners. * * @param annotation the annotation (<code>null</code> not permitted). * @param notify notify listeners? * * @return A boolean (indicates whether or not the annotation was removed). * * @since 1.0.10 */ public boolean removeAnnotation(XYAnnotation annotation, boolean notify) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } boolean removed = this.annotations.remove(annotation); annotation.removeChangeListener(this); if (removed && notify) { fireChangeEvent(); } return removed; }
/** * Removes an annotation from the plot and sends a {@link PlotChangeEvent} * to all registered listeners. * * @param annotation the annotation ({@code null} not permitted). * @param notify notify listeners? * * @return A boolean (indicates whether or not the annotation was removed). * * @since 1.0.10 */ public boolean removeAnnotation(XYAnnotation annotation, boolean notify) { Args.nullNotPermitted(annotation, "annotation"); boolean removed = this.annotations.remove(annotation); annotation.removeChangeListener(this); if (removed && notify) { fireChangeEvent(); } return removed; }