📄 abstractrenderer.java
字号:
/** * 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) { // defer argument checking... 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)); } } /** * 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 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(BooleanUtils.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, BooleanUtils.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(BooleanUtils.valueOf(visible)); } /** * Sets the base setting for item label visibility. * * @param visible the flag (<code>null</code> permitted). */ public void setBaseItemLabelsVisible(Boolean visible) { setBaseItemLabelsVisible(visible, true); } /** * Sets the base visibility for item labels and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param visible the visibility flag. * @param notify a flag that controls whether or not listeners are notified. */ public void setBaseItemLabelsVisible(Boolean visible, boolean notify) { this.baseItemLabelsVisible = visible; if (notify) { notifyListeners(new RendererChangeEvent(this)); } } //// ITEM LABEL FONT ///////////////////////////////////////////////////////////////////////// /** * Returns the font for an item label. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The font (never <code>null</code>). */ public Font getItemLabelFont(int row, int column) { Font result = getSeriesItemLabelFont(row); if (result == null) { result = this.baseItemLabelFont; } return result; } /** * Returns the font used for all item labels. This may be <code>null</code>, in which case * the per series font settings will apply. * * @return The font (possibly <code>null</code>).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -