abstractrenderer.java

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

JAVA
1,979
字号
     */    public Stroke getItemOutlineStroke(int row, int column) {        return getSeriesOutlineStroke(row);    }    /**     * Returns the stroke used to outline the items in a series.     *     * @param series  the series (zero-based index).     *     * @return The stroke (never <code>null</code>).     */    public Stroke getSeriesOutlineStroke(int series) {        // return the override, if there is one...        if (this.outlineStroke != null) {            return this.outlineStroke;        }        // otherwise look up the stroke table        Stroke result = this.outlineStrokeList.getStroke(series);        if (result == null) {            DrawingSupplier supplier = getDrawingSupplier();            if (supplier != null) {                result = supplier.getNextOutlineStroke();                this.outlineStrokeList.setStroke(series, result);            }            else {                result = this.baseOutlineStroke;            }        }        return result;    }    /**     * Sets the outline stroke for ALL series and sends a      * {@link RendererChangeEvent} to all registered listeners.     *     * @param stroke  the stroke (<code>null</code> permitted).     */    public void setOutlineStroke(Stroke stroke) {        setOutlineStroke(stroke, true);    }    /**     * Sets the outline stroke for ALL series and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param stroke  the stroke (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setOutlineStroke(Stroke stroke, boolean notify) {        this.outlineStroke = stroke;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        /**     * Sets the outline stroke used for a series and sends a      * {@link RendererChangeEvent} to all registered listeners.     *     * @param series  the series index (zero-based).     * @param stroke  the stroke (<code>null</code> permitted).     */    public void setSeriesOutlineStroke(int series, Stroke stroke) {        setSeriesOutlineStroke(series, stroke, true);    }    /**     * Sets the outline stroke for a series and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param series  the series index.     * @param stroke  the stroke (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setSeriesOutlineStroke(int series, Stroke stroke,                                        boolean notify) {        this.outlineStrokeList.setStroke(series, stroke);        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        /**     * Returns the base outline stroke.     *     * @return The stroke (never <code>null</code>).     */    public Stroke getBaseOutlineStroke() {        return this.baseOutlineStroke;    }    /**     * Sets the base outline stroke and sends a {@link RendererChangeEvent} to      * all registered listeners.     *     * @param stroke  the stroke (<code>null</code> not permitted).     */    public void setBaseOutlineStroke(Stroke stroke) {        setBaseOutlineStroke(stroke, true);    }    /**     * Sets the base outline stroke and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param stroke  the stroke (<code>null</code> not permitted).     * @param notify  a flag that controls whether or not listeners are      *                notified.     */    public void setBaseOutlineStroke(Stroke stroke, boolean notify) {        if (stroke == null) {            throw new IllegalArgumentException("Null 'stroke' argument.");        }        this.baseOutlineStroke = stroke;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        // SHAPE        /**     * Returns a shape used to represent a data item.     * <p>     * The default implementation passes control to the getSeriesShape 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 shape (never <code>null</code>).     */    public Shape getItemShape(int row, int column) {        return getSeriesShape(row);    }    /**     * Returns a shape used to represent the items in a series.     *     * @param series  the series (zero-based index).     *     * @return The shape (never <code>null</code>).     */    public Shape getSeriesShape(int series) {        // return the override, if there is one...        if (this.shape != null) {            return this.shape;        }        // otherwise look up the shape list        Shape result = this.shapeList.getShape(series);        if (result == null) {            DrawingSupplier supplier = getDrawingSupplier();            if (supplier != null) {                result = supplier.getNextShape();                this.shapeList.setShape(series, result);            }            else {                result = this.baseShape;            }        }        return result;    }    /**     * Sets the shape for ALL series (optional) and sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param shape  the shape (<code>null</code> permitted).     */    public void setShape(Shape shape) {        setShape(shape, true);    }        /**     * Sets the shape for ALL series and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param shape  the shape (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setShape(Shape shape, boolean notify) {        this.shape = shape;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        /**     * Sets the shape used for a series and sends a {@link RendererChangeEvent}      * to all registered listeners.     *     * @param series  the series index (zero-based).     * @param shape  the shape (<code>null</code> permitted).     */    public void setSeriesShape(int series, Shape shape) {        setSeriesShape(series, shape, true);    }    /**     * Sets the shape for a series and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param series  the series index (zero based).     * @param shape  the shape (<code>null</code> permitted).     * @param notify  notify listeners?     */    public void setSeriesShape(int series, Shape shape, boolean notify) {        this.shapeList.setShape(series, shape);        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        /**     * Returns the base shape.     *     * @return The shape (never <code>null</code>).     */    public Shape getBaseShape() {        return this.baseShape;    }    /**     * Sets the base shape and sends a {@link RendererChangeEvent} to all      * registered listeners.     *     * @param shape  the shape (<code>null</code> not permitted).     */    public void setBaseShape(Shape shape) {        // defer argument checking...        setBaseShape(shape, true);    }    /**     * Sets the base shape and, if requested, sends a      * {@link RendererChangeEvent} to all registered listeners.     *      * @param shape  the shape (<code>null</code> not permitted).      * @param notify  notify listeners?     */    public void setBaseShape(Shape shape, boolean notify) {        if (shape == null) {            throw new IllegalArgumentException("Null 'shape' argument.");         }        this.baseShape = shape;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }        // ITEM LABEL VISIBILITY...    /**     * Returns <code>true</code> if an item label is visible, and      * <code>false</code> otherwise.     *      * @param row  the row index (zero-based).     * @param column  the column index (zero-based).     *      * @return A boolean.     */    public boolean isItemLabelVisible(int row, int column) {        return isSeriesItemLabelsVisible(row);    }    /**     * Returns <code>true</code> if the item labels for a series are visible,      * and <code>false</code> otherwise.     *      * @param series  the series index (zero-based).     *      * @return A boolean.     */        public boolean isSeriesItemLabelsVisible(int series) {        // return the override, if there is one...        if (this.itemLabelsVisible != null) {            return this.itemLabelsVisible.booleanValue();        }        // otherwise look up the boolean table        Boolean b = this.itemLabelsVisibleList.getBoolean(series);        if (b == null) {            b = this.baseItemLabelsVisible;        }        if (b == null) {            b = Boolean.FALSE;        }        return b.booleanValue();    }        /**     * Sets the visibility of the item labels for ALL series.     *      * @param visible  the flag.     */    public void setItemLabelsVisible(boolean visible) {                setItemLabelsVisible(BooleanUtilities.valueOf(visible));        // The following alternative is only supported in JDK 1.4 - we support         // JDK 1.2.2        // setItemLabelsVisible(Boolean.valueOf(visible));    }        /**     * Sets the visibility of the item labels for ALL series (optional).     *      * @param visible  the flag (<code>null</code> permitted).     */    public void setItemLabelsVisible(Boolean visible) {        setItemLabelsVisible(visible, true);    }        /**     * Sets the visibility of item labels for ALL series and, if requested,      * sends a {@link RendererChangeEvent} to all registered listeners.     *      * @param visible  a flag that controls whether or not the item labels are      *                 visible (<code>null</code> permitted).     * @param notify  a flag that controls whether or not listeners are      *                notified.     */    public void setItemLabelsVisible(Boolean visible, boolean notify) {        this.itemLabelsVisible = visible;        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    /**     * Sets a flag that controls the visibility of the item labels for a series.     *      * @param series  the series index (zero-based).     * @param visible  the flag.     */    public void setSeriesItemLabelsVisible(int series, boolean visible) {        setSeriesItemLabelsVisible(series, BooleanUtilities.valueOf(visible));    }        /**     * Sets the visibility of the item labels for a series.     *      * @param series  the series index (zero-based).     * @param visible  the flag (<code>null</code> permitted).     */    public void setSeriesItemLabelsVisible(int series, Boolean visible) {        setSeriesItemLabelsVisible(series, visible, true);    }    /**     * Sets the visibility of item labels for a series and, if requested, sends      * a {@link RendererChangeEvent} to all registered listeners.     *      * @param series  the series index (zero-based).     * @param visible  the visible flag.     * @param notify  a flag that controls whether or not listeners are      *                notified.     */    public void setSeriesItemLabelsVisible(int series, Boolean visible,                                            boolean notify) {        this.itemLabelsVisibleList.setBoolean(series, visible);        if (notify) {            notifyListeners(new RendererChangeEvent(this));        }    }    /**     * Returns the base setting for item label visibility.     *      * @return A flag (possibly <code>null</code>).     */    public Boolean getBaseItemLabelsVisible() {        return this.baseItemLabelsVisible;    }    /**     * Sets the base flag that controls whether or not item labels are visible.     *      * @param visible  the flag.     */    public void setBaseItemLabelsVisible(boolean visible) {        setBaseItemLabelsVisible(BooleanUtilities.valueOf(visible));    }        /**     * Sets the base setting for item label visibility.     *      * @param visible  the flag (<code>null</code> permitted).     */

⌨️ 快捷键说明

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