diff options
| author | Keith Wall <kwall@apache.org> | 2012-11-25 22:49:45 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2012-11-25 22:49:45 +0000 |
| commit | 02a2727028d33303618b8ce62ab7f74fee4427d6 (patch) | |
| tree | 84a4505ad6a94596137a815b3db950b9bd76c367 /qpid/java/perftests/visualisation-jfc/src | |
| parent | 5802216f96b7fb64b1752ddc1fc8861b3d8fd982 (diff) | |
| download | qpid-python-02a2727028d33303618b8ce62ab7f74fee4427d6.tar.gz | |
QPID-4338: [Java Performance Charts] Renamed SeriesStokeAndPaintAccessor and modified its api to make its intention more obvious. Also minor code tidy-ups in ColorFactory.
Applied patch from Philip Harvey <phil@philharveyonline.com>
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1413438 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/perftests/visualisation-jfc/src')
| -rw-r--r-- | qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java | 6 | ||||
| -rw-r--r-- | qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java | 10 | ||||
| -rw-r--r-- | qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java | 3 | ||||
| -rw-r--r-- | qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java (renamed from qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStokeAndPaintAccessor.java) | 15 | ||||
| -rw-r--r-- | qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarCharBuilder.java | 10 | ||||
| -rw-r--r-- | qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java | 10 |
6 files changed, 28 insertions, 26 deletions
diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java index 2fe30bb751..700d7fa0ce 100644 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java +++ b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BaseChartBuilder.java @@ -41,14 +41,14 @@ public abstract class BaseChartBuilder implements ChartBuilder setBackgroundColour(chart); } - public void addSeriesAttributes(List<SeriesDefinition> series, SeriesStokeAndPaintAccessor stokeAndPaintAccessor) + protected void addSeriesAttributes(JFreeChart targetChart, List<SeriesDefinition> series, SeriesStrokeAndPaintApplier strokeAndPaintApplier) { for (int i = 0; i < series.size(); i++) { SeriesDefinition seriesDefinition = series.get(i); if (seriesDefinition.getSeriesColourName() != null) { - stokeAndPaintAccessor.setSeriesPaint(i, ColorFactory.toColour(seriesDefinition.getSeriesColourName())); + strokeAndPaintApplier.setSeriesPaint(i, ColorFactory.toColour(seriesDefinition.getSeriesColourName()), targetChart); } if (seriesDefinition.getStrokeWidth() != null) { @@ -56,7 +56,7 @@ public abstract class BaseChartBuilder implements ChartBuilder boolean dashed = seriesDefinition.getStrokeWidth() < 0; float width = Math.abs(seriesDefinition.getStrokeWidth()); BasicStroke stroke = buildStrokeOfWidth(width, dashed); - stokeAndPaintAccessor.setSeriesStroke(i, stroke); + strokeAndPaintApplier.setSeriesStroke(i, stroke, targetChart); } } } diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java index cd56b0c967..ba027d9d93 100644 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java +++ b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/CategoryDataSetBasedChartBuilder.java @@ -81,18 +81,18 @@ public abstract class CategoryDataSetBasedChartBuilder extends BaseChartBuilder chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); addCommonChartAttributes(chart, chartingDefinition); - addSeriesAttributes(chartingDefinition.getSeries(), new SeriesStokeAndPaintAccessor() + addSeriesAttributes(chart, chartingDefinition.getSeries(), new SeriesStrokeAndPaintApplier() { @Override - public void setSeriesStroke(int seriesIndex, Stroke stroke) + public void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart) { - chart.getCategoryPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); + targetChart.getCategoryPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); } @Override - public void setSeriesPaint(int seriesIndex, Color colour) + public void setSeriesPaint(int seriesIndex, Color colour, JFreeChart targetChart) { - chart.getCategoryPlot().getRenderer().setSeriesPaint(seriesIndex, colour); + targetChart.getCategoryPlot().getRenderer().setSeriesPaint(seriesIndex, colour); } }); diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java index 942d42ad73..49d777c506 100644 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java +++ b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ColorFactory.java @@ -23,7 +23,6 @@ import java.awt.Color; public class ColorFactory { - /** * Converts a colour name known to the JDK into a {@link Color} instance. Additionally, * if the work dark_ is prepended to the colour, a darker shade of the same colour is @@ -52,7 +51,7 @@ public class ColorFactory } } - protected static Color getColourFromStaticField(String colourName) + private static Color getColourFromStaticField(String colourName) { try { diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStokeAndPaintAccessor.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java index 75c3f9d3f2..4d6c37a9f4 100644 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStokeAndPaintAccessor.java +++ b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/SeriesStrokeAndPaintApplier.java @@ -22,11 +22,14 @@ package org.apache.qpid.disttest.charting.chartbuilder; import java.awt.Color; import java.awt.Stroke; -public interface SeriesStokeAndPaintAccessor -{ - - void setSeriesStroke(int i, Stroke stroke); - - void setSeriesPaint(int i, Color blue); +import org.jfree.chart.JFreeChart; +/** + * Applies the supplied stroke and color to a series in the target chart. + * Multiple implementations exist to because of the various chart types. + */ +public interface SeriesStrokeAndPaintApplier +{ + void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart); + void setSeriesPaint(int seriesIndex, Color color, JFreeChart targetChart); } diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarCharBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarCharBuilder.java index 40a8b31b87..1669ee1bb2 100644 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarCharBuilder.java +++ b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/StatisticalBarCharBuilder.java @@ -92,18 +92,18 @@ public class StatisticalBarCharBuilder extends BaseChartBuilder chart.getCategoryPlot().getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); addCommonChartAttributes(chart, chartingDefinition); - addSeriesAttributes(chartingDefinition.getSeries(), new SeriesStokeAndPaintAccessor() + addSeriesAttributes(chart, chartingDefinition.getSeries(), new SeriesStrokeAndPaintApplier() { @Override - public void setSeriesStroke(int seriesIndex, Stroke stroke) + public void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart) { - chart.getCategoryPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); + targetChart.getCategoryPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); } @Override - public void setSeriesPaint(int seriesIndex, Color colour) + public void setSeriesPaint(int seriesIndex, Color colour, JFreeChart targetChart) { - chart.getCategoryPlot().getRenderer().setSeriesPaint(seriesIndex, colour); + targetChart.getCategoryPlot().getRenderer().setSeriesPaint(seriesIndex, colour); } }); diff --git a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java index 2af8395516..168794be50 100644 --- a/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java +++ b/qpid/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/XYDataSetBasedChartBuilder.java @@ -98,18 +98,18 @@ public abstract class XYDataSetBasedChartBuilder extends BaseChartBuilder dataset, PLOT_ORIENTATION, SHOW_LEGEND, SHOW_TOOL_TIPS, SHOW_URLS); addCommonChartAttributes(chart, chartingDefinition); - addSeriesAttributes(chartingDefinition.getSeries(), new SeriesStokeAndPaintAccessor() + addSeriesAttributes(chart, chartingDefinition.getSeries(), new SeriesStrokeAndPaintApplier() { @Override - public void setSeriesStroke(int seriesIndex, Stroke stroke) + public void setSeriesStroke(int seriesIndex, Stroke stroke, JFreeChart targetChart) { - chart.getXYPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); + targetChart.getXYPlot().getRenderer().setSeriesStroke(seriesIndex, stroke); } @Override - public void setSeriesPaint(int seriesIndex, Color colour) + public void setSeriesPaint(int seriesIndex, Color colour, JFreeChart targetChart) { - chart.getXYPlot().getRenderer().setSeriesPaint(seriesIndex, colour); + targetChart.getXYPlot().getRenderer().setSeriesPaint(seriesIndex, colour); } }); |
