1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-05 01:50:49 +00:00

Delete replaceTransparentByWhite parameter from ISkinParam.getBackgroundColor()

This commit is contained in:
matthew16550 2021-11-09 00:56:52 +11:00
parent 60fac9cd96
commit 03272b104a
21 changed files with 42 additions and 49 deletions

View File

@ -138,7 +138,7 @@ public class AnnotatedWorker {
}
private HColor getBackgroundColor() {
return getSkinParam().getBackgroundColor(false);
return getSkinParam().getBackgroundColor();
}
private TextBlock addLegend(TextBlock original) {

View File

@ -65,7 +65,7 @@ public interface ISkinParam extends ISkinSimple {
public boolean useUnderlineForHyperlink();
public HColor getBackgroundColor(boolean replaceTransparentByWhite);
public HColor getBackgroundColor();
public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable);
@ -196,4 +196,4 @@ public interface ISkinParam extends ISkinSimple {
public void assumeTransparent(ThemeStyle style);
}
}

View File

@ -283,15 +283,9 @@ public class SkinParam implements ISkinParam {
return result;
}
public HColor getBackgroundColor(boolean replaceTransparentByWhite) {
public HColor getBackgroundColor() {
final HColor result = getHtmlColor(ColorParam.background, null, false);
if (result == null) {
return HColorUtils.WHITE;
}
if (replaceTransparentByWhite && HColorUtils.transparent().equals(result)) {
return HColorUtils.WHITE;
}
return result;
return result != null ? result : HColorUtils.WHITE;
}
public String getValue(String key) {
@ -356,7 +350,7 @@ public class SkinParam implements ISkinParam {
assert param != ColorParam.background;
// final boolean acceptTransparent = param == ColorParam.background
// || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground;
return getIHtmlColorSet().getColorOrWhite(themeStyle, value, getBackgroundColor(false));
return getIHtmlColorSet().getColorOrWhite(themeStyle, value, getBackgroundColor());
}
public char getCircledCharacter(Stereotype stereotype) {

View File

@ -73,11 +73,11 @@ public class SkinParamBackcolored extends SkinParamDelegator {
}
@Override
public HColor getBackgroundColor(boolean replaceTransparentByWhite) {
public HColor getBackgroundColor() {
if (backColorGeneral != null) {
return backColorGeneral;
}
return super.getBackgroundColor(replaceTransparentByWhite);
return super.getBackgroundColor();
}
@Override

View File

@ -75,8 +75,8 @@ public class SkinParamDelegator implements ISkinParam {
}
@Override
public HColor getBackgroundColor(boolean replaceTransparentByWhite) {
return skinParam.getBackgroundColor(replaceTransparentByWhite);
public HColor getBackgroundColor() {
return skinParam.getBackgroundColor();
}
@Override

View File

@ -267,7 +267,7 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return backgroundColor;
}
return this.getSkinParam().getBackgroundColor(false);
return this.getSkinParam().getBackgroundColor();
}
}

View File

@ -119,10 +119,10 @@ public class VCompactFactory implements FtileFactory {
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false);
backgroundColor = skinParam.getBackgroundColor();
} else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
backgroundColor = skinParam.getBackgroundColor(false);
backgroundColor = skinParam.getBackgroundColor();
}
return new FtileCircleStop(skinParam(), backgroundColor, borderColor, swimlane, style);
}
@ -143,10 +143,10 @@ public class VCompactFactory implements FtileFactory {
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false);
backgroundColor = skinParam.getBackgroundColor();
} else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
backgroundColor = skinParam.getBackgroundColor(false);
backgroundColor = skinParam.getBackgroundColor();
}
return new FtileCircleEnd(skinParam(), backgroundColor, borderColor, swimlane, style);
}

View File

@ -135,7 +135,7 @@ public final class EntityFactory {
final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack();
final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false);
folder.setSpecificColorTOBEREMOVED(ColorType.BACK,
c1 == null ? skinParam.getBackgroundColor(false) : c1);
c1 == null ? skinParam.getBackgroundColor() : c1);
} else {
folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors(skinParam).getColor(ColorType.BACK));
}

View File

@ -150,7 +150,7 @@ public class PSystemSalt extends TitledDiagram implements WithSprite {
}
public HColor getBackcolor() {
return getSkinParam().getBackgroundColor(false);
return getSkinParam().getBackgroundColor();
}
};
}

View File

@ -164,7 +164,7 @@ public class SmetanaPath implements UDrawable {
private void printExtremityAtStart(UGraphic ug) {
final ExtremityFactory extremityFactory2 = link.getType().getDecor2()
.getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor(false));
.getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor());
if (extremityFactory2 == null) {
return;
}
@ -188,7 +188,7 @@ public class SmetanaPath implements UDrawable {
private void printExtremityAtEnd(UGraphic ug) {
final ExtremityFactory extremityFactory1 = link.getType().getDecor1()
.getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor(false));
.getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor());
if (extremityFactory1 == null) {
return;
}

View File

@ -85,7 +85,7 @@ public class CommandGrouping extends SingleLineCommand2<SequenceDiagram> {
HColor backColorGeneral = null;
if (s2 != null) {
backColorGeneral = colorSet.getColor(diagram.getSkinParam().getThemeStyle(), s2,
diagram.getSkinParam().getBackgroundColor(false));
diagram.getSkinParam().getBackgroundColor());
}
String comment = arg.get("COMMENT", 0);
final GroupingType groupingType = GroupingType.getType(type);

View File

