1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-28 15:56:31 +00:00

Minor bug fixes

This commit is contained in:
Arnaud Roques 2022-05-27 16:18:47 +02:00
parent 2621139b20
commit 1afe7aae82
23 changed files with 237 additions and 142 deletions

View File

@ -400,6 +400,7 @@ timingDiagram {
timeline { timeline {
FontStyle plain FontStyle plain
FontSize 11 FontSize 11
LineThickness 2
} }
note { note {
LineThickness 0.5 LineThickness 0.5

View File

@ -139,9 +139,9 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
if (diagram.V1972()) { if (diagram.V1972()) {
if (diagram.leafExistSmart(idNewLong)) { if (diagram.leafExistSmart(idNewLong)) {
entity = diagram.getOrCreateLeaf(idNewLong, idNewLong, type, null); entity = diagram.getOrCreateLeaf(idNewLong, idNewLong, type, null);
if (entity.muteToType(type, null) == false) { if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name"); return CommandExecutionResult.error("Bad name");
}
} else { } else {
entity = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null); entity = diagram.createLeaf(idNewLong, idNewLong, Display.getWithNewlines(display), type, null);
} }
@ -149,9 +149,9 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
final Code code = diagram.buildCode(idShort); final Code code = diagram.buildCode(idShort);
if (diagram.leafExist(code)) { if (diagram.leafExist(code)) {
entity = diagram.getOrCreateLeaf(idNewLong, code, type, null); entity = diagram.getOrCreateLeaf(idNewLong, code, type, null);
if (entity.muteToType(type, null) == false) { if (entity.muteToType(type, null) == false)
return CommandExecutionResult.error("Bad name"); return CommandExecutionResult.error("Bad name");
}
} else { } else {
entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null); entity = diagram.createLeaf(idNewLong, code, Display.getWithNewlines(display), type, null);
} }
@ -162,9 +162,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
diagram.getSkinParam().getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
entity.setStereostyle(stereo); entity.setStereostyle(stereo);
} }
if (generic != null) { if (generic != null)
entity.setGeneric(generic); entity.setGeneric(generic);
}
final String urlString = arg.get("URL", 0); final String urlString = arg.get("URL", 0);
if (urlString != null) { if (urlString != null) {
@ -180,57 +179,19 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
final HColor lineColor = s == null ? null final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s); : diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
if (lineColor != null) { if (lineColor != null)
colors = colors.add(ColorType.LINE, lineColor); colors = colors.add(ColorType.LINE, lineColor);
}
if (arg.get("LINECOLOR", 0) != null) { if (arg.get("LINECOLOR", 0) != null)
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0)); colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
}
entity.setColors(colors); entity.setColors(colors);
// entity.setSpecificColorTOBEREMOVED(ColorType.LINE, lineColor);
// entity.setSpecificColorTOBEREMOVED(ColorType.HEADER,
// colors.getColor(ColorType.HEADER));
//
// if (colors.getLineStyle() != null) {
// entity.setSpecificLineStroke(LinkStyle.getStroke(colors.getLineStyle()));
// }
//
// if (arg.get("LINECOLOR", 0) != null) {
// entity.applyStroke(arg.get("LINECOLOR", 0));
// }
// manageExtends(diagram, arg, entity);
CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity); CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity);
CommandCreateClassMultilines.manageExtends("IMPLEMENTS", diagram, arg, entity); CommandCreateClassMultilines.manageExtends("IMPLEMENTS", diagram, arg, entity);
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
// public static void manageExtends(ClassDiagram system, RegexResult arg, final
// IEntity entity) {
// if (arg.get("EXTENDS", 1) != null) {
// final Mode mode = arg.get("EXTENDS", 1).equalsIgnoreCase("extends") ?
// Mode.EXTENDS : Mode.IMPLEMENTS;
// final Code other = diagram.buildCode(arg.get("EXTENDS", 2));
// LeafType type2 = LeafType.CLASS;
// if (mode == Mode.IMPLEMENTS) {
// type2 = LeafType.INTERFACE;
// }
// if (mode == Mode.EXTENDS && entity.getEntityType() == LeafType.INTERFACE) {
// type2 = LeafType.INTERFACE;
// }
// final IEntity cl2 = system.getOrCreateLeaf(other, type2, null);
// LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS);
// if (type2 == LeafType.INTERFACE && entity.getEntityType() !=
// LeafType.INTERFACE) {
// typeLink = typeLink.getDashed();
// }
// final Link link = new Link(cl2, entity, typeLink, null, 2, null, null,
// system.getLabeldistance(),
// system.getLabelangle());
// system.addLink(link);
// }
// }
} }

