org.jfree.chart.event.PlotChangeEvent Java Examples

The following examples show how to use org.jfree.chart.event.PlotChangeEvent. 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: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Sets a domain axis and, if requested, sends a {@link PlotChangeEvent} to 
 * all registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis (<code>null</code> permitted).
 * @param notify  notify listeners?
 */
public void setDomainAxis(int index, CategoryAxis axis, boolean notify) {
    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);
    }
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
Example #2
Source File: Cardumen_006_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Sets a domain axis and, if requested, sends a {@link PlotChangeEvent} to 
 * all registered listeners.
 *
 * @param index  the axis index.
 * @param axis  the axis (<code>null</code> permitted).
 * @param notify  notify listeners?
 */
public void setDomainAxis(int index, CategoryAxis axis, boolean notify) {
    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);
    }
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
Example #3
Source File: Cardumen_00143_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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));
    }
}
 
Example #4
Source File: Chart_19_CategoryPlot_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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 {
        configureRangeAxes();
        PlotChangeEvent e = new PlotChangeEvent(this);
        notifyListeners(e);
    }
}
 
Example #5
Source File: Nopol2017_005_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Receives notification of a change to the plot's dataset.
 * <P>
 * The range axis bounds will be recalculated if necessary.
 *
 * @param event  information about the event (not used here).
 */
public void datasetChanged(DatasetChangeEvent event) {

    int count = this.rangeAxes.size();
    for (int axisIndex = 0; axisIndex < count; axisIndex++) {
        ValueAxis yAxis = getRangeAxis(axisIndex);
        if (yAxis != null) {
            yAxis.configure();
        }
    }
    if (getParent() != null) {
        getParent().datasetChanged(event);
    }
    else {
        PlotChangeEvent e = new PlotChangeEvent(this);
        e.setType(ChartChangeEventType.DATASET_UPDATED);
        notifyListeners(e);
    }

}
 
Example #6
Source File: JGenProg2017_0081_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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));
    }
}
 
Example #7
Source File: Nopol2017_005_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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 {
        configureRangeAxes();
        PlotChangeEvent e = new PlotChangeEvent(this);
        notifyListeners(e);
    }
}
 
Example #8
Source File: Cardumen_00243_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * 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));
    }
}
 
Example #9
Source File: jMutRepair_0021_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Receives notification of a change to the plot's dataset.
 * <P>
 * The range axis bounds will be recalculated if necessary.
 *
 * @param event  information about the event (not used here).
 */
public void datasetChanged(DatasetChangeEvent event) {

    int count = this.rangeAxes.size();
    for (int axisIndex = 0; axisIndex < count; axisIndex++) {
        ValueAxis yAxis = getRangeAxis(axisIndex);
        if (yAxis != null) {
            yAxis.configure();
        }
    }
    if (getParent() != null) {
        getParent().datasetChanged(event);
    }
    else {
        PlotChangeEvent e = new PlotChangeEvent(this);
        e.setType(ChartChangeEventType.DATASET_UPDATED);
        notifyListeners(e);
    }

}
 
Example #10
Source File: 1_CategoryPlot.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 {
        configureRangeAxes();
        PlotChangeEvent e = new PlotChangeEvent(this);
        notifyListeners(e);
    }
}
 
Example #11
Source File: Chart_15_PiePlot_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the direction in which the pie sections are drawn and sends a 
 * {@link PlotChangeEvent} to all registered listeners.
 *
 * @param direction  the direction (<code>null</code> not permitted).
 * 
 * @see #getDirection()
 */
public void setDirection(Rotation direction) {
    if (direction == null) {
        throw new IllegalArgumentException("Null 'direction' argument.");
    }
    this.direction = direction;
    notifyListeners(new PlotChangeEvent(this));

}
 
Example #12
Source File: jMutRepair_0021_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Clears the domain axes from the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 */
public void clearDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
        CategoryAxis axis = (CategoryAxis) this.domainAxes.get(i);
        if (axis != null) {
            axis.removeChangeListener(this);
        }
    }
    this.domainAxes.clear();
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #13
Source File: JGenProg2017_005_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 #14
Source File: Cardumen_00143_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Clears the domain axes from the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 */
public void clearDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
        CategoryAxis axis = (CategoryAxis) this.domainAxes.get(i);
        if (axis != null) {
            axis.removeChangeListener(this);
        }
    }
    this.domainAxes.clear();
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #15
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the location for a range axis and sends a {@link PlotChangeEvent} 
 * to all registered listeners.
 *
 * @param index  the axis index.
 * @param location  the location.
 * @param notify  notify listeners?
 * 
 * @see #getRangeAxisLocation(int)
 * @see #setDomainAxisLocation(int, AxisLocation, boolean)
 */
public void setRangeAxisLocation(int index, AxisLocation location, 
                                 boolean notify) {
    if (index == 0 && location == null) {
        throw new IllegalArgumentException(
                "Null 'location' for index 0 not permitted.");
    }
    this.rangeAxisLocations.set(index, location);
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
Example #16
Source File: Cardumen_00243_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Clears the domain axes from the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 */
public void clearDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
        CategoryAxis axis = (CategoryAxis) this.domainAxes.get(i);
        if (axis != null) {
            axis.removeChangeListener(this);
        }
    }
    this.domainAxes.clear();
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #17
Source File: jKali_001_t.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 #18
Source File: CategoryPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Receives notification of a change to an {@link Annotation} added to
 * this plot.
 *
 * @param event  information about the event (not used here).
 *
 * @since 1.0.14
 */
@Override
public void annotationChanged(AnnotationChangeEvent event) {
    if (getParent() != null) {
        getParent().annotationChanged(event);
    } else {
        PlotChangeEvent e = new PlotChangeEvent(this);
        notifyListeners(e);
    }
}
 
Example #19
Source File: Cardumen_00143_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the location for a range axis and sends a {@link PlotChangeEvent} 
 * to all registered listeners.
 *
 * @param index  the axis index.
 * @param location  the location.
 * @param notify  notify listeners?
 * 
 * @see #getRangeAxisLocation(int)
 * @see #setDomainAxisLocation(int, AxisLocation, boolean)
 */
public void setRangeAxisLocation(int index, AxisLocation location, 
                                 boolean notify) {
    if (index == 0 && location == null) {
        throw new IllegalArgumentException(
                "Null 'location' for index 0 not permitted.");
    }
    this.rangeAxisLocations.set(index, location);
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
Example #20
Source File: JGenProg2017_005_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Clears all the annotations and sends a {@link PlotChangeEvent} to all
 * registered listeners.
 */
public void clearAnnotations() {
    this.annotations.clear();
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #21
Source File: Nopol2017_005_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Clears all the annotations and sends a {@link PlotChangeEvent} to all
 * registered listeners.
 */
public void clearAnnotations() {
    this.annotations.clear();
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #22
Source File: JGenProg2017_005_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * 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).
 * 
 * @see #getDatasetRenderingOrder()
 */
public void setDatasetRenderingOrder(DatasetRenderingOrder order) {
    if (order == null) {
        throw new IllegalArgumentException("Null 'order' argument.");   
    }
    this.renderingOrder = order;
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #23
Source File: jMutRepair_0021_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Sets the paint used to draw the grid-lines (if any) against the domain 
 * axis and sends a {@link PlotChangeEvent} to all registered listeners.
 *
 * @param paint  the paint (<code>null</code> not permitted).
 * 
 * @see #getDomainGridlinePaint()
 */
public void setDomainGridlinePaint(Paint paint) {
    if (paint == null) {
        throw new IllegalArgumentException("Null 'paint' argument.");   
    }
    this.domainGridlinePaint = paint;
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #24
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Sets the anchor value and, if requested, sends a {@link PlotChangeEvent}
 * to all registered listeners.
 * 
 * @param value  the value.
 * @param notify  notify listeners?
 * 
 * @see #getAnchorValue()
 */
public void setAnchorValue(double value, boolean notify) {
    this.anchorValue = value;
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}
 
Example #25
Source File: JGenProg2017_005_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Sets the orientation for the plot and sends a {@link PlotChangeEvent} to
 * all registered listeners.
 *
 * @param orientation  the orientation (<code>null</code> not permitted).
 * 
 * @see #getOrientation()
 */
public void setOrientation(PlotOrientation orientation) {
    if (orientation == null) {
        throw new IllegalArgumentException("Null 'orientation' argument.");
    }
    this.orientation = orientation;
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #26
Source File: Chart_19_CategoryPlot_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * 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));
}
 
Example #27
Source File: Cardumen_006_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Sets the domain axes for this plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.
 * 
 * @param axes  the axes (<code>null</code> not permitted).
 * 
 * @see #setRangeAxes(ValueAxis[])
 */
public void setDomainAxes(CategoryAxis[] axes) {
    for (int i = 0; i < axes.length; i++) {
        setDomainAxis(i, axes[i], false);   
    }
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #28
Source File: Cardumen_00243_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Sets the pen-style (<code>Stroke</code>) used to draw the range 
 * crosshair (if visible), and sends a {@link PlotChangeEvent} to all 
 * registered listeners.
 *
 * @param stroke  the new crosshair stroke (<code>null</code> not 
 *         permitted).
 * 
 * @see #getRangeCrosshairStroke()
 */
public void setRangeCrosshairStroke(Stroke stroke) {
    if (stroke == null) {
        throw new IllegalArgumentException("Null 'stroke' argument.");
    }
    this.rangeCrosshairStroke = stroke;
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #29
Source File: patch1-Chart-26-jMutRepair_patch1-Chart-26-jMutRepair_t.java    From coming with MIT License 3 votes vote down vote up
/**
 * Sets the axis offsets (gap between the data area and the axes) and
 * sends a {@link PlotChangeEvent} to all registered listeners.
 *
 * @param offset  the offset (<code>null</code> not permitted).
 * 
 * @see #getAxisOffset()
 */
public void setAxisOffset(RectangleInsets offset) {
    if (offset == null) {
        throw new IllegalArgumentException("Null 'offset' argument.");   
    }
    this.axisOffset = offset;
    notifyListeners(new PlotChangeEvent(this));
}
 
Example #30
Source File: jMutRepair_0021_s.java    From coming with MIT License 3 votes vote down vote up
/**
 * Sets the axis offsets (gap between the data area and the axes) and
 * sends a {@link PlotChangeEvent} to all registered listeners.
 *
 * @param offset  the offset (<code>null</code> not permitted).
 * 
 * @see #getAxisOffset()
 */
public void setAxisOffset(RectangleInsets offset) {
    if (offset == null) {
        throw new IllegalArgumentException("Null 'offset' argument.");   
    }
    this.axisOffset = offset;
    notifyListeners(new PlotChangeEvent(this));
}