@ -75,7 +75,7 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent {
this.roundCorner = style.value(PName.RoundCorner).asInt();
if (spriteContainer instanceof SkinParamBackcolored) {
style = style.eventuallyOverride(PName.BackGroundColor,
((SkinParamBackcolored) spriteContainer).getBackgroundColor(false));
((SkinParamBackcolored) spriteContainer).getBackgroundColor());
}
this.groupBorder = style.value(PName.LineColor).asColor(spriteContainer.getThemeStyle(),
getIHtmlColorSet());

View File

@ -286,14 +286,14 @@ public class Rose {
smallFont = smallFont.changeColor(smallColor);
}
return new ComponentRoseGroupingHeader(styles == null ? null : styles[0], styles == null ? null : styles[1],
param.getBackgroundColor(false), getSymbolContext(stereotype, param, ColorParam.sequenceGroupBorder),
param.getBackgroundColor(), getSymbolContext(stereotype, param, ColorParam.sequenceGroupBorder),
bigFont, smallFont, stringsToDisplay, param, roundCorner);
}
if (type == ComponentType.GROUPING_ELSE) {
return new ComponentRoseGroupingElse(styles == null ? null : styles[0],
getHtmlColor(param, stereotype, ColorParam.sequenceGroupBorder),
getUFont2(param, FontParam.SEQUENCE_GROUP), stringsToDisplay.get(0), param,
param.getBackgroundColor(false), roundCorner);
param.getBackgroundColor(), roundCorner);
}
if (type == ComponentType.GROUPING_SPACE) {
return new ComponentRoseGroupingSpace(7);

View File

@ -67,7 +67,7 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I
}
public final HColor getBackcolor() {
return skinParam.getBackgroundColor(false);
return skinParam.getBackgroundColor();
}
protected final Stereotype getStereo() {

View File

@ -946,7 +946,7 @@ public class Cluster implements Moveable {
skinParam.getIHtmlColorSet());
}
if (backColor == null || backColor.equals(HColorUtils.transparent())) {
backColor = new HColorBackground(skinParam.getBackgroundColor(false));
backColor = new HColorBackground(skinParam.getBackgroundColor());
}
return backColor;
}
@ -958,7 +958,7 @@ public class Cluster implements Moveable {
}
if (backColor == null
|| backColor.equals(HColorUtils.transparent()) /* || stateBack instanceof HtmlColorTransparent */) {
final HColor tmp = skinParam.getBackgroundColor(false);
final HColor tmp = skinParam.getBackgroundColor();
backColor = new HColorBackground(tmp);
}
return backColor;

View File

@ -109,7 +109,7 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn
HColor backColor) {
this.separator = Separator.fromChar(concurrentSeparator);
this.skinParam = skinParam;
this.backColor = skinParam.getBackgroundColor(false);
this.backColor = skinParam.getBackgroundColor();
this.inners.addAll(images);
}

View File

@ -139,7 +139,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
}
public HColor getBackcolor() {
return skinParam.getBackgroundColor(false);
return skinParam.getBackgroundColor();
}
public double getOverscanX(StringBounder stringBounder) {

View File

@ -396,12 +396,12 @@ public final class GeneralImageBuilder {
return style.value(PName.BackGroundColor).asColor(dotData.getSkinParam().getThemeStyle(),
dotData.getSkinParam().getIHtmlColorSet());
}
return dotData.getSkinParam().getBackgroundColor(false);
return dotData.getSkinParam().getBackgroundColor();
}
public IEntityImage buildImage(BaseFile basefile, String dotStrings[]) {
if (dotData.isDegeneratedWithFewEntities(0)) {
return new EntityImageSimpleEmpty(dotData.getSkinParam().getBackgroundColor(false));
return new EntityImageSimpleEmpty(dotData.getSkinParam().getBackgroundColor());
}
if (dotData.isDegeneratedWithFewEntities(1) && dotData.getUmlDiagramType() != UmlDiagramType.STATE) {
final ILeaf single = dotData.getLeafs().iterator().next();

View File

@ -229,7 +229,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
skinParam = link.getColors().mute(skinParam);
font = font.mute(link.getColors());
}
this.backgroundColor = skinParam.getBackgroundColor(false);
this.backgroundColor = skinParam.getBackgroundColor();
this.defaultThickness = skinParam.getThickness(LineParam.arrow, null);
this.arrowLollipopColor = skinParam.getHtmlColor(ColorParam.arrowLollipop, null, false);
if (arrowLollipopColor == null) {

View File

@ -147,7 +147,7 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage
return style.value(PName.BackGroundColor).asColor(dotData.getSkinParam().getThemeStyle(),
dotData.getSkinParam().getIHtmlColorSet());
}
return dotData.getSkinParam().getBackgroundColor(false);
return dotData.getSkinParam().getBackgroundColor();
}
private MinMax minMax;

View File

@ -1,5 +1,14 @@
package net.sourceforge.plantuml;
import static org.assertj.core.api.Assertions.assertThat;
import java.awt.Color;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.EnumSource;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
@ -13,15 +22,6 @@ import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.EnumSource;
import java.awt.Color;
import static org.assertj.core.api.Assertions.assertThat;
class SkinParamTest {
//
@ -43,8 +43,7 @@ class SkinParamTest {
assertThat(skinParam.getAllSpriteNames()).isEmpty();
assertThat(skinParam.getBackgroundColor(false)).isEqualTo(HColorUtils.WHITE);
assertThat(skinParam.getBackgroundColor(true)).isEqualTo(HColorUtils.WHITE);
assertThat(skinParam.getBackgroundColor()).isEqualTo(HColorUtils.WHITE);
assertThat(skinParam.getCircledCharacter(fooStereotype)).isEqualTo('\0');