View File

@ -87,16 +87,15 @@ public class CommandExecutionResult {
public static List<String> getStackTrace(Throwable exception) { public static List<String> getStackTrace(Throwable exception) {
final List<String> result = new ArrayList<>(); final List<String> result = new ArrayList<>();
result.add(exception.toString()); result.add(exception.toString());
for (StackTraceElement ste : exception.getStackTrace()) { for (StackTraceElement ste : exception.getStackTrace())
result.add(" " + ste.toString()); result.add(" " + ste.toString());
}
if (exception.getCause() != null) { if (exception.getCause() != null) {
final Throwable cause = exception.getCause(); final Throwable cause = exception.getCause();
result.add(" "); result.add(" ");
result.add("Caused by " + cause.toString()); result.add("Caused by " + cause.toString());
for (StackTraceElement ste : cause.getStackTrace()) { for (StackTraceElement ste : cause.getStackTrace())
result.add(" " + ste.toString()); result.add(" " + ste.toString());
}
} }
return result; return result;
@ -107,9 +106,9 @@ public class CommandExecutionResult {
} }
public String getError() { public String getError() {
if (isOk()) { if (isOk())
throw new IllegalStateException(); throw new IllegalStateException();
}
return error; return error;
} }

View File

@ -75,7 +75,9 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
BodyEnhanced1(HorizontalAlignment align, List<CharSequence> rawBody, ISkinParam skinParam, ILeaf entity, BodyEnhanced1(HorizontalAlignment align, List<CharSequence> rawBody, ISkinParam skinParam, ILeaf entity,
Style style) { Style style) {
super(align, style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()), style); super(align,
style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet(), entity.getColors()),
style);
this.style = style; this.style = style;
this.rawBody2 = Display.create(rawBody); this.rawBody2 = Display.create(rawBody);
@ -87,9 +89,10 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
this.inEllipse = false; this.inEllipse = false;
} }
BodyEnhanced1(HorizontalAlignment align, Display display, ISkinParam skinParam, ILeaf entity, BodyEnhanced1(HorizontalAlignment align, Display display, ISkinParam skinParam, ILeaf entity, Style style) {
Style style) { super(align,
super(align, style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()), style); style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet(), entity.getColors()),
style);
this.style = style; this.style = style;
this.entity = entity; this.entity = entity;

View File

