Skip to content

Commit

Permalink
#6093 improve more java plotting APIs. (#6253)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalgce authored and scottdraves committed Nov 7, 2017
1 parent d30c0b0 commit 6e4cdb9
Show file tree
Hide file tree
Showing 15 changed files with 187 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,12 @@ public class CategoryArea extends CategoryGraphics {

private LabelPositionType labelPosition = LabelPositionType.CENTER;

public void setBase(Object base) {
if (base instanceof Number) {
this.baseBase = ((Number) base).floatValue();
} else if (base instanceof List) {
@SuppressWarnings("unchecked")
List<Number> ss = (List<Number>) base;
setBases(ss);
} else {
throw new IllegalArgumentException(
"setBase takes Number or List of Number");
}
public void setBase(Number base) {
this.baseBase = base.floatValue();
}

public void setBase(List<Number> base) {
setBases(base);
}

private void setBases(List<Number> bases) {
Expand All @@ -61,18 +56,12 @@ public List<Number> getBases() {
return this.bases;
}

public void setWidth(Number width) {
this.baseWidth = width.floatValue();
}

public void setWidth(Object width) {
if (width instanceof Number) {
this.baseWidth = ((Number) width).floatValue();
} else if (width instanceof List) {
@SuppressWarnings("unchecked")
List<Number> ws = (List<Number>) width;
setWidths(ws);
} else {
throw new IllegalArgumentException(
"setWidth takes Number or List of Number");
}
public void setWidth(List<Number> width) {
setWidths(width);
}

private void setWidths(List<Number> widths) {
Expand All @@ -87,20 +76,16 @@ public List<Number> getWidths() {
return this.widths;
}

public void setOutlineColor(Color color) {
this.baseOutlineColor = color;
}

public void setOutlineColor(Object color) {
if (color instanceof Color) {
this.baseOutlineColor = (Color) color;
} else if (color instanceof java.awt.Color) {
this.baseOutlineColor = new Color((java.awt.Color) color);
} else if (color instanceof List) {
@SuppressWarnings("unchecked")
List<Object> cs = (List<Object>) color;
setOutlineColors(cs);
} else {
throw new IllegalArgumentException(
"setOutlineColor takes Color or List of Color");
}
public void setOutlineColor(java.awt.Color color) {
this.baseOutlineColor = new Color(color);
}

public void setOutlineColor(List<Object> colors) {
setOutlineColors(colors);
}

private void setOutlineColors(List<Object> colors) {
Expand All @@ -120,17 +105,12 @@ public List<Object> getOutlineColors() {
return this.outlineColors;
}

public void setFill(Object fill) {
if (fill instanceof Boolean) {
this.baseFill = (Boolean) fill;
} else if (fill instanceof List) {
@SuppressWarnings("unchecked")
List<Boolean> fs = (List<Boolean>) fill;
setFills(fs);
} else {
throw new IllegalArgumentException(
"setFill takes boolean or List of boolean");
}
public void setFill(Boolean fill) {
this.baseFill = fill;
}

public void setFill(List<Boolean> fill) {
setFills(fill);
}

private void setFills(List<Boolean> fills) {
Expand All @@ -145,17 +125,12 @@ public List<Boolean> getFills() {
return this.fills;
}

public void setDrawOutline(Object outline) {
if (outline instanceof Boolean) {
this.baseOutline = (Boolean) outline;
} else if (outline instanceof List) {
@SuppressWarnings("unchecked")
List<Boolean> fs = (List<Boolean>) outline;
this.outlines = fs;
} else {
throw new IllegalArgumentException(
"drawOutline takes boolean or List of boolean");
}
public void setDrawOutline(Boolean outline) {
this.baseOutline = outline;
}

public void setDrawOutline(List<Boolean> outline) {
this.outlines = outline;
}

public List<Boolean> getDrawOutlines() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,12 @@ public class CategoryBars extends CategoryGraphics {

private LabelPositionType labelPosition = LabelPositionType.CENTER;

public void setBase(Object base) {
if (base instanceof Number) {
this.baseBase = ((Number) base).floatValue();
} else if (base instanceof List) {
@SuppressWarnings("unchecked")
List<Number> ss = (List<Number>) base;
setBases(ss);
} else {
throw new IllegalArgumentException(
"setBase takes Number or List of Number");
}
public void setBase(Number base) {
this.baseBase = base.floatValue();
}

public void setBase(List<Number> base) {
setBases(base);
}

private void setBases(List<Number> bases) {
Expand All @@ -62,18 +57,12 @@ public List<Number> getBases() {
return this.bases;
}

public void setWidth(Number width) {
this.baseWidth = width.floatValue();
}

public void setWidth(Object width) {
if (width instanceof Number) {
this.baseWidth = ((Number) width).floatValue();
} else if (width instanceof List) {
@SuppressWarnings("unchecked")
List<Number> ws = (List<Number>) width;
setWidths(ws);
} else {
throw new IllegalArgumentException(
"setWidth takes Number or List of Number");
}
public void setWidth(List<Number> width) {
setWidths(width);
}

private void setWidths(List<Number> widths) {
Expand All @@ -88,22 +77,6 @@ public List<Number> getWidths() {
return this.widths;
}


public void setOutlineColor(Object color) {
if (color instanceof Color) {
this.baseOutlineColor = (Color) color;
} else if (color instanceof java.awt.Color) {
this.baseOutlineColor = new Color((java.awt.Color) color);
} else if (color instanceof List) {
@SuppressWarnings("unchecked")
List<Object> cs = (List<Object>) color;
setOutlineColors(cs);
} else {
throw new IllegalArgumentException(
"setOutlineColor takes Color or List of Color");
}
}

private void setOutlineColors(List<Object> colors) {
if (colors != null) {
this.outlineColors = ChartUtils.convertColors(colors, "setOutlineColor takes Color or List of Color");
Expand All @@ -120,17 +93,12 @@ public List<Object> getOutlineColors() {
return this.outlineColors;
}

public void setFill(Object fill) {
if (fill instanceof Boolean) {
this.baseFill = (Boolean) fill;
} else if (fill instanceof List) {
@SuppressWarnings("unchecked")
List<Boolean> fs = (List<Boolean>) fill;
setFills(fs);
} else {
throw new IllegalArgumentException(
"setFill takes boolean or List of boolean");
}
public void setFill(Boolean fill) {
this.baseFill = fill;
}

public void setFill(List<Boolean> fill) {
setFills(fill);
}

private void setFills(List<Boolean> fills) {
Expand All @@ -145,17 +113,24 @@ public List<Boolean> getFills() {
return this.fills;
}

public void setDrawOutline(Object outline) {
if (outline instanceof Boolean) {
this.baseOutline = (Boolean) outline;
} else if (outline instanceof List) {
@SuppressWarnings("unchecked")
List<Boolean> fs = (List<Boolean>) outline;
this.outlines = fs;
} else {
throw new IllegalArgumentException(
"drawOutline takes boolean or List of boolean");
}
public void setOutlineColor(Color color) {
this.baseOutlineColor = color;
}

public void setOutlineColor(java.awt.Color color) {
this.baseOutlineColor = new Color(color);
}

public void setOutlineColor(List<Object> colors) {
setOutlineColors(colors);
}

public void setDrawOutline(Boolean outline) {
this.baseOutline = outline;
}

public void setDrawOutline(List<Boolean> outline) {
this.outlines = outline;
}

public List<Boolean> getDrawOutlines() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,12 @@ public Float getWidth() {
return this.width;
}

public void setStyle(Object style) {
if (style instanceof StrokeType) {
this.baseStyle = (StrokeType) style;
} else if (style instanceof List) {
@SuppressWarnings("unchecked")
List<StrokeType> ss = (List<StrokeType>) style;
setStyles(ss);
} else {
throw new IllegalArgumentException(
"setStyle takes StrokeType or List of StrokeType");
}
public void setStyle(StrokeType style) {
this.baseStyle = style;
}

public void setStyle(List<StrokeType> styles) {
setStyles(styles);
}

private void setStyles(List<StrokeType> styles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ public class CategoryPoints extends CategoryGraphics {
private Color baseOutlineColor;
private List<Object> outlineColors;

public void setSize(Object size) {
if (size instanceof Number) {
this.baseSize = ((Number) size).floatValue();
} else if (size instanceof List) {
@SuppressWarnings("unchecked")
List<Number> ss = (List<Number>) size;
setSizes(ss);
} else {
throw new IllegalArgumentException(
"setSize takes Number or List of Number");
}
public void setSize(Number size) {
this.baseSize = size.floatValue();
}

public void setSize(List<Number> sizes) {
setSizes(sizes);
}

private void setSizes(List<Number> sizes) {
Expand All @@ -59,17 +54,12 @@ public List<Number> getSizes() {
return this.sizes;
}

public void setShape(Object shape) {
if (shape instanceof ShapeType) {
this.baseShape = (ShapeType) shape;
} else if (shape instanceof List) {
@SuppressWarnings("unchecked")
List<ShapeType> ss = (List<ShapeType>) shape;
setShapes(ss);
} else {
throw new IllegalArgumentException(
"setShape takes ShapeType or List of ShapeType");
}
public void setShape(ShapeType shape) {
this.baseShape = shape;
}

public void setShape(List<ShapeType> shapes) {
setShapes(shapes);
}

private void setShapes(List<ShapeType> shapes) {
Expand All @@ -84,17 +74,12 @@ public List<ShapeType> getShapes() {
return this.shapes;
}

public void setFill(Object fill) {
if (fill instanceof Boolean) {
this.baseFill = (Boolean) fill;
} else if (fill instanceof List) {
@SuppressWarnings("unchecked")
List<Boolean> fs = (List<Boolean>) fill;
setFills(fs);
} else {
throw new IllegalArgumentException(
"setFill takes boolean or List of boolean");
}
public void setFill(Boolean fill) {
this.baseFill = fill;
}

public void setFill(List<Boolean> fill) {
setFills(fill);
}

private void setFills(List<Boolean> fills) {
Expand All @@ -109,19 +94,16 @@ public List<Boolean> getFills() {
return this.fills;
}

public void setOutlineColor(Object color) {
if (color instanceof Color) {
this.baseOutlineColor = (Color) color;
} else if (color instanceof java.awt.Color) {
this.baseOutlineColor = new Color((java.awt.Color) color);
} else if (color instanceof List) {
@SuppressWarnings("unchecked")
List<Object> cs = (List<Object>) color;
setOutlineColors(cs);
} else {
throw new IllegalArgumentException(
"setOutlineColor takes Color or List of Color");
}
public void setOutlineColor(Color color) {
this.baseOutlineColor = color;
}

public void setOutlineColor(java.awt.Color color) {
this.baseOutlineColor = new Color(color);
}

public void setOutlineColor(List<Object> colors) {
setOutlineColors(colors);
}

private void setOutlineColors(List<Object> colors) {
Expand Down
Loading

0 comments on commit 6e4cdb9

Please sign in to comment.