1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 04:55:10 +00:00

Improve style support for nwdiag

This commit is contained in:
Arnaud Roques 2021-09-15 23:03:09 +02:00
parent e1fe53457a
commit b3bf75e0b7
17 changed files with 141 additions and 57 deletions

View File

@ -357,3 +357,16 @@ timingDiagram {
} }
} }
nwdiagDiagram {
network {
FontSize 12
Shadowing 1.0
}
server {
FontSize 12
}
group {
FontSize 12
BackGroundColor #ddd
}
}

View File

@ -122,6 +122,9 @@ public class SkinParam implements ISkinParam {
if (type == UmlDiagramType.YAML) { if (type == UmlDiagramType.YAML) {
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
} }
if (type == UmlDiagramType.NWDIAG) {
UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.SEQUENCE) { if (type == UmlDiagramType.SEQUENCE) {
// skin = "debug.skin"; // skin = "debug.skin";
// USE_STYLE2.set(true); // USE_STYLE2.set(true);

View File

@ -71,8 +71,13 @@ import net.sourceforge.plantuml.nwdiag.next.LinkedElement;
import net.sourceforge.plantuml.nwdiag.next.NBar; import net.sourceforge.plantuml.nwdiag.next.NBar;
import net.sourceforge.plantuml.nwdiag.next.NPlayField; import net.sourceforge.plantuml.nwdiag.next.NPlayField;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UBackground;
import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -260,19 +265,22 @@ public class NwDiagram extends UmlDiagram {
}; };
} }
private StyleSignature getStyleDefinitionNetwork() {
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.network);
}
private TextBlock toTextBlock(String name, String s) { private TextBlock toTextBlock(String name, String s) {
if (s != null) { if (s != null) {
name += "\\n" + s; name += "\\n" + s;
} }
return Display.getWithNewlines(name).create(getFontConfiguration(), HorizontalAlignment.RIGHT, final StyleBuilder styleBuilder = getSkinParam().getCurrentStyleBuilder();
final Style style = getStyleDefinitionNetwork().getMergedStyle(styleBuilder);
final FontConfiguration fontConfiguration = style.getFontConfiguration(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet());
return Display.getWithNewlines(name).create(fontConfiguration, HorizontalAlignment.RIGHT,
new SpriteContainerEmpty()); new SpriteContainerEmpty());
} }
private FontConfiguration getFontConfiguration() {
final UFont font = UFont.serif(11);
return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false);
}
private Dimension2D getTotalDimension(StringBounder stringBounder) { private Dimension2D getTotalDimension(StringBounder stringBounder) {
return TextBlockUtils.getMinMax(new UDrawable() { return TextBlockUtils.getMinMax(new UDrawable() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
@ -315,8 +323,7 @@ public class NwDiagram extends UmlDiagram {
} }
deltaX += 5; deltaX += 5;
grid.drawU(ug.apply(ColorParam.activityBorder.getDefaultValue()) grid.drawU(ug.apply(new UTranslate(deltaX, deltaY)));
.apply(ColorParam.activityBackground.getDefaultValue().bg()).apply(new UTranslate(deltaX, deltaY)));
final Dimension2D dimGrid = grid.calculateDimension(stringBounder); final Dimension2D dimGrid = grid.calculateDimension(stringBounder);
ug.apply(new UTranslate(dimGrid.getWidth() + deltaX + margin, dimGrid.getHeight() + deltaY + margin)) ug.apply(new UTranslate(dimGrid.getWidth() + deltaX + margin, dimGrid.getHeight() + deltaY + margin))
@ -383,7 +390,7 @@ public class NwDiagram extends UmlDiagram {
} }
if ("color".equalsIgnoreCase(property)) { if ("color".equalsIgnoreCase(property)) {
final HColor color = value == null ? null final HColor color = value == null ? null
: NwGroup.colors.getColorOrWhite(getSkinParam().getThemeStyle(), value); : getSkinParam().getIHtmlColorSet().getColorOrWhite(getSkinParam().getThemeStyle(), value);
if (currentGroup != null) { if (currentGroup != null) {
currentGroup.setColor(color); currentGroup.setColor(color);
} else if (currentNetwork() != null) { } else if (currentNetwork() != null) {

View File

@ -42,7 +42,6 @@ import java.util.Map.Entry;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ComponentStyle; import net.sourceforge.plantuml.ComponentStyle;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -50,7 +49,6 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.mindmap.IdeaShape;
import net.sourceforge.plantuml.nwdiag.next.LinkedElement; import net.sourceforge.plantuml.nwdiag.next.LinkedElement;
import net.sourceforge.plantuml.nwdiag.next.NBar; import net.sourceforge.plantuml.nwdiag.next.NBar;
import net.sourceforge.plantuml.skin.ActorStyle; import net.sourceforge.plantuml.skin.ActorStyle;
@ -90,7 +88,7 @@ public class NServer {
return connections.get(network); return connections.get(network);
} }
protected final TextBlock toTextBlock(String s, ISkinSimple spriteContainer) { private TextBlock toTextBlock(String s, ISkinParam skinParam) {
if (s == null) { if (s == null) {
return null; return null;
} }
@ -98,29 +96,31 @@ public class NServer {
return TextBlockUtils.empty(0, 0); return TextBlockUtils.empty(0, 0);
} }
s = s.replace(", ", "\\n"); s = s.replace(", ", "\\n");
return Display.getWithNewlines(s).create(getFontConfiguration(), HorizontalAlignment.LEFT, spriteContainer); return Display.getWithNewlines(s).create(getFontConfiguration(skinParam), HorizontalAlignment.LEFT, skinParam);
} }
private StyleSignature getStyleDefinition() { private StyleSignature getStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.node); return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.server);
}
private FontConfiguration getFontConfiguration(ISkinParam skinParam) {
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
return style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} }
public LinkedElement asTextBlock(double topMargin, Map<Network, String> conns, List<Network> networks, public LinkedElement asTextBlock(double topMargin, Map<Network, String> conns, List<Network> networks,
ISkinParam skinParam) { ISkinParam skinParam) {
double deltaShadow = 3;
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder(); final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
if (styleBuilder != null) { final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
final Style style = getStyleDefinition().getMergedStyle(styleBuilder); final SymbolContext symbolContext = style.getSymbolContext(skinParam.getThemeStyle(),
deltaShadow = style.value(PName.Shadowing).asDouble(); skinParam.getIHtmlColorSet());
}
final Map<Network, TextBlock> conns2 = new LinkedHashMap<Network, TextBlock>(); final Map<Network, TextBlock> conns2 = new LinkedHashMap<Network, TextBlock>();
for (Entry<Network, String> ent : conns.entrySet()) { for (Entry<Network, String> ent : conns.entrySet()) {
conns2.put(ent.getKey(), toTextBlock(ent.getValue(), skinParam)); conns2.put(ent.getKey(), toTextBlock(ent.getValue(), skinParam));
} }
final SymbolContext symbolContext = new SymbolContext(ColorParam.activityBackground.getDefaultValue(),
ColorParam.activityBorder.getDefaultValue()).withShadow(deltaShadow);
final TextBlock desc = toTextBlock(getDescription(), skinParam); final TextBlock desc = toTextBlock(getDescription(), skinParam);
final TextBlock box = getShape().asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0), final TextBlock box = getShape().asSmall(TextBlockUtils.empty(0, 0), desc, TextBlockUtils.empty(0, 0),
symbolContext, HorizontalAlignment.CENTER); symbolContext, HorizontalAlignment.CENTER);
@ -156,11 +156,6 @@ public class NServer {
this.name = name; this.name = name;
} }
protected final FontConfiguration getFontConfiguration() {
final UFont font = UFont.serif(11);
return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false);
}
public final String getDescription() { public final String getDescription() {
return description; return description;
} }

View File

@ -48,18 +48,20 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.nwdiag.next.NBox; import net.sourceforge.plantuml.nwdiag.next.NBox;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class NwGroup { public class NwGroup {
public static final HColorSet colors = HColorSet.instance();
private final Set<String> names = new HashSet<>(); private final Set<String> names = new HashSet<>();
private final String name; private final String name;
@ -115,11 +117,6 @@ public class NwGroup {
this.description = value; this.description = value;
} }
public final FontConfiguration getGroupDescriptionFontConfiguration() {
final UFont font = UFont.serif(11);
return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false);
}
protected final String getDescription() { protected final String getDescription() {
return description; return description;
} }
@ -141,7 +138,13 @@ public class NwGroup {
return blockDim.getHeight(); return blockDim.getHeight();
} }
private StyleSignature getStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.group);
}
public void drawGroup(UGraphic ug, MinMax size, ISkinParam skinParam) { public void drawGroup(UGraphic ug, MinMax size, ISkinParam skinParam) {
final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
final TextBlock block = buildHeaderName(skinParam); final TextBlock block = buildHeaderName(skinParam);
if (block != null) { if (block != null) {
final Dimension2D blockDim = block.calculateDimension(ug.getStringBounder()); final Dimension2D blockDim = block.calculateDimension(ug.getStringBounder());
@ -150,7 +153,8 @@ public class NwGroup {
} }
HColor color = getColor(); HColor color = getColor();
if (color == null) { if (color == null) {
color = colors.getColorOrWhite(skinParam.getThemeStyle(), "#AAA"); color = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} }
size.draw(ug, color); size.draw(ug, color);
@ -163,7 +167,10 @@ public class NwGroup {
if (getDescription() == null) { if (getDescription() == null) {
return null; return null;
} }
return Display.getWithNewlines(getDescription()).create(getGroupDescriptionFontConfiguration(), final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
final Style style = getStyleDefinition().getMergedStyle(styleBuilder);
return Display.getWithNewlines(getDescription()).create(
style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()),
HorizontalAlignment.LEFT, skinParam); HorizontalAlignment.LEFT, skinParam);
} }

View File

@ -125,11 +125,11 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
return false; return false;
} }
private StyleSignature getStyleDefinition() { private StyleSignature getStyleDefinitionNetwork() {
return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.node); return StyleSignature.of(SName.root, SName.element, SName.nwdiagDiagram, SName.network);
} }
private void drawNetworkTube(final UGraphic ug) { private void drawNetworkTube(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
double y = 0; double y = 0;
@ -138,15 +138,17 @@ public class GridTextBlockDecorated extends GridTextBlockSimple {
computeMixMax(data.getLine(i), stringBounder, network); computeMixMax(data.getLine(i), stringBounder, network);
final URectangle rect = new URectangle(network.getXmax() - network.getXmin(), NETWORK_THIN); final URectangle rect = new URectangle(network.getXmax() - network.getXmin(), NETWORK_THIN);
double deltaShadow = 1.0;
UGraphic ug2 = ug.apply(new UTranslate(network.getXmin(), y));
final StyleBuilder styleBuilder = getSkinParam().getCurrentStyleBuilder(); final StyleBuilder styleBuilder = getSkinParam().getCurrentStyleBuilder();
if (styleBuilder != null) { final Style style = getStyleDefinitionNetwork().getMergedStyle(styleBuilder);
final Style style = getStyleDefinition().getMergedStyle(styleBuilder); final double deltaShadow = style.value(PName.Shadowing).asDouble();
deltaShadow = style.value(PName.Shadowing).asDouble(); ug2 = ug2.apply(style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
} getSkinParam().getIHtmlColorSet()));
ug2 = ug2.apply(style.value(PName.BackGroundColor)
.asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()).bg());
rect.setDeltaShadow(deltaShadow); rect.setDeltaShadow(deltaShadow);
UGraphic ug2 = ug.apply(new UTranslate(network.getXmin(), y));
if (network != null && network.getColor() != null) { if (network != null && network.getColor() != null) {
ug2 = ug2.apply(network.getColor().bg()); ug2 = ug2.apply(network.getColor().bg());
} }

View File

@ -316,7 +316,7 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit
private TimeHeader getTimeHeader() { private TimeHeader getTimeHeader() {
if (openClose.getCalendar() == null) { if (openClose.getCalendar() == null) {
return new TimeHeaderSimple(getTimelineStyle(), getClosedStyle(), getFactorScale(), min, max, return new TimeHeaderSimple(getTimelineStyle(), getClosedStyle(), getFactorScale(), min, max,
getIHtmlColorSet(), getSkinParam().getThemeStyle()); getIHtmlColorSet(), getSkinParam().getThemeStyle(), colorDays());
} else if (printScale == PrintScale.DAILY) { } else if (printScale == PrintScale.DAILY) {
return new TimeHeaderDaily(locale, getTimelineStyle(), getClosedStyle(), getFactorScale(), return new TimeHeaderDaily(locale, getTimelineStyle(), getClosedStyle(), getFactorScale(),
openClose.getCalendar(), min, max, openClose, colorDays(), colorDaysOfWeek, nameDays, printStart, openClose.getCalendar(), min, max, openClose, colorDays(), colorDaysOfWeek, nameDays, printStart,

View File

@ -41,11 +41,8 @@ import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.project.GanttDiagram; import net.sourceforge.plantuml.project.GanttDiagram;
import net.sourceforge.plantuml.project.core.PrintScale;
public class CommandLanguage extends SingleLineCommand2<GanttDiagram> { public class CommandLanguage extends SingleLineCommand2<GanttDiagram> {

View File

@ -55,7 +55,6 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone; import net.sourceforge.plantuml.ugraphic.color.HColorNone;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public abstract class TimeHeader { public abstract class TimeHeader {

View File

@ -65,6 +65,7 @@ public abstract class TimeHeaderCalendar extends TimeHeader {
this.colorDaysOfWeek = colorDaysOfWeek; this.colorDaysOfWeek = colorDaysOfWeek;
} }
// Duplicate in TimeHeaderSimple
class Pending { class Pending {
final double x1; final double x1;
double x2; double x2;

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class TimeHeaderDaily extends TimeHeaderCalendar { public class TimeHeaderDaily extends TimeHeaderCalendar {

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class TimeHeaderQuarterly extends TimeHeaderCalendar { public class TimeHeaderQuarterly extends TimeHeaderCalendar {

View File

@ -35,6 +35,8 @@
*/ */
package net.sourceforge.plantuml.project.draw; package net.sourceforge.plantuml.project.draw;
import java.util.Map;
import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
@ -47,11 +49,13 @@ import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class TimeHeaderSimple extends TimeHeader { public class TimeHeaderSimple extends TimeHeader {
private final Map<Day, HColor> colorDays;
@Override @Override
public double getFullHeaderHeight() { public double getFullHeaderHeight() {
return getTimeHeaderHeight() + getHeaderNameDayHeight(); return getTimeHeaderHeight() + getHeaderNameDayHeight();
@ -70,8 +74,9 @@ public class TimeHeaderSimple extends TimeHeader {
} }
public TimeHeaderSimple(Style timelineStyle, Style closedStyle, double scale, Day min, Day max, HColorSet colorSet, public TimeHeaderSimple(Style timelineStyle, Style closedStyle, double scale, Day min, Day max, HColorSet colorSet,
ThemeStyle themeStyle) { ThemeStyle themeStyle, Map<Day, HColor> colorDays) {
super(timelineStyle, closedStyle, min, max, new TimeScaleWink(scale), colorSet, themeStyle); super(timelineStyle, closedStyle, min, max, new TimeScaleWink(scale), colorSet, themeStyle);
this.colorDays = colorDays;
} }
private void drawSmallVlinesDay(UGraphic ug, TimeScale timeScale, double totalHeightWithoutFooter) { private void drawSmallVlinesDay(UGraphic ug, TimeScale timeScale, double totalHeightWithoutFooter) {
@ -100,6 +105,7 @@ public class TimeHeaderSimple extends TimeHeader {
@Override @Override
public void drawTimeHeader(final UGraphic ug, double totalHeightWithoutFooter) { public void drawTimeHeader(final UGraphic ug, double totalHeightWithoutFooter) {
drawTextsBackground(ug.apply(UTranslate.dy(-3)), totalHeightWithoutFooter + 6);
final double xmin = getTimeScale().getStartingPosition(min); final double xmin = getTimeScale().getStartingPosition(min);
final double xmax = getTimeScale().getEndingPosition(max); final double xmax = getTimeScale().getEndingPosition(max);
drawSmallVlinesDay(ug, getTimeScale(), totalHeightWithoutFooter); drawSmallVlinesDay(ug, getTimeScale(), totalHeightWithoutFooter);
@ -119,4 +125,56 @@ public class TimeHeaderSimple extends TimeHeader {
ug.apply(getBarColor()).draw(ULine.hline(xmax - xmin)); ug.apply(getBarColor()).draw(ULine.hline(xmax - xmin));
} }
// Duplicate in TimeHeaderDaily
class Pending {
final double x1;
double x2;
final HColor color;
Pending(HColor color, double x1, double x2) {
this.x1 = x1;
this.x2 = x2;
this.color = color;
}
public void draw(UGraphic ug, double height) {
drawRectangle(ug.apply(color.bg()), height, x1, x2);
}
}
protected final void drawTextsBackground(UGraphic ug, double totalHeightWithoutFooter) {
final double height = totalHeightWithoutFooter - getFullHeaderHeight();
Pending pending = null;
for (Day wink = min; wink.compareTo(max) <= 0; wink = wink.increment()) {
final double x1 = getTimeScale().getStartingPosition(wink);
final double x2 = getTimeScale().getEndingPosition(wink);
HColor back = colorDays.get(wink);
// // Day of week should be stronger than period of time (back color).
// final HColor backDoW = colorDaysOfWeek.get(wink.getDayOfWeek());
// if (backDoW != null) {
// back = backDoW;
// }
// if (back == null && defaultPlan.getLoadAt(wink) == 0) {
// back = closedBackgroundColor();
// }
if (back == null) {
if (pending != null)
pending.draw(ug, height);
pending = null;
} else {
if (pending != null && pending.color.equals(back) == false) {
pending.draw(ug, height);
pending = null;
}
if (pending == null) {
pending = new Pending(back, x1, x2);
} else {
pending.x2 = x2;
}
}
}
}
} }

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class TimeHeaderYearly extends TimeHeaderCalendar { public class TimeHeaderYearly extends TimeHeaderCalendar {

View File

@ -87,6 +87,7 @@ public enum SName {
lifeLine, // lifeLine, //
milestone, // milestone, //
mindmapDiagram, // mindmapDiagram, //
network, //
node, // node, //
note, // note, //
nwdiagDiagram, // nwdiagDiagram, //
@ -104,6 +105,7 @@ public enum SName {
saltDiagram, // saltDiagram, //
separator, // separator, //
sequenceDiagram, // sequenceDiagram, //
server, //
stack, // stack, //
stateDiagram, // stateDiagram, //
stereotype, // stereotype, //

View File

@ -149,6 +149,9 @@ public class HColorSimple extends HColorAbstract implements HColor {
final float[] hsl1 = col1.getHSL(); final float[] hsl1 = col1.getHSL();
final float[] hsl2 = col2.getHSL(); final float[] hsl2 = col2.getHSL();
if (completionInt > 100)
completionInt = 100;
float completion = (float) (completionInt / 100.0); float completion = (float) (completionInt / 100.0);
completion = completion * completion * completion; completion = completion * completion * completion;
final float[] hsl = linear(completion, hsl1, hsl2); final float[] hsl = linear(completion, hsl1, hsl2);

View File

@ -80,7 +80,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 2; final int beta = 3;
return beta; return beta;
} }