Commit 5f75cf08 authored by Nico Mack's avatar Nico Mack

Changes to which colours are mandatory and which are optional

parent 723c098e
......@@ -50,7 +50,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
private ColorPair labelColour;
private ColorPair textColour;
private ColorPair leaderColour;
private ColorPair faceColour;
private ColorPair bezelColour;
......@@ -241,22 +240,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
// ---------------------------------------------------------------------------
private void switchColours(boolean isNegative) {
if (relative) {
fillColour.setSwitched(isNegative);
strokeColour.setSwitched(isNegative);
labelColour.setSwitched(isNegative);
if (textColour != null)
textColour.setSwitched(isNegative);
if (faceColour != null)
faceColour.setSwitched(isNegative);
if (bezelColour != null)
bezelColour.setSwitched(isNegative);
}
}
// ---------------------------------------------------------------------------
private void updateLeader() {
float lowerLeaderAngle = (float) -Math.toRadians(lowerAngle);
......@@ -352,8 +335,15 @@ public class ArcRangeGraph extends ValueRangeCorona {
if (!relative) {
fillColour.setSwitched(selectIt);
strokeColour.setSwitched(selectIt);
labelColour.setSwitched(selectIt);
textColour.setSwitched(selectIt);
// Optional colours may be null
if (labelColour != null)
labelColour.setSwitched(selectIt);
if (textColour != null)
textColour.setSwitched(selectIt);
if (leaderColour != null)
leaderColour.setSwitched(selectIt);
if (faceColour != null)
faceColour.setSwitched(selectIt);
if (bezelColour != null)
......@@ -436,14 +426,18 @@ public class ArcRangeGraph extends ValueRangeCorona {
if (leaderColour != null) {
if (this.lowerLeader != null) {
this.lowerLeader.setStrokeColour(leaderColour.getColor());
this.lowerLeader.setFillColour(labelColour.getColor());
this.lowerLeader.setLabelColour(textColour.getColor());
if (labelColour != null)
this.lowerLeader.setFillColour(labelColour.getColor());
if (textColour != null)
this.lowerLeader.setLabelColour(textColour.getColor());
this.lowerLeader.paint(localCanvas);
}
if (this.upperLeader != null) {
this.upperLeader.setStrokeColour(leaderColour.getColor());
this.upperLeader.setFillColour(labelColour.getColor());
this.upperLeader.setLabelColour(textColour.getColor());
if (labelColour != null)
this.upperLeader.setFillColour(labelColour.getColor());
if (textColour != null)
this.upperLeader.setLabelColour(textColour.getColor());
this.upperLeader.paint(localCanvas);
}
}
......
......@@ -110,10 +110,10 @@ public abstract class BaseArcRangeGraphBuilder<B extends BaseArcRangeGraphBuilde
rampingTime = BootstrappingUtils.getContentAsInteger(rootElement, Externalization.RAMPING_TIME_NODE, BootstrappingUtils.OPTIONAL, 500, context);
fillColour = buildColorPair(rootElement.getChild(Externalization.FILL_COLOUR_ELEMENT), BootstrappingUtils.MANDATORY, context);
textColour = buildColorPair(rootElement.getChild(Externalization.TEXT_COLOUR_ELEMENT), BootstrappingUtils.OPTIONAL, null);
textColour = buildColorPair(rootElement.getChild(Externalization.TEXT_COLOUR_ELEMENT), BootstrappingUtils.OPTIONAL, context);
strokeColour = buildColorPair(rootElement.getChild(Externalization.STROKE_COLOUR_ELEMENT), BootstrappingUtils.MANDATORY, context);
labelColour = buildColorPair(rootElement.getChild(Externalization.LABEL_COLOUR_ELEMENT), BootstrappingUtils.MANDATORY, context);
leaderColour = buildColorPair(rootElement.getChild(Externalization.LEADER_COLOUR_NODE), BootstrappingUtils.OPTIONAL, null);
labelColour = buildColorPair(rootElement.getChild(Externalization.LABEL_COLOUR_ELEMENT), BootstrappingUtils.OPTIONAL, context);
leaderColour = buildColorPair(rootElement.getChild(Externalization.LEADER_COLOUR_NODE), BootstrappingUtils.OPTIONAL, context);
faceColour = buildColorPair(rootElement.getChild(Externalization.FACE_COLOUR_ELEMENT), BootstrappingUtils.OPTIONAL, context);
bezelColour = buildColorPair(rootElement.getChild(Externalization.BEZEL_COLOUR_ELEMENT), BootstrappingUtils.OPTIONAL, context);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment