abstractrenderer.java

来自「JfreeChart 常用图表例子」· Java 代码 · 共 1,979 行 · 第 1/5 页

JAVA
1,979
字号
            }        }        return result;    }        /**     * Returns the flag that controls the visibility of ALL series.  This flag      * overrides the per series and default settings - you must set it to      * <code>null</code> if you want the other settings to apply.     *      * @return The flag (possibly <code>null</code>).     */    public Boolean getSeriesVisible() {        return this.seriesVisible;       }        /**     * Sets the flag that controls the visibility of ALL series and sends a      * {@link RendererChangeEvent} to all registered listeners.  This flag      * overrides the per series and default settings - you must set it to      * <code>null</code> if you want the other settings to apply.     *      * @param visible  the flag (<code>null</code> permitted).     */    public void setSeriesVisible(Boolean visible) {         setSeriesVisible(visible, true);    }        /**     * Sets the flag that controls the visibility of ALL series and sends a      * {@link RendererChangeEvent} to all registered listeners.  This flag      * overrides the per series and default settings - you must set it to      * <code>null</code> if you want the other settings to apply.     *      * @param visible  the flag (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setSeriesVisible(Boolean visible, boolean notify) {        this.seriesVisible = visible;           if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        /**     * Returns the flag that controls whether a series is visible.     *     * @param series  the series index (zero-based).     *     * @return The flag (possibly <code>null</code>).     */    public Boolean getSeriesVisible(int series) {        return this.seriesVisibleList.getBoolean(series);    }        /**     * Sets the flag that controls whether a series is visible and sends a      * {@link RendererChangeEvent} to all registered listeners.     *     * @param series  the series index (zero-based).     * @param visible  the flag (<code>null</code> permitted).     */    public void setSeriesVisible(int series, Boolean visible) {        setSeriesVisible(series, visible, true);    }        /**     * Sets the flag that controls whether a series is visible and, if      * requested, sends a {@link RendererChangeEvent} to all registered      * listeners.     *      * @param series  the series index.     * @param visible  the flag (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setSeriesVisible(int series, Boolean visible, boolean notify) {        this.seriesVisibleList.setBoolean(series, visible);               if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    /**     * Returns the base visibility for all series.     *     * @return The base visibility.     */    public boolean getBaseSeriesVisible() {        return this.baseSeriesVisible;    }    /**     * Sets the base visibility and sends a {@link RendererChangeEvent}      * to all registered listeners.     *     * @param visible  the flag.     */    public void setBaseSeriesVisible(boolean visible) {        // defer argument checking...        setBaseSeriesVisible(visible, true);    }        /**     * Sets the base visibility and, if requested, sends      * a {@link RendererChangeEvent} to all registered listeners.     *      * @param visible  the visibility.     * @param notify  notify listeners?     */    public void setBaseSeriesVisible(boolean visible, boolean notify) {        this.baseSeriesVisible = visible;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    // SERIES VISIBLE IN LEGEND (not yet respected by all renderers)        /**     * Returns <code>true</code> if the series should be shown in the legend,     * and <code>false</code> otherwise.     *      * @param series  the series index.     *      * @return A boolean.     */    public boolean isSeriesVisibleInLegend(int series) {        boolean result = this.baseSeriesVisibleInLegend;        if (this.seriesVisibleInLegend != null) {            result = this.seriesVisibleInLegend.booleanValue();           }        else {            Boolean b = this.seriesVisibleInLegendList.getBoolean(series);            if (b != null) {                result = b.booleanValue();               }        }        return result;    }        /**     * Returns the flag that controls the visibility of ALL series in the      * legend.  This flag overrides the per series and default settings - you      * must set it to <code>null</code> if you want the other settings to      * apply.     *      * @return The flag (possibly <code>null</code>).     */    public Boolean getSeriesVisibleInLegend() {        return this.seriesVisibleInLegend;       }        /**     * Sets the flag that controls the visibility of ALL series in the legend      * and sends a {@link RendererChangeEvent} to all registered listeners.       * This flag overrides the per series and default settings - you must set      * it to <code>null</code> if you want the other settings to apply.     *      * @param visible  the flag (<code>null</code> permitted).     */    public void setSeriesVisibleInLegend(Boolean visible) {         setSeriesVisibleInLegend(visible, true);    }        /**     * Sets the flag that controls the visibility of ALL series in the legend      * and sends a {@link RendererChangeEvent} to all registered listeners.       * This flag overrides the per series and default settings - you must set      * it to <code>null</code> if you want the other settings to apply.     *      * @param visible  the flag (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setSeriesVisibleInLegend(Boolean visible, boolean notify) {        this.seriesVisibleInLegend = visible;           if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        /**     * Returns the flag that controls whether a series is visible in the      * legend.  This method returns only the "per series" settings - to      * incorporate the override and base settings as well, you need to use the      * {@link #isSeriesVisibleInLegend(int)} method.     *     * @param series  the series index (zero-based).     *     * @return The flag (possibly <code>null</code>).     */    public Boolean getSeriesVisibleInLegend(int series) {        return this.seriesVisibleInLegendList.getBoolean(series);    }        /**     * Sets the flag that controls whether a series is visible in the legend      * and sends a {@link RendererChangeEvent} to all registered listeners.     *     * @param series  the series index (zero-based).     * @param visible  the flag (<code>null</code> permitted).     */    public void setSeriesVisibleInLegend(int series, Boolean visible) {        setSeriesVisibleInLegend(series, visible, true);    }        /**     * Sets the flag that controls whether a series is visible in the legend     * and, if requested, sends a {@link RendererChangeEvent} to all registered      * listeners.     *      * @param series  the series index.     * @param visible  the flag (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setSeriesVisibleInLegend(int series, Boolean visible,                                          boolean notify) {        this.seriesVisibleInLegendList.setBoolean(series, visible);               if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    /**     * Returns the base visibility in the legend for all series.     *     * @return The base visibility.     */    public boolean getBaseSeriesVisibleInLegend() {        return this.baseSeriesVisibleInLegend;    }    /**     * Sets the base visibility in the legend and sends a      * {@link RendererChangeEvent} to all registered listeners.     *     * @param visible  the flag.     */    public void setBaseSeriesVisibleInLegend(boolean visible) {        // defer argument checking...        setBaseSeriesVisibleInLegend(visible, true);    }        /**     * Sets the base visibility in the legend and, if requested, sends      * a {@link RendererChangeEvent} to all registered listeners.     *      * @param visible  the visibility.     * @param notify  notify listeners?     */    public void setBaseSeriesVisibleInLegend(boolean visible, boolean notify) {        this.baseSeriesVisibleInLegend = visible;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    // PAINT        /**     * Returns the paint used to fill data items as they are drawn.     * <p>     * The default implementation passes control to the      * <code>getSeriesPaint</code> method. You can override this method if you      * require different behaviour.     *     * @param row  the row (or series) index (zero-based).     * @param column  the column (or category) index (zero-based).     *     * @return The paint (never <code>null</code>).     */    public Paint getItemPaint(int row, int column) {        return getSeriesPaint(row);    }    /**     * Returns the paint used to fill an item drawn by the renderer.     *     * @param series  the series index (zero-based).     *     * @return The paint (never <code>null</code>).     */    public Paint getSeriesPaint(int series) {        // return the override, if there is one...        if (this.paint != null) {            return this.paint;        }        // otherwise look up the paint list        Paint seriesPaint = this.paintList.getPaint(series);        if (seriesPaint == null) {            DrawingSupplier supplier = getDrawingSupplier();            if (supplier != null) {                seriesPaint = supplier.getNextPaint();                this.paintList.setPaint(series, seriesPaint);            }            else {                seriesPaint = this.basePaint;            }        }        return seriesPaint;    }    /**     * Sets the paint to be used for ALL series, and sends a      * {@link RendererChangeEvent} to all registered listeners.  If this is      * <code>null</code>, the renderer will use the paint for the series.     *      * @param paint  the paint (<code>null</code> permitted).     */    public void setPaint(Paint paint) {        setPaint(paint, true);    }        /**     * Sets the paint to be used for all series and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param paint  the paint (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setPaint(Paint paint, boolean notify) {        this.paint = paint;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        /**     * Sets the paint used for a series and sends a {@link RendererChangeEvent}     * to all registered listeners.     *     * @param series  the series index (zero-based).     * @param paint  the paint (<code>null</code> permitted).     */    public void setSeriesPaint(int series, Paint paint) {        setSeriesPaint(series, paint, true);    }        /**     * Sets the paint used for a series and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param series  the series index.     * @param paint  the paint (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setSeriesPaint(int series, Paint paint, boolean notify) {        this.paintList.setPaint(series, paint);               if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    /**     * Returns the base paint.     *     * @return The base paint (never <code>null</code>).     */    public Paint getBasePaint() {        return this.basePaint;    }    /**     * Sets the base paint and sends a {@link RendererChangeEvent} to all      * registered listeners.     *     * @param paint  the paint (<code>null</code> not permitted).     */    public void setBasePaint(Paint paint) {        // defer argument checking...        setBasePaint(paint, true);    }        /**     * Sets the base paint and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param paint  the paint (<code>null</code> not permitted).     * @param notify  notify listeners?     */    public void setBasePaint(Paint paint, boolean notify) {        this.basePaint = paint;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    //// FILL PAINT //////////////////////////////////////////////////////////        /**     * Returns the paint used to fill data items as they are drawn.  The      * default implementation passes control to the      * {@link #getSeriesFillPaint(int)} method - you can override this method      * if you require different behaviour.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?