@ -133,9 +133,9 @@ public class Link extends WithLinkType implements Hideable, Removeable {
public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, String qualifier1, public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, String qualifier1,
String qualifier2, String labeldistance, String labelangle, HColor specificColor, String qualifier2, String labeldistance, String labelangle, HColor specificColor,
StyleBuilder styleBuilder) { StyleBuilder styleBuilder) {
if (length < 1) { if (length < 1)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
this.styleBuilder = styleBuilder; this.styleBuilder = styleBuilder;
this.cl1 = Objects.requireNonNull(cl1); this.cl1 = Objects.requireNonNull(cl1);
this.cl2 = Objects.requireNonNull(cl2); this.cl2 = Objects.requireNonNull(cl2);

View File

@ -54,19 +54,19 @@ public class LinkType {
} }
public boolean looksLikeRevertedForSvg() { public boolean looksLikeRevertedForSvg() {
if (this.decor1 == LinkDecor.NONE && this.decor2 != LinkDecor.NONE) { if (this.decor1 == LinkDecor.NONE && this.decor2 != LinkDecor.NONE)
return true; return true;
}
return false; return false;
} }
public boolean looksLikeNoDecorAtAllSvg() { public boolean looksLikeNoDecorAtAllSvg() {
if (this.decor1 == LinkDecor.NONE && this.decor2 == LinkDecor.NONE) { if (this.decor1 == LinkDecor.NONE && this.decor2 == LinkDecor.NONE)
return true; return true;
}
if (this.decor1 != LinkDecor.NONE && this.decor2 != LinkDecor.NONE) { if (this.decor1 != LinkDecor.NONE && this.decor2 != LinkDecor.NONE)
return true; return true;
}
return false; return false;
} }
@ -184,9 +184,9 @@ public class LinkType {
final double arrowsize = Math.max(decor1.getArrowSize(), decor2.getArrowSize()); final double arrowsize = Math.max(decor1.getArrowSize(), decor2.getArrowSize());
if (arrowsize > 0) { if (arrowsize > 0) {
if (sb.length() > 0) { if (sb.length() > 0)
sb.append(","); sb.append(",");
}
sb.append("arrowsize=" + arrowsize); sb.append("arrowsize=" + arrowsize);
} }
return sb.toString(); return sb.toString();
@ -235,13 +235,16 @@ public class LinkType {
} }
public UStroke getStroke3(UStroke defaultThickness) { public UStroke getStroke3(UStroke defaultThickness) {
if (linkStyle.isThicknessOverrided()) { if (linkStyle.isThicknessOverrided())
return linkStyle.getStroke3(); return linkStyle.getStroke3();
}
if (defaultThickness == null) { if (defaultThickness == null)
return linkStyle.getStroke3(); return linkStyle.getStroke3();
}
return linkStyle.goThickness(defaultThickness.getThickness()).getStroke3(); if (defaultThickness.getDashVisible() == 0 && defaultThickness.getDashSpace() == 0)
return linkStyle.goThickness(defaultThickness.getThickness()).getStroke3();
return defaultThickness;
} }
public LinkMiddleDecor getMiddleDecor() { public LinkMiddleDecor getMiddleDecor() {

View File

@ -174,7 +174,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
private TextBlock createTextBlock(CharSequence cs) { private TextBlock createTextBlock(CharSequence cs) {
FontConfiguration config = FontConfiguration.create(skinParam, style); FontConfiguration config = FontConfiguration.create(skinParam, style, leaf.getColors());
if (cs instanceof Member) { if (cs instanceof Member) {
final Member m = (Member) cs; final Member m = (Member) cs;
@ -195,9 +195,8 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
return new TextBlockTracer(m, bloc); return new TextBlockTracer(m, bloc);
} }
if (cs instanceof EmbeddedDiagram) { if (cs instanceof EmbeddedDiagram)
return ((EmbeddedDiagram) cs).asDraw(skinParam); return ((EmbeddedDiagram) cs).asDraw(skinParam);
}
return Display.getWithNewlines(cs.toString()).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE, return Display.getWithNewlines(cs.toString()).create8(config, align, skinParam, CreoleMode.SIMPLE_LINE,
skinParam.wrapWidth()); skinParam.wrapWidth());

View File

@ -35,7 +35,6 @@
*/ */
package net.sourceforge.plantuml.donors; package net.sourceforge.plantuml.donors;
import net.sourceforge.plantuml.awt.geom.Dimension2D;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -45,6 +44,7 @@ import java.util.StringTokenizer;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.PlainDiagram; import net.sourceforge.plantuml.PlainDiagram;
import net.sourceforge.plantuml.awt.geom.Dimension2D;
import net.sourceforge.plantuml.code.AsciiEncoder; import net.sourceforge.plantuml.code.AsciiEncoder;
import net.sourceforge.plantuml.code.CompressionBrotli; import net.sourceforge.plantuml.code.CompressionBrotli;
import net.sourceforge.plantuml.code.NoPlantumlCompressionException; import net.sourceforge.plantuml.code.NoPlantumlCompressionException;
@ -70,29 +70,30 @@ public class PSystemDonors extends PlainDiagram {
private static final int COLS = 6; private static final int COLS = 6;
private static final int FREE_LINES = 6; private static final int FREE_LINES = 6;
public static final String DONORS = "6t4E03mSS7Dt1Og5J5Uh3hcJits4ZufN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egiIl6utyk765jKLR45v" + "ahd2rdRY82h3_PubjYZPQf61VLVDPUkNvRRDJMROaV-17plV_AYwVX41DKHN9NZDQUJ3ZSrgQjYY_cOE"
+ "iuJxk2pMpUINSIdQ9Qg1pVlEHWsm6Iga98A81w12U8txDVq9Myu5yktrbxamKiFpU3NqpAUx0ol8DXfU" + "zt6PhPl9p-DIj7DK0vlqPAE6iXaev2I4I0T2XVHL-5Nz2LlEEVBfVQeK1cfu7hiDFNYk1kR8LXfU9Gse"
+ "9GsgNcHnR7s_vIRl7CYSU6nmOPMnqyES7YqprBQRDbl8e9AuSyLOps1sZv8gdygOLChGL8qDDKjYwxAp" + "NcHnR7s_uIPF3XHEJBR-LQUnqyEO7gqmrAQRDcl8e1AvIyLNZc1sSqcLjoecbJAyy-FUKBCajFQTxUZq"
+ "7Ps1yItaYlMzVMjZXfJw1VEPu1H3JKal3MG20Lb4Ke21v2hPhrfnXepCj4gynSfMqZ3LJMfej1iiYZjB" + "Ms7pORCrtdviIo40"; + "JcuXbzTpFBqnWqlzakWpmJa6ch9U7CY41cGHMK4ZYAwI_Q8LPyYeBAl4HwfWc3ZQ4kxGQ3DOk3lMfw5i"
+ "NZ5RuziaFZ126vR-nWNSUuP4pmKD8zkS06nO52cKX6OetMCGEs57p2vkUISVW_BMtW00";
/* /*
* Special thanks to our sponsors and donors: * Special thanks to our sponsors and donors:

View File

@ -92,12 +92,17 @@ public class FontConfiguration {
} }
public static FontConfiguration create(ISkinParam skinParam, Style style) { public static FontConfiguration create(ISkinParam skinParam, Style style) {
return create(skinParam, style, null);
}
public static FontConfiguration create(ISkinParam skinParam, Style style, Colors colors) {
final HColor hyperlinkColor = style.value(PName.HyperLinkColor).asColor(skinParam.getThemeStyle(), final HColor hyperlinkColor = style.value(PName.HyperLinkColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet()); skinParam.getIHtmlColorSet());
final boolean useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink(); final boolean useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink();
return create(style.getUFont(), HColor color = colors == null ? null : colors.getColor(ColorType.TEXT);
style.value(PName.FontColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()), if (color == null)
hyperlinkColor, useUnderlineForHyperlink, skinParam.getTabSize()); color = style.value(PName.FontColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
return create(style.getUFont(), color, hyperlinkColor, useUnderlineForHyperlink, skinParam.getTabSize());
} }
// --- // ---

View File

@ -166,12 +166,12 @@ public class Colors {
} }
public static UGraphic applyStroke(UGraphic ug, Colors colors) { public static UGraphic applyStroke(UGraphic ug, Colors colors) {
if (colors == null) { if (colors == null)
return ug; return ug;
}
if (colors.lineStyle == null) { if (colors.lineStyle == null)
return ug; return ug;
}
return ug.apply(colors.lineStyle.getStroke3()); return ug.apply(colors.lineStyle.getStroke3());
} }

View File

@ -96,7 +96,7 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexOr("ARROW_DRESSING1", // new RegexOptional(new RegexOr("ARROW_DRESSING1", //
new RegexLeaf("[%s][ox]"), // new RegexLeaf("[%s][ox]"), //
new RegexLeaf("(?:[%s][ox])?<<?_?"), // new RegexLeaf("(?:[%s][ox]|\\(\\d+\\))?<<?_?"), //
new RegexLeaf("(?:[%s][ox])?//?"), // new RegexLeaf("(?:[%s][ox])?//?"), //
new RegexLeaf("(?:[%s][ox])?\\\\\\\\?"))), // new RegexLeaf("(?:[%s][ox])?\\\\\\\\?"))), //
new RegexOr(new RegexConcat( // new RegexOr(new RegexConcat( //
@ -210,7 +210,8 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
final String dressing1 = getDressing(arg, "ARROW_DRESSING1"); final String dressing1 = getDressing(arg, "ARROW_DRESSING1");
final String dressing2 = getDressing(arg, "ARROW_DRESSING2"); final String dressing2 = getDressing(arg, "ARROW_DRESSING2");
final int inclination = getInclination(arg.get("ARROW_DRESSING2", 0)); final int inclination1 = getInclination(arg.get("ARROW_DRESSING1", 0));
final int inclination2 = getInclination(arg.get("ARROW_DRESSING2", 0));
final boolean circleAtStart; final boolean circleAtStart;
final boolean circleAtEnd; final boolean circleAtEnd;
@ -288,7 +289,7 @@ public class CommandArrow extends SingleLineCommand2<SequenceDiagram> {
config = applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0), config); config = applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0), config);
config = config.withInclination(inclination); config = config.withInclination(inclination1 + inclination2);
final String activationSpec = arg.get("ACTIVATION", 0); final String activationSpec = arg.get("ACTIVATION", 0);

View File

@ -187,8 +187,15 @@ public class Style {
} }
public FontConfiguration getFontConfiguration(ThemeStyle themeStyle, HColorSet set) { public FontConfiguration getFontConfiguration(ThemeStyle themeStyle, HColorSet set) {
return getFontConfiguration(themeStyle, set, null);
}
public FontConfiguration getFontConfiguration(ThemeStyle themeStyle, HColorSet set, Colors colors) {
final UFont font = getUFont(); final UFont font = getUFont();
final HColor color = value(PName.FontColor).asColor(themeStyle, set); HColor color = colors == null ? null : colors.getColor(ColorType.TEXT);
if (color == null)
color = value(PName.FontColor).asColor(themeStyle, set);
final HColor hyperlinkColor = value(PName.HyperLinkColor).asColor(themeStyle, set); final HColor hyperlinkColor = value(PName.HyperLinkColor).asColor(themeStyle, set);
return FontConfiguration.create(font, color, hyperlinkColor, true); return FontConfiguration.create(font, color, hyperlinkColor, true);
} }

View File

@ -665,9 +665,12 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
ug = ug.apply(new HColorNone().bg()).apply(color); ug = ug.apply(new HColorNone().bg()).apply(color);
final LinkType linkType = link.getType(); final LinkType linkType = link.getType();
UStroke stroke = suggestedStroke == null || linkType.getStyle().isNormal() == false UStroke stroke;
? linkType.getStroke3(defaultThickness) if (suggestedStroke == null || linkType.getStyle().isNormal() == false)
: suggestedStroke; stroke = linkType.getStroke3(defaultThickness);
else
stroke = linkType.getStroke3(suggestedStroke);
if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null)
stroke = link.getColors().getSpecificLineStroke(); stroke = link.getColors().getSpecificLineStroke();

View File

@ -192,7 +192,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
ug = ug.apply(classBorder); ug = ug.apply(classBorder);
ug = ug.apply(backcolor.bg()); ug = ug.apply(backcolor.bg());
final UStroke stroke = getStyle().getStroke(); final UStroke stroke = getStyle().getStroke(lineConfig.getColors());
UGraphic ugHeader = ug; UGraphic ugHeader = ug;
if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) { if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) {

View File

@ -87,7 +87,7 @@ public class EntityImageClassHeader extends AbstractEntityImage {
.withTOBECHANGED(stereotype) // .withTOBECHANGED(stereotype) //
.with(entity.getStereostyles()) // .with(entity.getStereostyles()) //
.getMergedStyle(skinParam.getCurrentStyleBuilder()); .getMergedStyle(skinParam.getCurrentStyleBuilder());
FontConfiguration fontConfigurationName = FontConfiguration.create(skinParam, style); FontConfiguration fontConfigurationName = FontConfiguration.create(skinParam, style, entity.getColors());
if (italic) if (italic)
fontConfigurationName = fontConfigurationName.italic(); fontConfigurationName = fontConfigurationName.italic();

View File

@ -42,4 +42,6 @@ public interface Clocks {
public TimeTick getCodeValue(String code); public TimeTick getCodeValue(String code);
public TimingFormat getTimingFormatDate();
} }

View File

@ -38,10 +38,12 @@ import java.awt.geom.Rectangle2D;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
@ -389,4 +391,23 @@ public class TimingDiagram extends UmlDiagram implements Clocks {
this.compactByDefault = true; this.compactByDefault = true;
} }
private SimpleDateFormat sdf;
public CommandExecutionResult useDateFormat(String dateFormat) {
try {
this.sdf = new SimpleDateFormat(dateFormat, Locale.US);
} catch (Exception e) {
return CommandExecutionResult.error("Bad date format");
}
return CommandExecutionResult.ok();
}
@Override
public TimingFormat getTimingFormatDate() {
if (sdf == null)
return TimingFormat.DATE;
return TimingFormat.create(sdf);
}
} }

View File

@ -65,6 +65,7 @@ import net.sourceforge.plantuml.timingdiagram.command.CommandRobustConcise;
import net.sourceforge.plantuml.timingdiagram.command.CommandScalePixel; import net.sourceforge.plantuml.timingdiagram.command.CommandScalePixel;
import net.sourceforge.plantuml.timingdiagram.command.CommandTicks; import net.sourceforge.plantuml.timingdiagram.command.CommandTicks;
import net.sourceforge.plantuml.timingdiagram.command.CommandTimeMessage; import net.sourceforge.plantuml.timingdiagram.command.CommandTimeMessage;
import net.sourceforge.plantuml.timingdiagram.command.CommandUseDateFormat;
public class TimingDiagramFactory extends PSystemCommandFactory { public class TimingDiagramFactory extends PSystemCommandFactory {
@ -100,6 +101,7 @@ public class TimingDiagramFactory extends PSystemCommandFactory {
cmds.add(new CommandModeCompact()); cmds.add(new CommandModeCompact());
cmds.add(new CommandTicks()); cmds.add(new CommandTicks());
cmds.add(new CommandPixelHeight()); cmds.add(new CommandPixelHeight());
cmds.add(new CommandUseDateFormat());
return cmds; return cmds;
} }

View File

@ -35,24 +35,40 @@
package net.sourceforge.plantuml.timingdiagram; package net.sourceforge.plantuml.timingdiagram;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.TimeZone; import java.util.TimeZone;
public enum TimingFormat { public final class TimingFormat {
DECIMAL, HOUR, DATE;
private static final TimeZone GMT = TimeZone.getTimeZone("GMT"); private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
private static final GregorianCalendar gc = new GregorianCalendar(TimingFormat.GMT); private static final GregorianCalendar gc = new GregorianCalendar(TimingFormat.GMT);
public static final TimingFormat DECIMAL = new TimingFormat(null);
public static final TimingFormat HOUR = new TimingFormat(null);
public static final TimingFormat DATE = new TimingFormat(null);
private final SimpleDateFormat sdf;
private TimingFormat(SimpleDateFormat sdf) {
this.sdf = sdf;
}
public static TimingFormat create(SimpleDateFormat sdf) {
return new TimingFormat(sdf);
}
public String formatTime(BigDecimal time) { public String formatTime(BigDecimal time) {
if (this == HOUR || this == DATE) { if (this == HOUR || this == DATE || sdf != null)
return formatTime(time.longValueExact()); return formatTime(time.longValueExact());
}
return time.toPlainString(); return time.toPlainString();
} }
public String formatTime(long time) { public String formatTime(long time) {
if (sdf != null)
return sdf.format(time * 1000L);
if (this == HOUR) { if (this == HOUR) {
final int s = (int) time % 60; final int s = (int) time % 60;
final int m = (int) (time / 60) % 60; final int m = (int) (time / 60) % 60;
@ -75,14 +91,14 @@ public enum TimingFormat {
return "" + time; return "" + time;
} }
public static TimeTick createDate(final int yyyy, final int mm, final int dd) { public static TimeTick createDate(int yyyy, int mm, int dd, TimingFormat format) {
final long timeInMillis; final long timeInMillis;
synchronized (gc) { synchronized (gc) {
gc.setTimeInMillis(0); gc.setTimeInMillis(0);
gc.set(yyyy, mm - 1, dd); gc.set(yyyy, mm - 1, dd);
timeInMillis = gc.getTimeInMillis() / 1000L; timeInMillis = gc.getTimeInMillis() / 1000L;
} }
return new TimeTick(new BigDecimal(timeInMillis), TimingFormat.DATE); return new TimeTick(new BigDecimal(timeInMillis), format);
} }
} }

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
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.HColorUtils;
public class TimingRuler { public class TimingRuler {
@ -200,7 +201,14 @@ public class TimingRuler {
if (timeAxisStategy == TimeAxisStategy.HIDDEN) if (timeAxisStategy == TimeAxisStategy.HIDDEN)
return; return;
ug = ug.apply(new UStroke(2.0)).apply(black()); final Style style = StyleSignatureBasic.of(SName.root, SName.timingDiagram, SName.timeline)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final HColor color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
final UStroke stroke = style.getStroke();
ug = ug.apply(stroke).apply(color);
if (timeAxisStategy == TimeAxisStategy.AUTOMATIC) if (timeAxisStategy == TimeAxisStategy.AUTOMATIC)
drawTimeAxisAutomatic(ug); drawTimeAxisAutomatic(ug);
@ -254,15 +262,7 @@ public class TimingRuler {
if (tick.equals(ent.getValue())) if (tick.equals(ent.getValue()))
return ent.getKey(); return ent.getKey();
return ""; return format.formatTime(tick.getTime());
// return format.formatTime(tick.getTime());
}
private HColor black() {
final Style style = StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
return style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} }
private BigDecimal getFirstPositiveOrZeroValue() { private BigDecimal getFirstPositiveOrZeroValue() {

View File

@ -0,0 +1,71 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.timingdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.timingdiagram.TimingDiagram;
public class CommandUseDateFormat extends SingleLineCommand2<TimingDiagram> {
public CommandUseDateFormat() {
super(getRegexConcat());
}
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandUseDateFormat.class.getName(), RegexLeaf.start(), //
new RegexLeaf("use"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("date"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("format"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("FORMAT", "[%g]([^%g]+)[%g]"), //
RegexLeaf.end());
}
@Override
final protected CommandExecutionResult executeArg(TimingDiagram diagram, LineLocation location, RegexResult arg) {
final String format = arg.get("FORMAT", 0);
return diagram.useDateFormat(format);
}
}

View File

@ -72,9 +72,9 @@ public class TimeTickBuilder {
if (code != null) { if (code != null) {
final String delta = arg.get(name + "CODE", 1); final String delta = arg.get(name + "CODE", 1);
TimeTick result = clock.getCodeValue(code); TimeTick result = clock.getCodeValue(code);
if (delta == null) { if (delta == null)
return result; return result;
}
final BigDecimal value = result.getTime().add(new BigDecimal(delta)); final BigDecimal value = result.getTime().add(new BigDecimal(delta));
return new TimeTick(value, TimingFormat.DECIMAL); return new TimeTick(value, TimingFormat.DECIMAL);
} }
@ -97,17 +97,17 @@ public class TimeTickBuilder {
final int mm = Integer.parseInt(arg.get(name + "DATE", 1)); final int mm = Integer.parseInt(arg.get(name + "DATE", 1));
final int dd = Integer.parseInt(arg.get(name + "DATE", 2)); final int dd = Integer.parseInt(arg.get(name + "DATE", 2));
return TimingFormat.createDate(yy, mm, dd); return TimingFormat.createDate(yy, mm, dd, clock.getTimingFormatDate());
} }
final String number = arg.get(name + "DIGIT", 1); final String number = arg.get(name + "DIGIT", 1);
if (number == null) { if (number == null)
return clock.getNow(); return clock.getNow();
}
final boolean isRelative = "+".equals(arg.get(name + "DIGIT", 0)); final boolean isRelative = "+".equals(arg.get(name + "DIGIT", 0));
BigDecimal value = new BigDecimal(number); BigDecimal value = new BigDecimal(number);
if (isRelative && clock.getNow() != null) { if (isRelative && clock.getNow() != null)
value = clock.getNow().getTime().add(value); value = clock.getNow().getTime().add(value);
}
return new TimeTick(value, TimingFormat.DECIMAL); return new TimeTick(value, TimingFormat.DECIMAL);
} }

View File

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