/** * 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(); } }
/** * 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(); } }
/** * 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."); } } /**
/** * 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."); } } /**