org.jfree.chart.util.GradientPaintTransformer Java Examples
The following examples show how to use
org.jfree.chart.util.GradientPaintTransformer.
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: XYBarRenderer.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns a clone of the renderer. * * @return A clone. * * @throws CloneNotSupportedException if the renderer cannot be cloned. */ public Object clone() throws CloneNotSupportedException { XYBarRenderer result = (XYBarRenderer) super.clone(); if (this.gradientPaintTransformer != null) { result.gradientPaintTransformer = (GradientPaintTransformer) ObjectUtilities.clone(this.gradientPaintTransformer); } result.legendBar = ShapeUtilities.clone(this.legendBar); return result; }
Example #2
Source File: XYBarRenderer.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns a clone of the renderer. * * @return A clone. * * @throws CloneNotSupportedException if the renderer cannot be cloned. */ public Object clone() throws CloneNotSupportedException { XYBarRenderer result = (XYBarRenderer) super.clone(); if (this.gradientPaintTransformer != null) { result.gradientPaintTransformer = (GradientPaintTransformer) ObjectUtilities.clone(this.gradientPaintTransformer); } result.legendBar = ShapeUtilities.clone(this.legendBar); return result; }
Example #3
Source File: StandardXYBarPainter.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Paints a single bar instance. * * @param g2 the graphics target. * @param renderer the renderer. * @param row the row index. * @param column the column index. * @param selected is the data item selected? * @param bar the bar * @param base indicates which side of the rectangle is the base of the * bar. * * @since 1.2.0 */ public void paintBar(Graphics2D g2, XYBarRenderer renderer, int row, int column, boolean selected, RectangularShape bar, RectangleEdge base) { Paint itemPaint = renderer.getItemPaint(row, column, selected); GradientPaintTransformer t = renderer.getGradientPaintTransformer(); if (t != null && itemPaint instanceof GradientPaint) { itemPaint = t.transform((GradientPaint) itemPaint, bar); } g2.setPaint(itemPaint); g2.fill(bar); // draw the outline... if (renderer.isDrawBarOutline()) { // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) { Stroke stroke = renderer.getItemOutlineStroke(row, column, selected); Paint paint = renderer.getItemOutlinePaint(row, column, selected); if (stroke != null && paint != null) { g2.setStroke(stroke); g2.setPaint(paint); g2.draw(bar); } } }
Example #4
Source File: StandardBarPainter.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Paints a single bar instance. * * @param g2 the graphics target. * @param renderer the renderer. * @param row the row index. * @param column the column index. * @param selected is the item selected? * @param bar the bar * @param base indicates which side of the rectangle is the base of the * bar. */ public void paintBar(Graphics2D g2, BarRenderer renderer, int row, int column, boolean selected, RectangularShape bar, RectangleEdge base) { Paint itemPaint = renderer.getItemPaint(row, column, selected); GradientPaintTransformer t = renderer.getGradientPaintTransformer(); if (t != null && itemPaint instanceof GradientPaint) { itemPaint = t.transform((GradientPaint) itemPaint, bar); } g2.setPaint(itemPaint); g2.fill(bar); // draw the outline... if (renderer.isDrawBarOutline()) { // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) { Stroke stroke = renderer.getItemOutlineStroke(row, column, selected); Paint paint = renderer.getItemOutlinePaint(row, column, selected); if (stroke != null && paint != null) { g2.setStroke(stroke); g2.setPaint(paint); g2.draw(bar); } } }
Example #5
Source File: BarRenderer.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Draws the bar for a single (series, category) data item. * * @param g2 the graphics device. * @param state the renderer state. * @param dataArea the data area. * @param plot the plot. * @param domainAxis the domain axis. * @param rangeAxis the range axis. * @param dataset the dataset. * @param row the row index (zero-based). * @param column the column index (zero-based). * @param pass the pass index. */ public void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass) { // nothing is drawn for null values... Number dataValue = dataset.getValue(row, column); if (dataValue == null) { return; } double value = dataValue.doubleValue(); PlotOrientation orientation = plot.getOrientation(); double barW0 = calculateBarW0(plot, orientation, dataArea, domainAxis, state, row, column); double[] barL0L1 = calculateBarL0L1(value); if (barL0L1 == null) { return; // the bar is not visible } RectangleEdge edge = plot.getRangeAxisEdge(); double transL0 = rangeAxis.valueToJava2D(barL0L1[0], dataArea, edge); double transL1 = rangeAxis.valueToJava2D(barL0L1[1], dataArea, edge); double barL0 = Math.min(transL0, transL1); double barLength = Math.max(Math.abs(transL1 - transL0), getMinimumBarLength()); // draw the bar... Rectangle2D bar = null; if (orientation == PlotOrientation.HORIZONTAL) { bar = new Rectangle2D.Double(barL0, barW0, barLength, state.getBarWidth()); } else { bar = new Rectangle2D.Double(barW0, barL0, state.getBarWidth(), barLength); } Paint itemPaint = getItemPaint(row, column); GradientPaintTransformer t = getGradientPaintTransformer(); if (t != null && itemPaint instanceof GradientPaint) { itemPaint = t.transform((GradientPaint) itemPaint, bar); } g2.setPaint(itemPaint); g2.fill(bar); // draw the outline... if (isDrawBarOutline() && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) { Stroke stroke = getItemOutlineStroke(row, column); Paint paint = getItemOutlinePaint(row, column); if (stroke != null && paint != null) { g2.setStroke(stroke); g2.setPaint(paint); g2.draw(bar); } } CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column); if (generator != null && isItemLabelVisible(row, column)) { drawItemLabel(g2, dataset, row, column, plot, generator, bar, (value < 0.0)); } // add an item entity, if this information is being collected EntityCollection entities = state.getEntityCollection(); if (entities != null) { addItemEntity(entities, dataset, row, column, bar); } }
Example #6
Source File: LegendGraphic.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @param transformer the transformer (<code>null</code> not permitted). * * @since 1.0.4 * * @see #getFillPaintTransformer() */ public void setFillPaintTransformer(GradientPaintTransformer transformer) { if (transformer == null) { throw new IllegalArgumentException("Null 'transformer' argument."); } this.fillPaintTransformer = transformer; }
Example #7
Source File: LegendItem.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @param transformer the transformer (<code>null</code> not permitted). * * @since 1.0.4 * * @see #getFillPaintTransformer() */ public void setFillPaintTransformer(GradientPaintTransformer transformer) { if (transformer == null) { throw new IllegalArgumentException("Null 'transformer' attribute."); } this.fillPaintTransformer = transformer; }
Example #8
Source File: DialBackground.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the transformer used to adjust the coordinates of any * <code>GradientPaint</code> instance used for the background paint, and * sends a {@link DialLayerChangeEvent} to all registered listeners. * * @param t the transformer (<code>null</code> not permitted). * * @see #getGradientPaintTransformer() */ public void setGradientPaintTransformer(GradientPaintTransformer t) { if (t == null) { throw new IllegalArgumentException("Null 't' argument."); } this.gradientPaintTransformer = t; notifyListeners(new DialLayerChangeEvent(this)); }
Example #9
Source File: LegendGraphic.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @param transformer the transformer (<code>null</code> not permitted). * * @since 1.0.4 * * @see #getFillPaintTransformer() */ public void setFillPaintTransformer(GradientPaintTransformer transformer) { if (transformer == null) { throw new IllegalArgumentException("Null 'transformer' argument."); } this.fillPaintTransformer = transformer; }
Example #10
Source File: LegendItem.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @param transformer the transformer (<code>null</code> not permitted). * * @since 1.0.4 * * @see #getFillPaintTransformer() */ public void setFillPaintTransformer(GradientPaintTransformer transformer) { if (transformer == null) { throw new IllegalArgumentException("Null 'transformer' attribute."); } this.fillPaintTransformer = transformer; }
Example #11
Source File: DialBackground.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the transformer used to adjust the coordinates of any * <code>GradientPaint</code> instance used for the background paint, and * sends a {@link DialLayerChangeEvent} to all registered listeners. * * @param t the transformer (<code>null</code> not permitted). * * @see #getGradientPaintTransformer() */ public void setGradientPaintTransformer(GradientPaintTransformer t) { if (t == null) { throw new IllegalArgumentException("Null 't' argument."); } this.gradientPaintTransformer = t; notifyListeners(new DialLayerChangeEvent(this)); }
Example #12
Source File: XYAreaRenderer.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Sets the gradient paint transformer and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param transformer the transformer (<code>null</code> not permitted). * * @since 1.0.14 */ public void setGradientTransformer(GradientPaintTransformer transformer) { if (transformer == null) { throw new IllegalArgumentException("Null 'transformer' argument."); } this.gradientTransformer = transformer; fireChangeEvent(); }
Example #13
Source File: XYAreaRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the gradient paint transformer. * * @return The gradient paint transformer (never <code>null</code>). * * @since 1.0.14 */ public GradientPaintTransformer getGradientTransformer() { return this.gradientTransformer; }
Example #14
Source File: LegendGraphic.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @return The transformer (never <code>null</code>). * * @since 1.0.4. * * @see #setFillPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getFillPaintTransformer() { return this.fillPaintTransformer; }
Example #15
Source File: LegendItem.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @return The transformer (never <code>null</code>). * * @since 1.0.4 * * @see #setFillPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getFillPaintTransformer() { return this.fillPaintTransformer; }
Example #16
Source File: IntervalMarker.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Sets the gradient paint transformer and sends a * {@link MarkerChangeEvent} to all registered listeners. * * @param transformer the transformer (<code>null</code> permitted). */ public void setGradientPaintTransformer( GradientPaintTransformer transformer) { this.gradientPaintTransformer = transformer; notifyListeners(new MarkerChangeEvent(this)); }
Example #17
Source File: IntervalMarker.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the gradient paint transformer. * * @return The gradient paint transformer (possibly <code>null</code>). */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
Example #18
Source File: XYBarRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the gradient paint transformer (an object used to transform * gradient paint objects to fit each bar). * * @return A transformer (<code>null</code> possible). * * @see #setGradientPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
Example #19
Source File: DialBackground.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the transformer used to adjust the coordinates of any * <code>GradientPaint</code> instance used for the background paint. * * @return The transformer (never <code>null</code>). * * @see #setGradientPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
Example #20
Source File: XYBarRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Sets the gradient paint transformer and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param transformer the transformer (<code>null</code> permitted). * * @see #getGradientPaintTransformer() */ public void setGradientPaintTransformer( GradientPaintTransformer transformer) { this.gradientPaintTransformer = transformer; fireChangeEvent(); }
Example #21
Source File: BarRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Sets the gradient paint transformer and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param transformer the transformer (<code>null</code> permitted). * * @see #getGradientPaintTransformer() */ public void setGradientPaintTransformer( GradientPaintTransformer transformer) { this.gradientPaintTransformer = transformer; notifyListeners(new RendererChangeEvent(this)); }
Example #22
Source File: BarRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the gradient paint transformer (an object used to transform * gradient paint objects to fit each bar). * * @return A transformer (<code>null</code> possible). * * @see #setGradientPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
Example #23
Source File: DialBackground.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the transformer used to adjust the coordinates of any * <code>GradientPaint</code> instance used for the background paint. * * @return The transformer (never <code>null</code>). * * @see #setGradientPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
Example #24
Source File: XYBarRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Sets the gradient paint transformer and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param transformer the transformer (<code>null</code> permitted). * * @see #getGradientPaintTransformer() */ public void setGradientPaintTransformer( GradientPaintTransformer transformer) { this.gradientPaintTransformer = transformer; notifyListeners(new RendererChangeEvent(this)); }
Example #25
Source File: XYBarRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the gradient paint transformer (an object used to transform * gradient paint objects to fit each bar). * * @return A transformer (<code>null</code> possible). * * @see #setGradientPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
Example #26
Source File: LegendGraphic.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @return The transformer (never <code>null</code>). * * @since 1.0.4. * * @see #setFillPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getFillPaintTransformer() { return this.fillPaintTransformer; }
Example #27
Source File: BarRenderer.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the gradient paint transformer (an object used to transform * gradient paint objects to fit each bar). * * @return A transformer (<code>null</code> possible). * * @see #setGradientPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }
Example #28
Source File: LegendItem.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the transformer used when the fill paint is an instance of * <code>GradientPaint</code>. * * @return The transformer (never <code>null</code>). * * @since 1.0.4 * * @see #setFillPaintTransformer(GradientPaintTransformer) */ public GradientPaintTransformer getFillPaintTransformer() { return this.fillPaintTransformer; }
Example #29
Source File: IntervalMarker.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Sets the gradient paint transformer and sends a * {@link MarkerChangeEvent} to all registered listeners. * * @param transformer the transformer (<code>null</code> permitted). */ public void setGradientPaintTransformer( GradientPaintTransformer transformer) { this.gradientPaintTransformer = transformer; notifyListeners(new MarkerChangeEvent(this)); }
Example #30
Source File: IntervalMarker.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Returns the gradient paint transformer. * * @return The gradient paint transformer (possibly <code>null</code>). */ public GradientPaintTransformer getGradientPaintTransformer() { return this.gradientPaintTransformer; }