org.jfree.chart.annotations.CategoryAnnotation Java Examples

The following examples show how to use org.jfree.chart.annotations.CategoryAnnotation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JGenProg2017_00124_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #2
Source File: JGenProg2017_00102_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #3
Source File: Arja_00112_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #4
Source File: Cardumen_00139_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #5
Source File: Cardumen_00191_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #6
Source File: Cardumen_000_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #7
Source File: JGenProg2017_000_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #8
Source File: JGenProg2017_000_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #9
Source File: JGenProg2017_0044_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #10
Source File: AbstractCategoryItemRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #11
Source File: JGenProg2017_0044_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #12
Source File: jKali_000_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #13
Source File: Elixir_000_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #14
Source File: jMutRepair_0020_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #15
Source File: Arja_0062_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #16
Source File: Chart_1_AbstractCategoryItemRenderer_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #17
Source File: jMutRepair_0020_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #18
Source File: Elixir_000_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #19
Source File: jKali_0031_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #20
Source File: JGenProg2017_0044_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #21
Source File: Chart_1_AbstractCategoryItemRenderer_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #22
Source File: 1_AbstractCategoryItemRenderer.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #23
Source File: jKali_000_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #24
Source File: JGenProg2017_000_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #25
Source File: Cardumen_00139_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Adds an annotation to the specified layer.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 * @param layer  the layer (<code>null</code> not permitted).
 *
 * @since 1.2.0
 */
public void addAnnotation(CategoryAnnotation annotation, Layer layer) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    if (layer.equals(Layer.FOREGROUND)) {
        this.foregroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        this.backgroundAnnotations.add(annotation);
        notifyListeners(new RendererChangeEvent(this));
    }
    else {
        // should never get here
        throw new RuntimeException("Unknown layer.");
    }
}
 
Example #26
Source File: patch1-Chart-1-jMutRepair_patch1-Chart-1-jMutRepair_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #27
Source File: jKali_0031_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws all the annotations for the specified layer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param layer  the layer.
 * @param info  the plot rendering info.
 *
 * @since 1.2.0
 */
public void drawAnnotations(Graphics2D g2, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis, Layer layer,
        PlotRenderingInfo info) {

    Iterator iterator = null;
    if (layer.equals(Layer.FOREGROUND)) {
        iterator = this.foregroundAnnotations.iterator();
    }
    else if (layer.equals(Layer.BACKGROUND)) {
        iterator = this.backgroundAnnotations.iterator();
    }
    else {
        // should not get here
        throw new RuntimeException("Unknown layer.");
    }
    while (iterator.hasNext()) {
        CategoryAnnotation annotation = (CategoryAnnotation) iterator.next();
        annotation.draw(g2, this.plot, dataArea, domainAxis, rangeAxis,
                0, info);
    }

}
 
Example #28
Source File: CategoryPlot.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #29
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Removes an annotation from the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 *
 * @param annotation  the annotation (<code>null</code> not permitted).
 *
 * @return A boolean (indicates whether or not the annotation was removed).
 * 
 * @see #addAnnotation(CategoryAnnotation)
 */
public boolean removeAnnotation(CategoryAnnotation annotation) {
    if (annotation == null) {
        throw new IllegalArgumentException("Null 'annotation' argument.");
    }
    boolean removed = this.annotations.remove(annotation);
    if (removed) {
        notifyListeners(new PlotChangeEvent(this));
    }
    return removed;
}
 
Example #30
Source File: CategoryPlot.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
        }
    }

}