/** * 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(CategoryAnnotation annotation, boolean notify) { if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } this.annotations.add(annotation); annotation.addChangeListener(this); if (notify) { fireChangeEvent(); } }
/** * Clears all the annotations and sends a {@link PlotChangeEvent} to all * registered listeners. */ public void clearAnnotations() { for (int i = 0; i < this.annotations.size(); i++) { CategoryAnnotation annotation = (CategoryAnnotation) this.annotations.get(i); annotation.removeChangeListener(this); } this.annotations.clear(); fireChangeEvent(); }
/** * Draws the annotations. * * @param g2 the graphics device. * @param dataArea the data area. */ protected void drawAnnotations(Graphics2D g2, Rectangle2D dataArea) { if (getAnnotations() != null) { Iterator iterator = getAnnotations().iterator(); while (iterator.hasNext()) { CategoryAnnotation annotation = (CategoryAnnotation) iterator.next(); annotation.draw(g2, this, dataArea, getDomainAxis(), getRangeAxis()); } } }
/** * Draws the annotations. * * @param g2 the graphics device. * @param dataArea the data area. */ protected void drawAnnotations(Graphics2D g2, Rectangle2D dataArea) { if (getAnnotations() != null) { Iterator iterator = getAnnotations().iterator(); while (iterator.hasNext()) { CategoryAnnotation annotation = (CategoryAnnotation) iterator.next(); annotation.draw(g2, this, dataArea, getDomainAxis(), getRangeAxis()); } } }
/** * Clears all the annotations and sends a {@link PlotChangeEvent} to all * registered listeners. */ public void clearAnnotations() { for(int i = 0; i < this.annotations.size(); i++) { CategoryAnnotation annotation = (CategoryAnnotation) this.annotations.get(i); annotation.removeChangeListener(this); } this.annotations.clear(); 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(CategoryAnnotation annotation, boolean notify) { Args.nullNotPermitted(annotation, "annotation"); this.annotations.add(annotation); annotation.addChangeListener(this); if (notify) { fireChangeEvent(); } }
/** * Removes an annotation from 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? * * @return A boolean (indicates whether or not the annotation was removed). * * @since 1.0.10 */ public boolean removeAnnotation(CategoryAnnotation 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, if requested, 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(CategoryAnnotation annotation, boolean notify) { Args.nullNotPermitted(annotation, "annotation"); boolean removed = this.annotations.remove(annotation); annotation.removeChangeListener(this); if (removed && notify) { fireChangeEvent(); } return removed; }