Skip to content

Commit

Permalink
Clean up code in StandardChartTheme (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfree committed May 16, 2021
1 parent 6b95fb6 commit e2d6118
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
38 changes: 13 additions & 25 deletions src/main/java/org/jfree/chart/StandardChartTheme.java
Expand Up @@ -2,7 +2,7 @@
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2020, by Object Refinery Limited and Contributors.
* (C) Copyright 2000-2021, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
Expand All @@ -27,7 +27,7 @@
* -----------------------
* StandardChartTheme.java
* -----------------------
* (C) Copyright 2008-2020, by Object Refinery Limited.
* (C) Copyright 2008-2021, by Object Refinery Limited.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): -;
Expand Down Expand Up @@ -1293,54 +1293,42 @@ protected void applyToXYPlot(XYPlot plot) {
plot.setShadowGenerator(this.shadowGenerator);

// process all domain axes
int domainAxisCount = plot.getDomainAxisCount();
for (int i = 0; i < domainAxisCount; i++) {
ValueAxis axis = plot.getDomainAxis(i);
if (axis != null) {
applyToValueAxis(axis);
for (ValueAxis xAxis : plot.getDomainAxes().values()) {
if (xAxis != null) {
applyToValueAxis(xAxis);
}
}

// process all range axes
int rangeAxisCount = plot.getRangeAxisCount();
for (int i = 0; i < rangeAxisCount; i++) {
ValueAxis axis = plot.getRangeAxis(i);
if (axis != null) {
applyToValueAxis(axis);
for (ValueAxis yAxis : plot.getRangeAxes().values()) {
if (yAxis != null) {
applyToValueAxis(yAxis);
}
}

// process all renderers
int rendererCount = plot.getRendererCount();
for (int i = 0; i < rendererCount; i++) {
XYItemRenderer r = plot.getRenderer(i);
for (XYItemRenderer r : plot.getRenderers().values()) {
if (r != null) {
applyToXYItemRenderer(r);
}
}

// process all annotations
Iterator iter = plot.getAnnotations().iterator();
while (iter.hasNext()) {
XYAnnotation a = (XYAnnotation) iter.next();
for (XYAnnotation a : plot.getAnnotations()) {
applyToXYAnnotation(a);
}

if (plot instanceof CombinedDomainXYPlot) {
CombinedDomainXYPlot cp = (CombinedDomainXYPlot) plot;
Iterator iterator = cp.getSubplots().iterator();
while (iterator.hasNext()) {
XYPlot subplot = (XYPlot) iterator.next();
for (XYPlot subplot : cp.getSubplots()) {
if (subplot != null) {
applyToPlot(subplot);
}
}
}
}
if (plot instanceof CombinedRangeXYPlot) {
CombinedRangeXYPlot cp = (CombinedRangeXYPlot) plot;
Iterator iterator = cp.getSubplots().iterator();
while (iterator.hasNext()) {
XYPlot subplot = (XYPlot) iterator.next();
for (XYPlot subplot : cp.getSubplots()) {
if (subplot != null) {
applyToPlot(subplot);
}
Expand Down
Expand Up @@ -308,7 +308,7 @@ public void remove(XYPlot subplot) {
*
* @return An unmodifiable list of subplots.
*/
public List getSubplots() {
public List<XYPlot> getSubplots() {
return Collections.unmodifiableList(this.subplots);
}

Expand Down
Expand Up @@ -237,7 +237,7 @@ public void remove(XYPlot subplot) {
*
* @return An unmodifiable list of subplots.
*/
public List getSubplots() {
public List<XYPlot> getSubplots() {
if (this.subplots != null) {
return Collections.unmodifiableList(this.subplots);
}
Expand Down
Expand Up @@ -778,8 +778,7 @@ public LegendItem getLegendItem(int datasetIndex, int series) {
item.setLine(shape);
item.setLinePaint(paint);
item.setShapeVisible(false);
}
else {
} else {
Paint outlinePaint = lookupSeriesOutlinePaint(series);
Stroke outlineStroke = lookupSeriesOutlineStroke(series);
item.setOutlinePaint(outlinePaint);
Expand Down

0 comments on commit e2d6118

Please sign in to comment.