⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstractrenderer.java

📁 大家打开看看啊, 很有用的东西
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     * The default implementation passes control to the getSeriesStroke 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 stroke.
     */
    public Stroke getItemStroke(int row, int column) {
        return getSeriesStroke(row);
    }

    /**
     * Returns the stroke used to draw the items in a series.
     *
     * @param series  the series (zero-based index).
     *
     * @return  The stroke.
     */
    public Stroke getSeriesStroke(int series) {

        // return the override, if there is one...
        if (this.stroke != null) {
            return this.stroke;
        }

        // otherwise look up the paint table
        Stroke stroke = this.strokeList.getStroke(0, series);
        if (stroke == null) {
            DrawingSupplier supplier = getDrawingSupplier();
            if (supplier != null) {
                stroke = supplier.getNextStroke();
                this.strokeList.setStroke(0, series, stroke);
            }
            else {
                stroke = this.baseStroke;
            }
        }
        return stroke;

    }
    
    /**
     * Sets the stroke for ALL series (optional).
     * 
     * @param stroke  the stroke (<code>null</code> permitted).
     */
    public void setStroke(Stroke stroke) {
        this.stroke = stroke;
    }

    /**
     * Sets the stroke used for a series.
     *
     * @param series  the series index (zero-based).
     * @param stroke  the stroke.
     */
    public void setSeriesStroke(int series, Stroke stroke) {
        this.strokeList.setStroke(0, series, stroke);
    }

    /**
     * Returns the base stroke.
     *
     * @return The base stroke.
     */
    public Stroke getBaseStroke() {
        return this.baseStroke;
    }

    /**
     * Sets the base stroke.
     *
     * @param stroke  the stroke.
     */
    public void setBaseStroke(Stroke stroke) {
        this.baseStroke = stroke;
    }

    // OUTLINE STROKE 
    
    /**
     * Returns the stroke used to outline data items.
     * <p>
     * The default implementation passes control to the getSeriesOutlineStroke 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 stroke.
     */
    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.
     */
    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 stroke = this.outlineStrokeList.getStroke(0, series);
        if (stroke == null) {
            DrawingSupplier supplier = getDrawingSupplier();
            if (supplier != null) {
                stroke = supplier.getNextStroke();
                this.strokeList.setStroke(0, series, stroke);
            }
            else {
                stroke = this.baseOutlineStroke;
            }
        }
        return stroke;

    }

    /**
     * Sets the outline stroke.
     *
     * @param stroke  the outline stroke.
     */
    public void setOutlineStroke(Stroke stroke) {
        this.outlineStroke = stroke;
    }

    /**
     * Sets the outline stroke used for a series.
     *
     * @param series  the series index (zero-based).
     * @param stroke  the stroke.
     */
    public void setSeriesOutlineStroke(int series, Stroke stroke) {
        this.outlineStrokeList.setStroke(0, series, stroke);
    }

    /**
     * Returns the base outline stroke.
     *
     * @return The base outline stroke.
     */
    public Stroke getBaseOutlineStroke() {
        return this.baseOutlineStroke;
    }

    /**
     * Sets the base outline stroke.
     *
     * @param stroke  the base outline stroke.
     */
    public void setBaseOutlineStroke(Stroke stroke) {
        this.baseOutlineStroke = stroke;
    }

    // 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.
     */
    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.
     */
    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 shape = this.shapeList.getShape(0, series);
        if (shape == null) {
            DrawingSupplier supplier = getDrawingSupplier();
            if (supplier != null) {
                shape = supplier.getNextShape();
                this.shapeList.setShape(0, series, shape);
            }
            else {
                shape = this.baseShape;
            }
        }
        return shape;

    }

    /**
     * Sets the shape for ALL series (optional).
     * 
     * @param shape  the shape (<code>null</code> permitted).
     */
    public void setShape(Shape shape) {
        this.shape = shape;    
    }
    
    /**
     * Sets the shape used for a series.
     *
     * @param series  the series index (zero-based).
     * @param shape  the shape.
     */
    public void setSeriesShape(int series, Shape shape) {
        this.shapeList.setShape(0, series, shape);
    }

    /**
     * Returns the base shape.
     *
     * @return The base shape.
     */
    public Shape getBaseShape() {
        return this.baseShape;
    }

    /**
     * Sets the base shape.
     *
     * @param shape  the shape.
     */
    public void setBaseShape(Shape shape) {
        this.baseShape = shape;
    }

    /**
     * Creates and returns a translated version of a shape.
     *
     * @param shape  the base shape.
     * @param translateX  the x translation.
     * @param translateY  the y translation.
     *
     * @return The shape.
     */
    protected synchronized Shape createTransformedShape(Shape shape,
                                                        double translateX, double translateY) {

        AffineTransform transformer = new AffineTransform();
        transformer.setToTranslation(translateX, translateY);
        return transformer.createTransformedShape(shape);

    }

    // ITEM LABEL VISIBILITY...

    /**
     * Returns <code>true</code> if an item label is visible, and <code>false</code> otherwise.
     * 
     * @param row  the row.
     * @param column  the column.
     * 
     * @return A boolean.
     */
    public boolean isItemLabelVisible(int row, int column) {
        return isSeriesItemLabelsVisible(row);
    }

    /**
     * Returns <code>true</code> if the item labels for a series area visible, and 
     * <code>false</code> otherwise.
     * 
     * @param series  the series.
     * 
     * @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) {        
        if (visible) {
            setItemLabelsVisible(Boolean.TRUE);
        }
        else {
            setItemLabelsVisible(Boolean.FALSE);
        }
        // The following alternative is not supported in 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) {
        this.itemLabelsVisible = visible;
    }

    /**
     * Sets the visibility of the item labels for a series.
     * 
     * @param series  the series.
     * @param visible  the flag.
     */
    public void setSeriesItemLabelsVisible(int series, Boolean visible) {
        this.itemLabelsVisibleList.setBoolean(series, visible);
    }

    /**
     * Returns the base setting for item label visibility.
     * 
     * @return A flag.
     */
    public Boolean getBaseItemLabelsVisible() {
        return this.baseItemLabelsVisible;
    }

    /**
     * Sets the base setting for item label visibility.
     * 
     * @param visible  the flag.
     */
    public void setBaseItemLabelsVisible(Boolean visible) {
        this.baseItemLabelsVisible = visible;
    }

    // ITEM LABEL FONT...

    /**
     * Returns the font for an item label.
     * 
     * @param row  the row.
     * @param column  the column.
     * 
     * @return The font.
     */
    public Font getItemLabelFont(int row, int column) {
        return getSeriesItemLabelFont(row);
    }

    /**
     * Returns the font for all the item labels in a series.
     * 
     * @param series  the series.
     * 
     * @return The font.
     */
    public Font getSeriesItemLabelFont(int series) {

        // return the override, if there is one...
        if (this.itemLabelFont != null) {
            return this.itemLabelFont;
        }

        // otherwise look up the font table
        Font font = this.itemLabelFontList.getFont(0, series);
        if (font == null) {
            font = this.baseItemLabelFont;
        }
        return font;

    }

    /**
     * Sets the item label font for ALL series (optional).
     * 
     * @param font  the font.
     */
    public void setItemLabelFont(Font font) {
        this.itemLabelFont = font;
    }

    /**
     * Sets the item label font for a series.
     * 
     * @param series  the series.
     * @param font  the font.
     */
    public void setSeriesItemLabelFont(int series, Font font) {
        this.itemLabelFontList.setFont(0, series, font);
    }

    /**
     * Returns the base item label font.
     * 
     * @return The base item label font.
     */
    public Font getBaseItemLabelFont() {
        return this.baseItemLabelFont;
    }

    /**
     * Sets the base item label font.
     * 
     * @param font  the font.
     */
    public void setBaseItemLabelFont(Font font) {
        this.baseItemLabelFont = font;
    }

    // ITEM LABEL PAINT...

    /**
     * Returns the paint used to draw an item label.
     * 
     * @param row  the row index (zero based).
     * @param column  the column index (zero based).
     * 
     * @return The paint.
     */
    public Paint getItemLabelPaint(int row, int column) {
        return getSeriesItemLabelPaint(row);
    }

    /**
     * Returns the paint used to draw the item labels for a series.
     * 
     * @param series  the series index (zero based).
     * 
     * @return The paint.
     */
    public Paint getSeriesItemLabelPaint(int series) {

        // return the override, if there is one...
        if (this.itemLabelPaint != null) {
            return this.itemLabelPaint;
        }

        // otherwise look up the paint table
        Paint paint = this.itemLabelPaintList.getPaint(0, series);
        if (paint == null) {
            paint = this.baseItemLabelPaint;
        }
        return paint;

⌨️ 快捷键说明

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