mirror of
https://github.com/octoleo/plantuml.git
synced 2025-01-03 07:12:29 +00:00
Merge branch 'master' into bj-add-protocol-struct
This commit is contained in:
commit
fe789981d6
5
.github/scripts/release-snapshot.sh
vendored
5
.github/scripts/release-snapshot.sh
vendored
@ -34,6 +34,7 @@ fi
|
|||||||
echo -n "${DATE_TIME_UTC}" > "${RELEASE_DIR}/plantuml-SNAPSHOT.timestamp"
|
echo -n "${DATE_TIME_UTC}" > "${RELEASE_DIR}/plantuml-SNAPSHOT.timestamp"
|
||||||
|
|
||||||
cat <<-EOF >notes.txt
|
cat <<-EOF >notes.txt
|
||||||
|
## Version ~v${POM_VERSION%-SNAPSHOT} of the ${DATE_TIME_UTC}
|
||||||
This is a pre-release of [the latest development work](https://github.com/plantuml/plantuml/commits/).
|
This is a pre-release of [the latest development work](https://github.com/plantuml/plantuml/commits/).
|
||||||
⚠️ **It is not ready for general use** ⚠️
|
⚠️ **It is not ready for general use** ⚠️
|
||||||
⏱ _Snapshot taken the ${DATE_TIME_UTC}_
|
⏱ _Snapshot taken the ${DATE_TIME_UTC}_
|
||||||
@ -42,8 +43,8 @@ EOF
|
|||||||
gh release create \
|
gh release create \
|
||||||
--prerelease \
|
--prerelease \
|
||||||
--target "${GITHUB_SHA}" \
|
--target "${GITHUB_SHA}" \
|
||||||
--title "${TAG}" \
|
--title "${TAG} (~v${POM_VERSION%-SNAPSHOT})" \
|
||||||
--notes-file notes.txt \
|
--notes-file notes.txt \
|
||||||
"${TAG}" ${RELEASE_DIR}/*
|
"${TAG}" ${RELEASE_DIR}/*
|
||||||
|
|
||||||
echo "::notice title=release snapshot::Snapshot released at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TAG} and taken the ${DATE_TIME_UTC}"
|
echo "::notice title=release snapshot::Snapshot (~v${POM_VERSION%-SNAPSHOT}) released at ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${TAG} and taken the ${DATE_TIME_UTC}"
|
||||||
|
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -27,6 +27,9 @@ jobs:
|
|||||||
do_snapshot_release: ${{ steps.config.outputs.do_snapshot_release }}
|
do_snapshot_release: ${{ steps.config.outputs.do_snapshot_release }}
|
||||||
pom_version: ${{ steps.config.outputs.pom_version }}
|
pom_version: ${{ steps.config.outputs.pom_version }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout the repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Configure workflow
|
- name: Configure workflow
|
||||||
id: config
|
id: config
|
||||||
env:
|
env:
|
||||||
@ -59,6 +62,8 @@ jobs:
|
|||||||
elif [[ "${GITHUB_EVENT_NAME}" =~ push|workflow_dispatch && "${REF}" == "refs/heads/master" ]]; then
|
elif [[ "${GITHUB_EVENT_NAME}" =~ push|workflow_dispatch && "${REF}" == "refs/heads/master" ]]; then
|
||||||
echo "::notice title=::This run will release a snapshot"
|
echo "::notice title=::This run will release a snapshot"
|
||||||
echo "::set-output name=do_snapshot_release::true"
|
echo "::set-output name=do_snapshot_release::true"
|
||||||
|
V=$(perl -ne 'if (/return (\d{6,7});/) {$v=$1} if (/final int beta = (\d+);/) {$b=$1} END{print(substr($v, 0, 1),".", substr($v, 1, 4),"."); if ($b) {print(int(substr($v+1, 5)), "beta", $b);} else {print(int(substr($v, 5)))}}' src/net/sourceforge/plantuml/version/Version.java)
|
||||||
|
echo "::set-output name=pom_version::$V-SNAPSHOT" # pom_version is taken from Version.java
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "This run will NOT make a release"
|
echo "This run will NOT make a release"
|
||||||
|
@ -1 +1 @@
|
|||||||
version = 1.2022.1-SNAPSHOT
|
version = M.YYYY.m-SNAPSHOT
|
||||||
|
@ -205,6 +205,9 @@ spot {
|
|||||||
spotEntity {
|
spotEntity {
|
||||||
BackgroundColor #ADD1B2
|
BackgroundColor #ADD1B2
|
||||||
}
|
}
|
||||||
|
spotException {
|
||||||
|
BackgroundColor #D94321
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -551,6 +554,9 @@ spot {
|
|||||||
spotEntity {
|
spotEntity {
|
||||||
BackgroundColor #2E5233
|
BackgroundColor #2E5233
|
||||||
}
|
}
|
||||||
|
spotException {
|
||||||
|
BackgroundColor #7D0000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,7 +179,8 @@ public class AnnotatedWorker {
|
|||||||
|
|
||||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.caption)
|
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.caption)
|
||||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||||
return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam);
|
return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam,
|
||||||
|
Style.ID_CAPTION);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +192,7 @@ public class AnnotatedWorker {
|
|||||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
||||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||||
final TextBlock block = style.createTextBlockBordered(title.getDisplay(), skinParam.getIHtmlColorSet(),
|
final TextBlock block = style.createTextBlockBordered(title.getDisplay(), skinParam.getIHtmlColorSet(),
|
||||||
skinParam);
|
skinParam, Style.ID_TITLE);
|
||||||
|
|
||||||
return DecorateEntityImage.addTop(original, block, HorizontalAlignment.CENTER);
|
return DecorateEntityImage.addTop(original, block, HorizontalAlignment.CENTER);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class EntityImageLegend {
|
|||||||
final Style style = StyleSignatureBasic
|
final Style style = StyleSignatureBasic
|
||||||
.of(SName.root, SName.root, SName.document, skinParam.getUmlDiagramType().getStyleName(), SName.legend)
|
.of(SName.root, SName.root, SName.document, skinParam.getUmlDiagramType().getStyleName(), SName.legend)
|
||||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||||
return style.createTextBlockBordered(note, skinParam.getIHtmlColorSet(), skinParam);
|
return style.createTextBlockBordered(note, skinParam.getIHtmlColorSet(), skinParam, Style.ID_LEGEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -321,9 +321,9 @@ public class Snake implements UShape {
|
|||||||
|
|
||||||
if (same(this.getLast(), other.getFirst())) {
|
if (same(this.getLast(), other.getFirst())) {
|
||||||
final UPolygon oneOf = other.endDecoration == null ? endDecoration : other.endDecoration;
|
final UPolygon oneOf = other.endDecoration == null ? endDecoration : other.endDecoration;
|
||||||
if (this.startDecoration != null || other.startDecoration != null) {
|
if (this.startDecoration != null || other.startDecoration != null)
|
||||||
throw new UnsupportedOperationException("Not yet coded: to be done");
|
throw new UnsupportedOperationException("Not yet coded: to be done");
|
||||||
}
|
|
||||||
final ArrayList<Text> mergeTexts = new ArrayList<Text>(this.texts);
|
final ArrayList<Text> mergeTexts = new ArrayList<Text>(this.texts);
|
||||||
mergeTexts.addAll(other.texts);
|
mergeTexts.addAll(other.texts);
|
||||||
final Snake result = new Snake(skinParam, null, color, oneOf, this.worm.merge(other.worm, strategy),
|
final Snake result = new Snake(skinParam, null, color, oneOf, this.worm.merge(other.worm, strategy),
|
||||||
|
@ -57,7 +57,6 @@ import net.sourceforge.plantuml.creole.SheetBlock1;
|
|||||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||||
import net.sourceforge.plantuml.creole.Stencil;
|
import net.sourceforge.plantuml.creole.Stencil;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||||
@ -135,23 +134,6 @@ public class FtileBoxOld extends AbstractFtile {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FtileBoxOld create(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle,
|
|
||||||
Stereotype stereotype) {
|
|
||||||
final Style style = getDefaultStyleDefinitionActivity().withTOBECHANGED(stereotype)
|
|
||||||
.getMergedStyle(skinParam.getCurrentStyleBuilder());
|
|
||||||
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
|
||||||
|
|
||||||
return new FtileBoxOld(skinParam, label, swimlane, boxStyle, style, styleArrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TextBlock createWbs(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
|
|
||||||
StyleSignatureBasic styleDefinition) {
|
|
||||||
final Style style = styleDefinition.getMergedStyle(styleBuilder);
|
|
||||||
final Style styleArrow = style;
|
|
||||||
|
|
||||||
return new FtileBoxOld(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TextBlock createWbs(Style style, ISkinParam skinParam, Display label) {
|
public static TextBlock createWbs(Style style, ISkinParam skinParam, Display label) {
|
||||||
final Style styleArrow = style;
|
final Style styleArrow = style;
|
||||||
return new FtileBoxOld(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
return new FtileBoxOld(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
|
||||||
@ -232,8 +214,7 @@ public class FtileBoxOld extends AbstractFtile {
|
|||||||
tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - tbWidth(stringBounder) - padding.getRight(),
|
tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - tbWidth(stringBounder) - padding.getRight(),
|
||||||
padding.getBottom())));
|
padding.getBottom())));
|
||||||
else if (horizontalAlignment == HorizontalAlignment.CENTER)
|
else if (horizontalAlignment == HorizontalAlignment.CENTER)
|
||||||
tb.drawU(ug.apply(new UTranslate(padding.getRight() + (dimTotal.getWidth() - tbWidth(stringBounder)) / 2,
|
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - tbWidth(stringBounder)) / 2, padding.getBottom())));
|
||||||
padding.getBottom())));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
|||||||
private static IRegex getRegexConcat() {
|
private static IRegex getRegexConcat() {
|
||||||
return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), //
|
return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), //
|
||||||
new RegexLeaf("TYPE", //
|
new RegexLeaf("TYPE", //
|
||||||
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond|protocol|struct)"), //
|
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond|protocol|struct|exception)"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexOr(//
|
new RegexOr(//
|
||||||
new RegexConcat(//
|
new RegexConcat(//
|
||||||
|
@ -92,7 +92,8 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
private static IRegex getRegexConcat() {
|
private static IRegex getRegexConcat() {
|
||||||
return RegexConcat.build(CommandCreateClassMultilines.class.getName(), RegexLeaf.start(), //
|
return RegexConcat.build(CommandCreateClassMultilines.class.getName(), RegexLeaf.start(), //
|
||||||
new RegexLeaf("VISIBILITY", "(" + VisibilityModifier.regexForVisibilityCharacterInClassName() + ")?"), //
|
new RegexLeaf("VISIBILITY", "(" + VisibilityModifier.regexForVisibilityCharacterInClassName() + ")?"), //
|
||||||
new RegexLeaf("TYPE", "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct)"), //
|
new RegexLeaf("TYPE",
|
||||||
|
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct|exception)"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexOr(//
|
new RegexOr(//
|
||||||
new RegexConcat(//
|
new RegexConcat(//
|
||||||
@ -147,9 +148,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
lines = lines.trimSmart(1);
|
lines = lines.trimSmart(1);
|
||||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||||
final IEntity entity = executeArg0(diagram, line0);
|
final IEntity entity = executeArg0(diagram, line0);
|
||||||
if (entity == null) {
|
if (entity == null)
|
||||||
return CommandExecutionResult.error("No such entity");
|
return CommandExecutionResult.error("No such entity");
|
||||||
}
|
|
||||||
if (lines.size() > 1) {
|
if (lines.size() > 1) {
|
||||||
entity.setCodeLine(lines.getAt(0).getLocation());
|
entity.setCodeLine(lines.getAt(0).getLocation());
|
||||||
lines = lines.subExtract(1, 1);
|
lines = lines.subExtract(1, 1);
|
||||||
@ -165,9 +166,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
// lines = lines.subExtract(1, 0);
|
// lines = lines.subExtract(1, 0);
|
||||||
// }
|
// }
|
||||||
for (StringLocated s : lines) {
|
for (StringLocated s : lines) {
|
||||||
if (s.getString().length() > 0 && VisibilityModifier.isVisibilityCharacter(s.getString())) {
|
if (s.getString().length() > 0 && VisibilityModifier.isVisibilityCharacter(s.getString()))
|
||||||
diagram.setVisibilityModifierPresent(true);
|
diagram.setVisibilityModifierPresent(true);
|
||||||
}
|
|
||||||
entity.getBodier().addFieldOrMethod(s.getString());
|
entity.getBodier().addFieldOrMethod(s.getString());
|
||||||
}
|
}
|
||||||
// if (url != null) {
|
// if (url != null) {
|
||||||
@ -183,9 +184,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addTags(IEntity entity, String tags) {
|
public static void addTags(IEntity entity, String tags) {
|
||||||
if (tags == null) {
|
if (tags == null)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
for (String tag : tags.split("[ ]+")) {
|
for (String tag : tags.split("[ ]+")) {
|
||||||
assert tag.startsWith("$");
|
assert tag.startsWith("$");
|
||||||
tag = tag.substring(1);
|
tag = tag.substring(1);
|
||||||
@ -197,12 +198,12 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
if (arg.get(keyword, 0) != null) {
|
if (arg.get(keyword, 0) != null) {
|
||||||
final Mode mode = arg.get(keyword, 0).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;
|
final Mode mode = arg.get(keyword, 0).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;
|
||||||
LeafType type2 = LeafType.CLASS;
|
LeafType type2 = LeafType.CLASS;
|
||||||
if (mode == Mode.IMPLEMENTS) {
|
if (mode == Mode.IMPLEMENTS)
|
||||||
type2 = LeafType.INTERFACE;
|
type2 = LeafType.INTERFACE;
|
||||||
}
|
|
||||||
if (mode == Mode.EXTENDS && entity.getLeafType() == LeafType.INTERFACE) {
|
if (mode == Mode.EXTENDS && entity.getLeafType() == LeafType.INTERFACE)
|
||||||
type2 = LeafType.INTERFACE;
|
type2 = LeafType.INTERFACE;
|
||||||
}
|
|
||||||
final String codes = arg.get(keyword, 1);
|
final String codes = arg.get(keyword, 1);
|
||||||
for (String s : codes.split(",")) {
|
for (String s : codes.split(",")) {
|
||||||
final String idShort = StringUtils.trin(s);
|
final String idShort = StringUtils.trin(s);
|
||||||
@ -210,9 +211,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
final Code other = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
final Code other = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||||
final IEntity cl2 = diagram.getOrCreateLeaf(ident, other, type2, null);
|
final IEntity cl2 = diagram.getOrCreateLeaf(ident, other, type2, null);
|
||||||
LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS);
|
LinkType typeLink = new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS);
|
||||||
if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE) {
|
if (type2 == LeafType.INTERFACE && entity.getLeafType() != LeafType.INTERFACE)
|
||||||
typeLink = typeLink.goDashed();
|
typeLink = typeLink.goDashed();
|
||||||
}
|
|
||||||
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null,
|
final Link link = new Link(cl2, entity, typeLink, Display.NULL, 2, null, null,
|
||||||
diagram.getLabeldistance(), diagram.getLabelangle(),
|
diagram.getLabeldistance(), diagram.getLabelangle(),
|
||||||
diagram.getSkinParam().getCurrentStyleBuilder());
|
diagram.getSkinParam().getCurrentStyleBuilder());
|
||||||
@ -221,24 +222,23 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEntity executeArg0(ClassDiagram diagram, RegexResult arg) throws NoSuchColorException {
|
private IEntity executeArg0(ClassDiagram diagram, RegexResult line0) throws NoSuchColorException {
|
||||||
|
|
||||||
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
|
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(line0.get("TYPE", 0)));
|
||||||
final String visibilityString = arg.get("VISIBILITY", 0);
|
final String visibilityString = line0.get("VISIBILITY", 0);
|
||||||
VisibilityModifier visibilityModifier = null;
|
VisibilityModifier visibilityModifier = null;
|
||||||
if (visibilityString != null) {
|
if (visibilityString != null)
|
||||||
visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false);
|
visibilityModifier = VisibilityModifier.getVisibilityModifier(visibilityString + "FOO", false);
|
||||||
}
|
|
||||||
|
|
||||||
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0),
|
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.getLazzy("CODE", 0),
|
||||||
"\"([:");
|
"\"([:");
|
||||||
final Ident ident = diagram.buildLeafIdent(idShort);
|
final Ident ident = diagram.buildLeafIdent(idShort);
|
||||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||||
final String display = arg.getLazzy("DISPLAY", 0);
|
final String display = line0.getLazzy("DISPLAY", 0);
|
||||||
final String genericOption = arg.getLazzy("DISPLAY", 1);
|
final String genericOption = line0.getLazzy("DISPLAY", 1);
|
||||||
final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
|
final String generic = genericOption != null ? genericOption : line0.get("GENERIC", 0);
|
||||||
|
|
||||||
final String stereotype = arg.get("STEREO", 0);
|
final String stereotype = line0.get("STEREO", 0);
|
||||||
|
|
||||||
/* final */ILeaf result;
|
/* final */ILeaf result;
|
||||||
if (diagram.V1972()) {
|
if (diagram.V1972()) {
|
||||||
@ -246,18 +246,18 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
// result = diagram.getOrCreateLeaf(ident, code, null, null);
|
// result = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||||
diagram.setLastEntity(result);
|
diagram.setLastEntity(result);
|
||||||
if (result.muteToType(type, null) == false) {
|
if (result.muteToType(type, null) == false)
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
|
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (diagram.leafExist(code)) {
|
if (diagram.leafExist(code)) {
|
||||||
result = diagram.getOrCreateLeaf(ident, code, null, null);
|
result = diagram.getOrCreateLeaf(ident, code, null, null);
|
||||||
if (result.muteToType(type, null) == false) {
|
if (result.muteToType(type, null) == false)
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
|
result = diagram.createLeaf(ident, code, Display.getWithNewlines(display), type, null);
|
||||||
}
|
}
|
||||||
@ -269,38 +269,30 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
|||||||
diagram.getSkinParam().getIHtmlColorSet()));
|
diagram.getSkinParam().getIHtmlColorSet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
final String urlString = arg.get("URL", 0);
|
final String urlString = line0.get("URL", 0);
|
||||||
if (urlString != null) {
|
if (urlString != null) {
|
||||||
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
|
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
|
||||||
final Url url = urlBuilder.getUrl(urlString);
|
final Url url = urlBuilder.getUrl(urlString);
|
||||||
result.addUrl(url);
|
result.addUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
|
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
|
||||||
diagram.getSkinParam().getIHtmlColorSet());
|
diagram.getSkinParam().getIHtmlColorSet());
|
||||||
final String s = arg.get("LINECOLOR", 1);
|
final String s = line0.get("LINECOLOR", 1);
|
||||||
|
|
||||||
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 (line0.get("LINECOLOR", 0) != null)
|
||||||
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
|
colors = colors.addLegacyStroke(line0.get("LINECOLOR", 0));
|
||||||
}
|
|
||||||
result.setColors(colors);
|
result.setColors(colors);
|
||||||
|
|
||||||
// result.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
if (generic != null)
|
||||||
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
|
|
||||||
// 0)));
|
|
||||||
// result.setSpecificColorTOBEREMOVED(ColorType.LINE,
|
|
||||||
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR",
|
|
||||||
// 1)));
|
|
||||||
// result.applyStroke(arg.get("LINECOLOR", 0));
|
|
||||||
|
|
||||||
if (generic != null) {
|
|
||||||
result.setGeneric(generic);
|
result.setGeneric(generic);
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
gender = EntityGenderUtils.byEntityType(LeafType.PROTOCOL);
|
gender = EntityGenderUtils.byEntityType(LeafType.PROTOCOL);
|
||||||
} else if (arg1.equalsIgnoreCase("struct")) {
|
} else if (arg1.equalsIgnoreCase("struct")) {
|
||||||
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
|
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
|
||||||
|
} else if (arg1.equalsIgnoreCase("exception")) {
|
||||||
|
gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION);
|
||||||
} else if (arg1.startsWith("<<")) {
|
} else if (arg1.startsWith("<<")) {
|
||||||
gender = EntityGenderUtils.byStereotype(arg1);
|
gender = EntityGenderUtils.byStereotype(arg1);
|
||||||
} else {
|
} else {
|
||||||
@ -171,6 +173,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
gender = EntityGenderUtils.byEntityType(LeafType.PROTOCOL);
|
gender = EntityGenderUtils.byEntityType(LeafType.PROTOCOL);
|
||||||
} else if (arg1.equalsIgnoreCase("struct")) {
|
} else if (arg1.equalsIgnoreCase("struct")) {
|
||||||
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
|
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
|
||||||
|
} else if (arg1.equalsIgnoreCase("exception")) {
|
||||||
|
gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION);
|
||||||
} else if (arg1.startsWith("<<")) {
|
} else if (arg1.startsWith("<<")) {
|
||||||
gender = EntityGenderUtils.byStereotype(arg1);
|
gender = EntityGenderUtils.byStereotype(arg1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +95,7 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
|
|||||||
|
|
||||||
private static String optionalKeywords(UmlDiagramType type) {
|
private static String optionalKeywords(UmlDiagramType type) {
|
||||||
if (type == UmlDiagramType.CLASS) {
|
if (type == UmlDiagramType.CLASS) {
|
||||||
return "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct)";
|
return "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct|exception)";
|
||||||
}
|
}
|
||||||
if (type == UmlDiagramType.OBJECT) {
|
if (type == UmlDiagramType.OBJECT) {
|
||||||
return "(object)";
|
return "(object)";
|
||||||
|
@ -72,15 +72,15 @@ public abstract class CommandMultilines<S extends Diagram> implements Command<S>
|
|||||||
if (m1.matches() == false)
|
if (m1.matches() == false)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
|
|
||||||
actionIfCommandValid();
|
return finalVerification();
|
||||||
return CommandControl.OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isCommandForbidden() {
|
protected boolean isCommandForbidden() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actionIfCommandValid() {
|
protected CommandControl finalVerification() {
|
||||||
|
return CommandControl.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Pattern2 getStartingPattern() {
|
protected final Pattern2 getStartingPattern() {
|
||||||
|
@ -96,8 +96,7 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
|
|||||||
if (m1.matches() == false)
|
if (m1.matches() == false)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
|
|
||||||
actionIfCommandValid();
|
return finalVerification(lines);
|
||||||
return CommandControl.OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
||||||
@ -118,7 +117,8 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actionIfCommandValid() {
|
protected CommandControl finalVerification(BlocLines lines) {
|
||||||
|
return CommandControl.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final IRegex getStartingPattern() {
|
protected final IRegex getStartingPattern() {
|
||||||
|
@ -81,8 +81,7 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
|
|||||||
if (m1 == false)
|
if (m1 == false)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
|
|
||||||
actionIfCommandValid();
|
return finalVerification();
|
||||||
return CommandControl.OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
||||||
@ -96,7 +95,8 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actionIfCommandValid() {
|
protected CommandControl finalVerification() {
|
||||||
|
return CommandControl.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final IRegex getStartingPattern() {
|
protected final IRegex getStartingPattern() {
|
||||||
|
@ -60,7 +60,8 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
|
|||||||
return new String[] { "BRACKET: " + starting.pattern() };
|
return new String[] { "BRACKET: " + starting.pattern() };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actionIfCommandValid() {
|
protected CommandControl finalVerification() {
|
||||||
|
return CommandControl.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Pattern2 getStartingPattern() {
|
protected final Pattern2 getStartingPattern() {
|
||||||
@ -98,8 +99,7 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
|
|||||||
if (level != 0)
|
if (level != 0)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
|
|
||||||
actionIfCommandValid();
|
return finalVerification();
|
||||||
return CommandControl.OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean isLineConsistent(String line, int level);
|
protected abstract boolean isLineConsistent(String line, int level);
|
||||||
|
@ -104,9 +104,9 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
|
|||||||
|
|
||||||
final boolean result = pattern.match(line2);
|
final boolean result = pattern.match(line2);
|
||||||
if (result)
|
if (result)
|
||||||
actionIfCommandValid();
|
return finalVerification();
|
||||||
|
|
||||||
return result ? CommandControl.OK : CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandControl isValidBracket(BlocLines lines) {
|
private CommandControl isValidBracket(BlocLines lines) {
|
||||||
@ -123,7 +123,8 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void actionIfCommandValid() {
|
protected CommandControl finalVerification() {
|
||||||
|
return CommandControl.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
||||||
|
@ -91,7 +91,7 @@ public abstract class MyPattern {
|
|||||||
p = p.replace("%pLN", "\\p{L}0-9"); // Unicode Letter, digit
|
p = p.replace("%pLN", "\\p{L}0-9"); // Unicode Letter, digit
|
||||||
p = p.replace("%s", "\\s\u00A0"); // space
|
p = p.replace("%s", "\\s\u00A0"); // space
|
||||||
p = p.replace("%q", "'\u2018\u2019"); // quote
|
p = p.replace("%q", "'\u2018\u2019"); // quote
|
||||||
p = p.replace("%g", "\"\u201c\u201d\u00ab\u00bb"); // double quote
|
p = p.replace("%g", "\"\u201c\u201d"); // double quote
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public class AtomImg extends AbstractAtom implements Atom {
|
|||||||
try {
|
try {
|
||||||
final byte bytes[] = Base64Coder.decode(data);
|
final byte bytes[] = Base64Coder.decode(data);
|
||||||
final String tmp = new String(bytes);
|
final String tmp = new String(bytes);
|
||||||
return new AtomImgSvg(new TileImageSvg(tmp));
|
return new AtomImgSvg(new TileImageSvg(tmp, scale));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc);
|
return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc);
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ public class AtomImg extends AbstractAtom implements Atom {
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
return AtomTextUtils.createLegacy("(Cannot decode)", fc);
|
return AtomTextUtils.createLegacy("(Cannot decode)", fc);
|
||||||
|
|
||||||
return new AtomImgSvg(new TileImageSvg(tmp));
|
return new AtomImgSvg(new TileImageSvg(tmp, scale));
|
||||||
}
|
}
|
||||||
final BufferedImage read = f.readRasterImageFromFile();
|
final BufferedImage read = f.readRasterImageFromFile();
|
||||||
if (read == null) {
|
if (read == null) {
|
||||||
@ -186,7 +186,7 @@ public class AtomImg extends AbstractAtom implements Atom {
|
|||||||
if (read == null) {
|
if (read == null) {
|
||||||
return AtomTextUtils.createLegacy("(Cannot decode SVG: " + text + ")", fc);
|
return AtomTextUtils.createLegacy("(Cannot decode SVG: " + text + ")", fc);
|
||||||
}
|
}
|
||||||
return new AtomImgSvg(new TileImageSvg(new String(read, UTF_8)));
|
return new AtomImgSvg(new TileImageSvg(new String(read, UTF_8), scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
|
@ -132,8 +132,9 @@ public class CreoleParser implements SheetBuilder {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else if (cs instanceof Stereotype) {
|
} else if (cs instanceof Stereotype) {
|
||||||
for (String st : ((Stereotype) cs).getLabels(skinParam.guillemet()))
|
if (display.showStereotype())
|
||||||
sheet.add(createStripe(st, context, sheet.getLastStripe(), stereotype));
|
for (String st : ((Stereotype) cs).getLabels(skinParam.guillemet()))
|
||||||
|
sheet.add(createStripe(st, context, sheet.getLastStripe(), stereotype));
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,6 +77,8 @@ import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
|||||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
|
import net.sourceforge.plantuml.style.Value;
|
||||||
|
import net.sourceforge.plantuml.style.ValueNull;
|
||||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
@ -88,27 +90,24 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
private final HorizontalAlignment naturalHorizontalAlignment;
|
private final HorizontalAlignment naturalHorizontalAlignment;
|
||||||
private final boolean isNull;
|
private final boolean isNull;
|
||||||
private final CreoleMode defaultCreoleMode;
|
private final CreoleMode defaultCreoleMode;
|
||||||
|
private final boolean showStereotype;
|
||||||
|
|
||||||
public final static Display NULL = new Display(null, null, true, CreoleMode.FULL);
|
public final static Display NULL = new Display(true, null, null, true, CreoleMode.FULL);
|
||||||
|
|
||||||
|
public boolean showStereotype() {
|
||||||
|
return showStereotype;
|
||||||
|
}
|
||||||
|
|
||||||
public Display withoutStereotypeIfNeeded(Style usedStyle) {
|
public Display withoutStereotypeIfNeeded(Style usedStyle) {
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
final boolean showStereotype = usedStyle.value(PName.ShowStereotype).asBoolean();
|
final Value showStereotype = usedStyle.value(PName.ShowStereotype);
|
||||||
if (showStereotype)
|
if (showStereotype instanceof ValueNull || showStereotype.asBoolean())
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
final List<CharSequence> copy = new ArrayList<>(displayData);
|
return new Display(false, this, this.defaultCreoleMode);
|
||||||
final Display result = new Display(naturalHorizontalAlignment, isNull, defaultCreoleMode);
|
|
||||||
for (Iterator<CharSequence> it = copy.iterator(); it.hasNext();) {
|
|
||||||
final CharSequence cs = it.next();
|
|
||||||
if (cs instanceof Stereotype && usedStyle.getSignature().match(((Stereotype) cs)))
|
|
||||||
it.remove();
|
|
||||||
|
|
||||||
}
|
|
||||||
result.displayData.addAll(copy);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stereotype getStereotypeIfAny() {
|
public Stereotype getStereotypeIfAny() {
|
||||||
@ -121,7 +120,7 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Display replaceBackslashT() {
|
public Display replaceBackslashT() {
|
||||||
final Display result = new Display(this, defaultCreoleMode);
|
final Display result = new Display(this.showStereotype, this, defaultCreoleMode);
|
||||||
for (int i = 0; i < result.displayData.size(); i++) {
|
for (int i = 0; i < result.displayData.size(); i++) {
|
||||||
final CharSequence s = displayData.get(i);
|
final CharSequence s = displayData.get(i);
|
||||||
if (s.toString().contains("\\t"))
|
if (s.toString().contains("\\t"))
|
||||||
@ -138,7 +137,7 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
|
|
||||||
newDisplay.add(cs);
|
newDisplay.add(cs);
|
||||||
}
|
}
|
||||||
return new Display(newDisplay, naturalHorizontalAlignment, isNull, defaultCreoleMode);
|
return new Display(showStereotype, newDisplay, naturalHorizontalAlignment, isNull, defaultCreoleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWhite() {
|
public boolean isWhite() {
|
||||||
@ -147,7 +146,7 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Display empty() {
|
public static Display empty() {
|
||||||
return new Display((HorizontalAlignment) null, false, CreoleMode.FULL);
|
return new Display(true, (HorizontalAlignment) null, false, CreoleMode.FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Display create(CharSequence... s) {
|
public static Display create(CharSequence... s) {
|
||||||
@ -165,7 +164,7 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Display create(Collection<? extends CharSequence> other) {
|
public static Display create(Collection<? extends CharSequence> other) {
|
||||||
return new Display(other, null, false, CreoleMode.FULL);
|
return new Display(true, other, null, false, CreoleMode.FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Display getWithNewlines(Code s) {
|
public static Display getWithNewlines(Code s) {
|
||||||
@ -221,24 +220,26 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.add(current.toString());
|
result.add(current.toString());
|
||||||
return new Display(result, naturalHorizontalAlignment, false, CreoleMode.FULL);
|
return new Display(true, result, naturalHorizontalAlignment, false, CreoleMode.FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Display(Display other, CreoleMode mode) {
|
private Display(boolean showStereotype, Display other, CreoleMode mode) {
|
||||||
this(other.naturalHorizontalAlignment, other.isNull, mode);
|
this(showStereotype, other.naturalHorizontalAlignment, other.isNull, mode);
|
||||||
this.displayData.addAll(other.displayData);
|
this.displayData.addAll(other.displayData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Display(HorizontalAlignment naturalHorizontalAlignment, boolean isNull, CreoleMode defaultCreoleMode) {
|
private Display(boolean showStereotype, HorizontalAlignment naturalHorizontalAlignment, boolean isNull,
|
||||||
|
CreoleMode defaultCreoleMode) {
|
||||||
|
this.showStereotype = showStereotype;
|
||||||
this.defaultCreoleMode = defaultCreoleMode;
|
this.defaultCreoleMode = defaultCreoleMode;
|
||||||
this.isNull = isNull;
|
this.isNull = isNull;
|
||||||
this.displayData = isNull ? null : new ArrayList<CharSequence>();
|
this.displayData = isNull ? null : new ArrayList<CharSequence>();
|
||||||
this.naturalHorizontalAlignment = isNull ? null : naturalHorizontalAlignment;
|
this.naturalHorizontalAlignment = isNull ? null : naturalHorizontalAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Display(Collection<? extends CharSequence> other, HorizontalAlignment naturalHorizontalAlignment,
|
private Display(boolean showStereotype, Collection<? extends CharSequence> other,
|
||||||
boolean isNull, CreoleMode defaultCreoleMode) {
|
HorizontalAlignment naturalHorizontalAlignment, boolean isNull, CreoleMode defaultCreoleMode) {
|
||||||
this(naturalHorizontalAlignment, isNull, defaultCreoleMode);
|
this(showStereotype, naturalHorizontalAlignment, isNull, defaultCreoleMode);
|
||||||
if (isNull == false)
|
if (isNull == false)
|
||||||
this.displayData.addAll(manageEmbeddedDiagrams(other));
|
this.displayData.addAll(manageEmbeddedDiagrams(other));
|
||||||
|
|
||||||
@ -284,7 +285,8 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
|
||||||
|
this.defaultCreoleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display withPage(int page, int lastpage) {
|
public Display withPage(int page, int lastpage) {
|
||||||
@ -297,7 +299,8 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
line = line.toString().replace("%lastpage%", "" + lastpage);
|
line = line.toString().replace("%lastpage%", "" + lastpage);
|
||||||
result.add(line);
|
result.add(line);
|
||||||
}
|
}
|
||||||
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
|
||||||
|
this.defaultCreoleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display removeEndingStereotype() {
|
public Display removeEndingStereotype() {
|
||||||
@ -305,7 +308,8 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
final List<CharSequence> result = new ArrayList<>(this.displayData);
|
final List<CharSequence> result = new ArrayList<>(this.displayData);
|
||||||
result.set(result.size() - 1, m.group(1));
|
result.set(result.size() - 1, m.group(1));
|
||||||
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
|
||||||
|
this.defaultCreoleMode);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -325,7 +329,8 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
for (CharSequence line : displayData)
|
for (CharSequence line : displayData)
|
||||||
result.add("<u>" + line);
|
result.add("<u>" + line);
|
||||||
|
|
||||||
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
|
||||||
|
this.defaultCreoleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display underlinedName() {
|
public Display underlinedName() {
|
||||||
@ -342,14 +347,15 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
result.add("<u>" + line);
|
result.add("<u>" + line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
return new Display(showStereotype, result, this.naturalHorizontalAlignment, this.isNull,
|
||||||
|
this.defaultCreoleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display withCreoleMode(CreoleMode mode) {
|
public Display withCreoleMode(CreoleMode mode) {
|
||||||
if (isNull)
|
if (isNull)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
|
||||||
return new Display(this, mode);
|
return new Display(this.showStereotype, this, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -371,25 +377,25 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Display addAll(Display other) {
|
public Display addAll(Display other) {
|
||||||
final Display result = new Display(this, this.defaultCreoleMode);
|
final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
|
||||||
result.displayData.addAll(other.displayData);
|
result.displayData.addAll(other.displayData);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display addFirst(CharSequence s) {
|
public Display addFirst(CharSequence s) {
|
||||||
final Display result = new Display(this, this.defaultCreoleMode);
|
final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
|
||||||
result.displayData.add(0, s);
|
result.displayData.add(0, s);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display add(CharSequence s) {
|
public Display add(CharSequence s) {
|
||||||
final Display result = new Display(this, this.defaultCreoleMode);
|
final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
|
||||||
result.displayData.add(s);
|
result.displayData.add(s);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Display addGeneric(CharSequence s) {
|
public Display addGeneric(CharSequence s) {
|
||||||
final Display result = new Display(this, this.defaultCreoleMode);
|
final Display result = new Display(this.showStereotype, this, this.defaultCreoleMode);
|
||||||
final int size = displayData.size();
|
final int size = displayData.size();
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
result.displayData.add("<" + s + ">");
|
result.displayData.add("<" + s + ">");
|
||||||
@ -415,7 +421,7 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Display subList(int i, int size) {
|
public Display subList(int i, int size) {
|
||||||
return new Display(displayData.subList(i, size), this.naturalHorizontalAlignment, this.isNull,
|
return new Display(showStereotype, displayData.subList(i, size), this.naturalHorizontalAlignment, this.isNull,
|
||||||
this.defaultCreoleMode);
|
this.defaultCreoleMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +454,8 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
|
|
||||||
public List<Display> splitMultiline(Pattern2 separator) {
|
public List<Display> splitMultiline(Pattern2 separator) {
|
||||||
final List<Display> result = new ArrayList<>();
|
final List<Display> result = new ArrayList<>();
|
||||||
Display pending = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
Display pending = new Display(showStereotype, this.naturalHorizontalAlignment, this.isNull,
|
||||||
|
this.defaultCreoleMode);
|
||||||
result.add(pending);
|
result.add(pending);
|
||||||
for (CharSequence line : displayData) {
|
for (CharSequence line : displayData) {
|
||||||
final Matcher2 m = separator.matcher(line);
|
final Matcher2 m = separator.matcher(line);
|
||||||
@ -456,7 +463,8 @@ public class Display implements Iterable<CharSequence> {
|
|||||||
final CharSequence s1 = line.subSequence(0, m.start());
|
final CharSequence s1 = line.subSequence(0, m.start());
|
||||||
pending.displayData.add(s1);
|
pending.displayData.add(s1);
|
||||||
final CharSequence s2 = line.subSequence(m.end(), line.length());
|
final CharSequence s2 = line.subSequence(m.end(), line.length());
|
||||||
pending = new Display(this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode);
|
pending = new Display(showStereotype, this.naturalHorizontalAlignment, this.isNull,
|
||||||
|
this.defaultCreoleMode);
|
||||||
result.add(pending);
|
result.add(pending);
|
||||||
pending.displayData.add(s2);
|
pending.displayData.add(s2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +95,7 @@ public class DisplaySection {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (style != null)
|
if (style != null)
|
||||||
return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer);
|
return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer, null);
|
||||||
|
|
||||||
return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer);
|
return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,11 @@ class Elected {
|
|||||||
private final String shortName;
|
private final String shortName;
|
||||||
private final int score;
|
private final int score;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return shortName + "/" + score;
|
||||||
|
}
|
||||||
|
|
||||||
public Elected(String shortName, int score) {
|
public Elected(String shortName, int score) {
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
this.score = score;
|
this.score = score;
|
||||||
|
@ -48,9 +48,9 @@ public class EntityPort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getFullString() {
|
public String getFullString() {
|
||||||
if (portId != null) {
|
if (portId != null)
|
||||||
return entityUid + ":" + portId;
|
return entityUid + ":" + portId;
|
||||||
}
|
|
||||||
return entityUid;
|
return entityUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,9 +59,9 @@ public class EntityPort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
if (isShielded()) {
|
if (isShielded())
|
||||||
return entityUid.substring(0, entityUid.length() - 2);
|
return entityUid.substring(0, entityUid.length() - 2);
|
||||||
}
|
|
||||||
return entityUid;
|
return entityUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ public enum LeafType {
|
|||||||
|
|
||||||
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION,
|
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION,
|
||||||
PROTOCOL, STRUCT,
|
PROTOCOL, STRUCT,
|
||||||
|
EXCEPTION,
|
||||||
LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, JSON, ASSOCIATION,
|
LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, JSON, ASSOCIATION,
|
||||||
ENUM, CIRCLE,
|
ENUM, CIRCLE,
|
||||||
|
|
||||||
@ -78,8 +79,8 @@ public enum LeafType {
|
|||||||
|
|
||||||
public boolean isLikeClass() {
|
public boolean isLikeClass() {
|
||||||
return this == LeafType.ANNOTATION || this == LeafType.ABSTRACT_CLASS || this == LeafType.CLASS
|
return this == LeafType.ANNOTATION || this == LeafType.ABSTRACT_CLASS || this == LeafType.CLASS
|
||||||
|| this == LeafType.INTERFACE || this == LeafType.ENUM || this == LeafType.ENTITY
|
|| this == LeafType.INTERFACE || this == LeafType.ENUM || this == LeafType.ENTITY
|
||||||
|| this == LeafType.PROTOCOL || this == LeafType.STRUCT;
|
|| this == LeafType.PROTOCOL || this == LeafType.STRUCT || this == LeafType.EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toHtml() {
|
public String toHtml() {
|
||||||
|
@ -36,8 +36,11 @@
|
|||||||
package net.sourceforge.plantuml.cucadiagram;
|
package net.sourceforge.plantuml.cucadiagram;
|
||||||
|
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.EmbeddedDiagram;
|
import net.sourceforge.plantuml.EmbeddedDiagram;
|
||||||
@ -130,21 +133,37 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
|||||||
return new Dimension2DDouble(x, y);
|
return new Dimension2DDouble(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Collection<String> sortBySize(Collection<String> all) {
|
||||||
|
final List<String> result = new ArrayList<String>(all);
|
||||||
|
Collections.sort(result, new Comparator<String>() {
|
||||||
|
@Override
|
||||||
|
public int compare(String s1, String s2) {
|
||||||
|
final int diff = s2.length() - s1.length();
|
||||||
|
if (diff != 0)
|
||||||
|
return diff;
|
||||||
|
return s1.compareTo(s2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Ports getPorts(StringBounder stringBounder) {
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
final Ports result = new Ports();
|
final Ports ports = new Ports();
|
||||||
double y = 0;
|
double y = 0;
|
||||||
|
|
||||||
|
final Collection<String> shortNames = sortBySize(leaf.getPortShortNames());
|
||||||
|
|
||||||
for (CharSequence cs : members) {
|
for (CharSequence cs : members) {
|
||||||
final TextBlock bloc = createTextBlock(cs);
|
final TextBlock bloc = createTextBlock(cs);
|
||||||
final Dimension2D dim = bloc.calculateDimension(stringBounder);
|
final Dimension2D dim = bloc.calculateDimension(stringBounder);
|
||||||
final Elected port = getElected(leaf.getPortShortNames(), convert(cs));
|
final Elected elected = getElected(convert(cs), shortNames);
|
||||||
if (port != null)
|
if (elected != null)
|
||||||
result.add(port.getShortName(), port.getScore(), y, dim.getHeight());
|
ports.add(elected.getShortName(), elected.getScore(), y, dim.getHeight());
|
||||||
|
|
||||||
y += dim.getHeight();
|
y += dim.getHeight();
|
||||||
}
|
}
|
||||||
return result;
|
return ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String convert(CharSequence cs) {
|
private String convert(CharSequence cs) {
|
||||||
@ -153,16 +172,16 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock,
|
|||||||
return cs.toString();
|
return cs.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Elected getElected(Collection<String> shortNames, String cs) {
|
public Elected getElected(String cs, Collection<String> shortNames) {
|
||||||
for (String shortName : new HashSet<>(shortNames)) {
|
for (String shortName : shortNames) {
|
||||||
final int score = getScore(shortName, cs);
|
final int score = getScore(cs, shortName);
|
||||||
if (score > 0)
|
if (score > 0)
|
||||||
return new Elected(shortName, score);
|
return new Elected(shortName, score);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getScore(String shortName, String cs) {
|
private int getScore(String cs, String shortName) {
|
||||||
if (cs.matches(".*\\b" + shortName + "\\b.*"))
|
if (cs.matches(".*\\b" + shortName + "\\b.*"))
|
||||||
return 100;
|
return 100;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ public class GraphvizUtils {
|
|||||||
if (s == null)
|
if (s == null)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
final Pattern p = Pattern.compile("\\s([23])\\.(\\d\\d?)\\D");
|
final Pattern p = Pattern.compile("\\s([23456])\\.(\\d\\d?)\\D");
|
||||||
final Matcher m = p.matcher(s);
|
final Matcher m = p.matcher(s);
|
||||||
if (m.find() == false)
|
if (m.find() == false)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -72,7 +72,7 @@ public class GraphvizVersionFinder {
|
|||||||
|
|
||||||
public GraphvizVersion getVersion() {
|
public GraphvizVersion getVersion() {
|
||||||
final String dotVersion = dotVersion();
|
final String dotVersion = dotVersion();
|
||||||
final Pattern p = Pattern.compile("([23])\\.(\\d\\d?)");
|
final Pattern p = Pattern.compile("([23456])\\.(\\d\\d?)");
|
||||||
final Matcher m = p.matcher(dotVersion);
|
final Matcher m = p.matcher(dotVersion);
|
||||||
final boolean find = m.find();
|
final boolean find = m.find();
|
||||||
if (find == false) {
|
if (find == false) {
|
||||||
|
@ -146,9 +146,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
private EntityImpl(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
|
private EntityImpl(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
|
||||||
String namespaceSeparator, int rawLayout) {
|
String namespaceSeparator, int rawLayout) {
|
||||||
this.ident = Objects.requireNonNull(ident);
|
this.ident = Objects.requireNonNull(ident);
|
||||||
if (entityFactory.namespaceSeparator.V1972()) {
|
if (entityFactory.namespaceSeparator.V1972())
|
||||||
code = ident;
|
code = ident;
|
||||||
}
|
|
||||||
this.code = Objects.requireNonNull(code);
|
this.code = Objects.requireNonNull(code);
|
||||||
this.entityFactory = entityFactory;
|
this.entityFactory = entityFactory;
|
||||||
this.bodier = bodier;
|
this.bodier = bodier;
|
||||||
@ -188,9 +188,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
checkNotGroup();
|
checkNotGroup();
|
||||||
Objects.requireNonNull(newType);
|
Objects.requireNonNull(newType);
|
||||||
if (leafType != LeafType.STILL_UNKNOWN) {
|
if (leafType != LeafType.STILL_UNKNOWN) {
|
||||||
if (newType == this.leafType) {
|
if (newType == this.leafType)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (leafType != LeafType.ANNOTATION && leafType != LeafType.ABSTRACT_CLASS && leafType != LeafType.CLASS
|
if (leafType != LeafType.ANNOTATION && leafType != LeafType.ABSTRACT_CLASS && leafType != LeafType.CLASS
|
||||||
&& leafType != LeafType.ENUM && leafType != LeafType.INTERFACE) {
|
&& leafType != LeafType.ENUM && leafType != LeafType.INTERFACE) {
|
||||||
return false;
|
return false;
|
||||||
@ -202,9 +202,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
// throw new IllegalArgumentException("newtype=" + newType);
|
// throw new IllegalArgumentException("newtype=" + newType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (leafType == LeafType.CLASS && newType == LeafType.OBJECT) {
|
if (leafType == LeafType.CLASS && newType == LeafType.OBJECT)
|
||||||
bodier.muteClassToObject();
|
bodier.muteClassToObject();
|
||||||
}
|
|
||||||
this.leafType = newType;
|
this.leafType = newType;
|
||||||
this.symbol = newSymbol;
|
this.symbol = newSymbol;
|
||||||
return true;
|
return true;
|
||||||
@ -223,9 +223,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Display getDisplay() {
|
public Display getDisplay() {
|
||||||
if (intricated) {
|
if (intricated)
|
||||||
return entityFactory.getIntricatedDisplay(ident);
|
return entityFactory.getIntricatedDisplay(ident);
|
||||||
}
|
|
||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,12 +266,12 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasUrl() {
|
public boolean hasUrl() {
|
||||||
if (Display.isNull(display) == false && display.hasUrl()) {
|
if (Display.isNull(display) == false && display.hasUrl())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (bodier.hasUrl()) {
|
if (bodier.hasUrl())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return url != null;
|
return url != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,25 +325,25 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
|
|
||||||
public EntityPosition getEntityPosition() {
|
public EntityPosition getEntityPosition() {
|
||||||
checkNotGroup();
|
checkNotGroup();
|
||||||
if (leafType == LeafType.PORT) {
|
if (leafType == LeafType.PORT)
|
||||||
return EntityPosition.PORT;
|
return EntityPosition.PORT;
|
||||||
}
|
|
||||||
if (leafType == LeafType.PORTIN) {
|
if (leafType == LeafType.PORTIN)
|
||||||
return EntityPosition.PORTIN;
|
return EntityPosition.PORTIN;
|
||||||
}
|
|
||||||
if (leafType == LeafType.PORTOUT) {
|
if (leafType == LeafType.PORTOUT)
|
||||||
return EntityPosition.PORTOUT;
|
return EntityPosition.PORTOUT;
|
||||||
}
|
|
||||||
if (leafType != LeafType.STATE) {
|
if (leafType != LeafType.STATE)
|
||||||
return EntityPosition.NORMAL;
|
return EntityPosition.NORMAL;
|
||||||
}
|
|
||||||
if (getParentContainer() instanceof GroupRoot) {
|
if (getParentContainer() instanceof GroupRoot)
|
||||||
return EntityPosition.NORMAL;
|
return EntityPosition.NORMAL;
|
||||||
}
|
|
||||||
final Stereotype stereotype = getStereotype();
|
final Stereotype stereotype = getStereotype();
|
||||||
if (stereotype == null) {
|
if (stereotype == null)
|
||||||
return EntityPosition.NORMAL;
|
return EntityPosition.NORMAL;
|
||||||
}
|
|
||||||
return EntityPosition.fromStereotype(stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
|
return EntityPosition.fromStereotype(stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -351,30 +351,29 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
// ----------
|
// ----------
|
||||||
|
|
||||||
private void checkGroup() {
|
private void checkGroup() {
|
||||||
if (isGroup() == false) {
|
if (isGroup() == false)
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkNotGroup() {
|
private void checkNotGroup() {
|
||||||
if (isGroup()) {
|
if (isGroup())
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsLeafRecurse(ILeaf leaf) {
|
public boolean containsLeafRecurse(ILeaf leaf) {
|
||||||
if (Objects.requireNonNull(leaf).isGroup()) {
|
if (Objects.requireNonNull(leaf).isGroup())
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
|
||||||
checkGroup();
|
checkGroup();
|
||||||
if (leaf.getParentContainer() == this) {
|
if (leaf.getParentContainer() == this)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
for (IGroup child : getChildren()) {
|
for (IGroup child : getChildren())
|
||||||
if (child.containsLeafRecurse(leaf)) {
|
if (child.containsLeafRecurse(leaf))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,12 +381,12 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
checkGroup();
|
checkGroup();
|
||||||
final List<ILeaf> result = new ArrayList<>();
|
final List<ILeaf> result = new ArrayList<>();
|
||||||
for (ILeaf ent : entityFactory.leafs()) {
|
for (ILeaf ent : entityFactory.leafs()) {
|
||||||
if (ent.isGroup()) {
|
if (ent.isGroup())
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
if (ent.getParentContainer() == this) {
|
if (ent.getParentContainer() == this)
|
||||||
result.add(ent);
|
result.add(ent);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Collections.unmodifiableCollection(result);
|
return Collections.unmodifiableCollection(result);
|
||||||
}
|
}
|
||||||
@ -395,11 +394,10 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
public Collection<IGroup> getChildren() {
|
public Collection<IGroup> getChildren() {
|
||||||
checkGroup();
|
checkGroup();
|
||||||
final Collection<IGroup> result = new ArrayList<>();
|
final Collection<IGroup> result = new ArrayList<>();
|
||||||
for (IGroup g : entityFactory.groups()) {
|
for (IGroup g : entityFactory.groups())
|
||||||
if (g != this && g.getParentContainer() == this) {
|
if (g != this && g.getParentContainer() == this)
|
||||||
result.add(g);
|
result.add(g);
|
||||||
}
|
|
||||||
}
|
|
||||||
return Collections.unmodifiableCollection(result);
|
return Collections.unmodifiableCollection(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,21 +407,20 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkGroup();
|
checkGroup();
|
||||||
if (dest.isGroup() == false) {
|
if (dest.isGroup() == false)
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
|
||||||
for (ILeaf ent : getLeafsDirect()) {
|
for (ILeaf ent : getLeafsDirect())
|
||||||
((EntityImpl) ent).parentContainer = dest;
|
((EntityImpl) ent).parentContainer = dest;
|
||||||
}
|
|
||||||
for (IGroup g : dest.getChildren()) {
|
for (IGroup g : dest.getChildren())
|
||||||
// ((EntityImpl) g).parentContainer = dest;
|
// ((EntityImpl) g).parentContainer = dest;
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
|
|
||||||
for (IGroup g : getChildren()) {
|
for (IGroup g : getChildren()) {
|
||||||
if (g == dest) {
|
if (g == dest)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
((EntityImpl) g).parentContainer = dest;
|
((EntityImpl) g).parentContainer = dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,23 +507,23 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
|
|
||||||
public PackageStyle getPackageStyle() {
|
public PackageStyle getPackageStyle() {
|
||||||
checkGroup();
|
checkGroup();
|
||||||
if (stereotype == null) {
|
if (stereotype == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
return stereotype.getPackageStyle();
|
return stereotype.getPackageStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGroup() {
|
public boolean isGroup() {
|
||||||
if (groupType != null && leafType != null) {
|
if (groupType != null && leafType != null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
assert groupType == null || leafType == null;
|
assert groupType == null || leafType == null;
|
||||||
if (groupType != null) {
|
if (groupType != null)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (leafType != null) {
|
if (leafType != null)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,26 +534,21 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
this.svekImage = img;
|
this.svekImage = img;
|
||||||
this.url = null;
|
this.url = null;
|
||||||
|
|
||||||
for (final Link link : new ArrayList<>(entityFactory.getLinks())) {
|
for (final Link link : new ArrayList<>(entityFactory.getLinks()))
|
||||||
if (EntityUtils.isPureInnerLink12(this, link)) {
|
if (EntityUtils.isPureInnerLink12(this, link))
|
||||||
entityFactory.removeLink(link);
|
entityFactory.removeLink(link);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entityFactory.namespaceSeparator.V1972()) {
|
if (entityFactory.namespaceSeparator.V1972()) {
|
||||||
entityFactory.removeGroup(getIdent());
|
entityFactory.removeGroup(getIdent());
|
||||||
for (ILeaf ent : new ArrayList<>(entityFactory.leafs())) {
|
for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
|
||||||
if (this != ent && getIdent().equals(ent.getIdent().parent())) {
|
if (this != ent && getIdent().equals(ent.getIdent().parent()))
|
||||||
entityFactory.removeLeaf(ent.getIdent());
|
entityFactory.removeLeaf(ent.getIdent());
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
entityFactory.removeGroup(getCodeGetName());
|
entityFactory.removeGroup(getCodeGetName());
|
||||||
for (ILeaf ent : new ArrayList<>(entityFactory.leafs())) {
|
for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
|
||||||
if (this != ent && this == ent.getParentContainer()) {
|
if (this != ent && this == ent.getParentContainer())
|
||||||
entityFactory.removeLeaf(ent.getCodeGetName());
|
entityFactory.removeLeaf(ent.getCodeGetName());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entityFactory.addLeaf(this);
|
entityFactory.addLeaf(this);
|
||||||
@ -566,9 +558,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
|
|
||||||
void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
|
void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
|
||||||
checkNotGroup();
|
checkNotGroup();
|
||||||
if (parentContainer.isGroup() == false) {
|
if (parentContainer.isGroup() == false)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
|
||||||
this.namespace = namespaceNew;
|
this.namespace = namespaceNew;
|
||||||
this.groupType = groupType;
|
this.groupType = groupType;
|
||||||
this.leafType = null;
|
this.leafType = null;
|
||||||
@ -576,9 +568,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public USymbol getUSymbol() {
|
public USymbol getUSymbol() {
|
||||||
if (getLeafType() == LeafType.CIRCLE) {
|
if (getLeafType() == LeafType.CIRCLE)
|
||||||
return USymbols.INTERFACE;
|
return USymbols.INTERFACE;
|
||||||
}
|
|
||||||
// if (symbol != null && stereotype != null && stereotype.getSprite() != null) {
|
// if (symbol != null && stereotype != null && stereotype.getSprite() != null) {
|
||||||
// return symbol.withStereoAlignment(HorizontalAlignment.RIGHT);
|
// return symbol.withStereoAlignment(HorizontalAlignment.RIGHT);
|
||||||
// }
|
// }
|
||||||
@ -594,74 +586,69 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
if (parentContainer != null && parentContainer.isHidden()) {
|
if (parentContainer != null && parentContainer.isHidden())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return isHiddenInternal();
|
return isHiddenInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHiddenInternal() {
|
private boolean isHiddenInternal() {
|
||||||
if (isGroup()) {
|
if (isGroup()) {
|
||||||
if (entityFactory.isHidden(this)) {
|
if (entityFactory.isHidden(this))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (getLeafsDirect().size() == 0) {
|
if (getLeafsDirect().size() == 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
for (ILeaf leaf : getLeafsDirect()) {
|
for (ILeaf leaf : getLeafsDirect())
|
||||||
if (((EntityImpl) leaf).isHiddenInternal() == false) {
|
if (((EntityImpl) leaf).isHiddenInternal() == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
for (IGroup g : getChildren())
|
||||||
for (IGroup g : getChildren()) {
|
if (((EntityImpl) g).isHiddenInternal() == false)
|
||||||
if (((EntityImpl) g).isHiddenInternal() == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return entityFactory.isHidden(this);
|
return entityFactory.isHidden(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRemoved() {
|
public boolean isRemoved() {
|
||||||
if (parentContainer != null && parentContainer.isRemoved()) {
|
if (parentContainer != null && parentContainer.isRemoved())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return isRemovedInternal();
|
return isRemovedInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRemovedInternal() {
|
private boolean isRemovedInternal() {
|
||||||
if (isGroup()) {
|
if (isGroup()) {
|
||||||
if (entityFactory.isRemoved(this)) {
|
if (entityFactory.isRemoved(this))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (getLeafsDirect().size() == 0 && getChildren().size() == 0) {
|
if (getLeafsDirect().size() == 0 && getChildren().size() == 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
for (ILeaf leaf : getLeafsDirect()) {
|
for (ILeaf leaf : getLeafsDirect())
|
||||||
if (((EntityImpl) leaf).isRemovedInternal() == false) {
|
if (((EntityImpl) leaf).isRemovedInternal() == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
for (IGroup g : getChildren())
|
||||||
for (IGroup g : getChildren()) {
|
if (((EntityImpl) g).isRemovedInternal() == false)
|
||||||
if (((EntityImpl) g).isRemovedInternal() == false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return entityFactory.isRemoved(this);
|
return entityFactory.isRemoved(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAloneAndUnlinked() {
|
public boolean isAloneAndUnlinked() {
|
||||||
if (isGroup()) {
|
if (isGroup())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
for (Link link : entityFactory.getLinks()) {
|
for (Link link : entityFactory.getLinks())
|
||||||
if (link.contains(this) && link.getType().isInvisible() == false) {
|
if (link.contains(this) && link.getType().isInvisible() == false)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,9 +708,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) {
|
public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) {
|
||||||
if (color != null) {
|
if (color != null)
|
||||||
this.colors = colors.add(type, color);
|
this.colors = colors.add(type, color);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<String> getPortShortNames() {
|
public Collection<String> getPortShortNames() {
|
||||||
@ -780,9 +767,9 @@ final public class EntityImpl implements ILeaf, IGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getCodeLine() {
|
public String getCodeLine() {
|
||||||
if (this.codeLine == null) {
|
if (this.codeLine == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
return "" + this.codeLine.getPosition();
|
return "" + this.codeLine.getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@ import net.sourceforge.plantuml.graphic.QuoteUtils;
|
|||||||
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.graphic.TextBlockUtils;
|
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||||
|
import net.sourceforge.plantuml.graphic.USymbolFolder;
|
||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
@ -310,8 +311,16 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker {
|
|||||||
// Unfortunately, we have to translate "edge" in its own "cluster" coordinate
|
// Unfortunately, we have to translate "edge" in its own "cluster" coordinate
|
||||||
final Point2D translate = getPosition(edge.getContainingNode());
|
final Point2D translate = getPosition(edge.getContainingNode());
|
||||||
|
|
||||||
|
final double magicY2 = 0;
|
||||||
|
final IEntity dest = link.getEntity2();
|
||||||
|
if (dest.getUSymbol() instanceof USymbolFolder) {
|
||||||
|
// System.err.println("dest=" + dest);
|
||||||
|
// final IEntityImage image = printEntityInternal((ILeaf) dest);
|
||||||
|
// System.err.println("image=" + image);
|
||||||
|
|
||||||
|
}
|
||||||
final ElkPath elkPath = new ElkPath(diagram, SName.classDiagram, link, edge, getLabel(link),
|
final ElkPath elkPath = new ElkPath(diagram, SName.classDiagram, link, edge, getLabel(link),
|
||||||
getQualifier(link, 1), getQualifier(link, 2));
|
getQualifier(link, 1), getQualifier(link, 2), magicY2);
|
||||||
elkPath.drawU(ug.apply(new UTranslate(translate)));
|
elkPath.drawU(ug.apply(new UTranslate(translate)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,6 @@ import net.sourceforge.plantuml.elk.proxy.graph.ElkLabel;
|
|||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
|
||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
@ -94,11 +93,13 @@ public class ElkPath implements UDrawable {
|
|||||||
private final TextBlock centerLabel;
|
private final TextBlock centerLabel;
|
||||||
private final TextBlock headLabel;
|
private final TextBlock headLabel;
|
||||||
private final TextBlock tailLabel;
|
private final TextBlock tailLabel;
|
||||||
private final Rose rose = new Rose();
|
|
||||||
private final SName styleName;
|
private final SName styleName;
|
||||||
|
|
||||||
|
private final double magicY2;
|
||||||
|
|
||||||
public ElkPath(CucaDiagram diagram, SName styleName, Link link, ElkEdge edge, TextBlock centerLabel,
|
public ElkPath(CucaDiagram diagram, SName styleName, Link link, ElkEdge edge, TextBlock centerLabel,
|
||||||
TextBlock tailLabel, TextBlock headLabel) {
|
TextBlock tailLabel, TextBlock headLabel, double magicY2) {
|
||||||
this.link = link;
|
this.link = link;
|
||||||
this.edge = edge;
|
this.edge = edge;
|
||||||
|
|
||||||
@ -107,6 +108,7 @@ public class ElkPath implements UDrawable {
|
|||||||
this.tailLabel = tailLabel;
|
this.tailLabel = tailLabel;
|
||||||
this.headLabel = headLabel;
|
this.headLabel = headLabel;
|
||||||
this.styleName = styleName;
|
this.styleName = styleName;
|
||||||
|
this.magicY2 = magicY2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,13 +172,13 @@ public class ElkPath implements UDrawable {
|
|||||||
|
|
||||||
private UDrawable getDecors(LinkDecor decors, double angle, HColor backColor) {
|
private UDrawable getDecors(LinkDecor decors, double angle, HColor backColor) {
|
||||||
// For legacy reason, extends are treated differently
|
// For legacy reason, extends are treated differently
|
||||||
if (decors == LinkDecor.EXTENDS) {
|
if (decors == LinkDecor.EXTENDS)
|
||||||
return new ExtremityFactoryExtends(backColor).createUDrawable(new Point2D.Double(), angle, null);
|
return new ExtremityFactoryExtends(backColor).createUDrawable(new Point2D.Double(), angle, null);
|
||||||
}
|
|
||||||
final ExtremityFactory extremityFactory = decors.getExtremityFactory(backColor);
|
final ExtremityFactory extremityFactory = decors.getExtremityFactory(backColor);
|
||||||
if (extremityFactory == null) {
|
if (extremityFactory == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
return extremityFactory.createUDrawable(new Point2D.Double(), angle, null);
|
return extremityFactory.createUDrawable(new Point2D.Double(), angle, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,12 +215,11 @@ public class ElkPath implements UDrawable {
|
|||||||
y1 = pt.getY();
|
y1 = pt.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
drawLine(ug, x1, y1, section.getEndX(), section.getEndY());
|
drawLine(ug, x1, y1, section.getEndX(), section.getEndY() + magicY2);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawLine(UGraphic ug, final double x1, final double y1, final double x2, final double y2) {
|
private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) {
|
||||||
final ULine line = new ULine(x2 - x1, y2 - y1);
|
final ULine line = new ULine(x2 - x1, y2 - y1);
|
||||||
ug.apply(new UTranslate(x1, y1)).draw(line);
|
ug.apply(new UTranslate(x1, y1)).draw(line);
|
||||||
}
|
}
|
||||||
|
@ -63,17 +63,17 @@ public class Img implements HtmlCommand {
|
|||||||
|
|
||||||
static int getVspace(String html) {
|
static int getVspace(String html) {
|
||||||
final Matcher2 m = vspacePattern.matcher(html);
|
final Matcher2 m = vspacePattern.matcher(html);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return Integer.parseInt(m.group(1));
|
return Integer.parseInt(m.group(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImgValign getValign(String html) {
|
static ImgValign getValign(String html) {
|
||||||
final Matcher2 m = valignPattern.matcher(html);
|
final Matcher2 m = valignPattern.matcher(html);
|
||||||
if (m.find() == false) {
|
if (m.find() == false)
|
||||||
return ImgValign.TOP;
|
return ImgValign.TOP;
|
||||||
}
|
|
||||||
return ImgValign.valueOf(StringUtils.goUpperCase(m.group(1)));
|
return ImgValign.valueOf(StringUtils.goUpperCase(m.group(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,28 +99,28 @@ public class Img implements HtmlCommand {
|
|||||||
// Check if valid URL
|
// Check if valid URL
|
||||||
if (src.startsWith("http:") || src.startsWith("https:")) {
|
if (src.startsWith("http:") || src.startsWith("https:")) {
|
||||||
final SURL tmp = SURL.create(src);
|
final SURL tmp = SURL.create(src);
|
||||||
if (tmp == null) {
|
if (tmp == null)
|
||||||
return new Text("(Cannot decode: " + src + ")");
|
return new Text("(Cannot decode: " + src + ")");
|
||||||
}
|
|
||||||
final BufferedImage read = tmp.readRasterImageFromURL();
|
final BufferedImage read = tmp.readRasterImageFromURL();
|
||||||
if (read == null) {
|
if (read == null)
|
||||||
return new Text("(Cannot decode: " + src + ")");
|
return new Text("(Cannot decode: " + src + ")");
|
||||||
}
|
|
||||||
return new Img(new TileImage(read, valign, vspace));
|
return new Img(new TileImage(read, valign, vspace));
|
||||||
}
|
}
|
||||||
return new Text("(Cannot decode: " + f + ")");
|
return new Text("(Cannot decode: " + f + ")");
|
||||||
}
|
}
|
||||||
if (f.getName().endsWith(".svg")) {
|
if (f.getName().endsWith(".svg")) {
|
||||||
final String tmp = FileUtils.readSvg(f);
|
final String tmp = FileUtils.readSvg(f);
|
||||||
if (tmp == null) {
|
if (tmp == null)
|
||||||
return new Text("(Cannot decode: " + f + ")");
|
return new Text("(Cannot decode: " + f + ")");
|
||||||
}
|
|
||||||
return new Img(new TileImageSvg(tmp));
|
return new Img(new TileImageSvg(tmp, 1));
|
||||||
}
|
}
|
||||||
final BufferedImage read = f.readRasterImageFromFile();
|
final BufferedImage read = f.readRasterImageFromFile();
|
||||||
if (read == null) {
|
if (read == null)
|
||||||
return new Text("(Cannot decode: " + f + ")");
|
return new Text("(Cannot decode: " + f + ")");
|
||||||
}
|
|
||||||
return new Img(new TileImage(f.readRasterImageFromFile(), valign, vspace));
|
return new Img(new TileImage(f.readRasterImageFromFile(), valign, vspace));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -42,17 +42,18 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.api.ThemeStyle;
|
import net.sourceforge.plantuml.api.ThemeStyle;
|
||||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
|
||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
|
import net.sourceforge.plantuml.style.Value;
|
||||||
|
import net.sourceforge.plantuml.style.ValueNull;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.color.ColorUtils;
|
||||||
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;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||||
|
|
||||||
public class Rainbow {
|
public class Rainbow {
|
||||||
|
|
||||||
private final static Rose rose = new Rose();
|
|
||||||
|
|
||||||
private final List<HtmlColorAndStyle> colors = new ArrayList<>();
|
private final List<HtmlColorAndStyle> colors = new ArrayList<>();
|
||||||
private final int colorArrowSeparationSpace;
|
private final int colorArrowSeparationSpace;
|
||||||
|
|
||||||
@ -83,7 +84,15 @@ public class Rainbow {
|
|||||||
|
|
||||||
public static Rainbow build(Style style, HColorSet set, ThemeStyle themeStyle) {
|
public static Rainbow build(Style style, HColorSet set, ThemeStyle themeStyle) {
|
||||||
final HColor color = style.value(PName.LineColor).asColor(themeStyle, set);
|
final HColor color = style.value(PName.LineColor).asColor(themeStyle, set);
|
||||||
return fromColor(color, null);
|
final Value head = style.value(PName.HeadColor);
|
||||||
|
HColor colorHead;
|
||||||
|
if (head instanceof ValueNull)
|
||||||
|
colorHead = color;
|
||||||
|
else
|
||||||
|
colorHead = head.asColor(themeStyle, set);
|
||||||
|
if (colorHead == null)
|
||||||
|
colorHead = HColorUtils.transparent();
|
||||||
|
return fromColor(color, colorHead);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rainbow withDefault(Rainbow defaultColor) {
|
public Rainbow withDefault(Rainbow defaultColor) {
|
||||||
|
@ -58,25 +58,11 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
|||||||
private final double left;
|
private final double left;
|
||||||
private final UStroke stroke;
|
private final UStroke stroke;
|
||||||
private final boolean withShadow;
|
private final boolean withShadow;
|
||||||
|
private final String id;
|
||||||
private final TextBlock textBlock;
|
private final TextBlock textBlock;
|
||||||
|
|
||||||
TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||||
double cornersize, double marginX, double marginY) {
|
double cornersize, ClockwiseTopRightBottomLeft margins, String id) {
|
||||||
this.top = marginY;
|
|
||||||
this.right = marginX;
|
|
||||||
this.bottom = marginY;
|
|
||||||
this.left = marginX;
|
|
||||||
this.cornersize = cornersize;
|
|
||||||
this.textBlock = textBlock;
|
|
||||||
this.withShadow = false;
|
|
||||||
this.stroke = stroke;
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
this.backgroundColor = backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
|
||||||
double cornersize, ClockwiseTopRightBottomLeft margins) {
|
|
||||||
this.top = margins.getTop();
|
this.top = margins.getTop();
|
||||||
this.right = margins.getRight();
|
this.right = margins.getRight();
|
||||||
this.bottom = margins.getBottom();
|
this.bottom = margins.getBottom();
|
||||||
@ -87,11 +73,7 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
|||||||
this.stroke = stroke;
|
this.stroke = stroke;
|
||||||
this.borderColor = borderColor;
|
this.borderColor = borderColor;
|
||||||
this.backgroundColor = backgroundColor;
|
this.backgroundColor = backgroundColor;
|
||||||
}
|
this.id = id;
|
||||||
|
|
||||||
TextBlockBordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
|
||||||
double cornersize) {
|
|
||||||
this(textBlock, stroke, borderColor, backgroundColor, cornersize, 6, 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getTextHeight(StringBounder stringBounder) {
|
private double getTextHeight(StringBounder stringBounder) {
|
||||||
@ -115,16 +97,16 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private UGraphic applyStroke(UGraphic ug) {
|
private UGraphic applyStroke(UGraphic ug) {
|
||||||
if (stroke == null) {
|
if (stroke == null)
|
||||||
return ug;
|
return ug;
|
||||||
}
|
|
||||||
return ug.apply(stroke);
|
return ug.apply(stroke);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean noBorder() {
|
private boolean noBorder() {
|
||||||
if (stroke == null) {
|
if (stroke == null)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return stroke.getThickness() == 0;
|
return stroke.getThickness() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,32 +114,32 @@ public class TextBlockBordered extends AbstractTextBlock implements TextBlock {
|
|||||||
final StringBounder stringBounder = ug.getStringBounder();
|
final StringBounder stringBounder = ug.getStringBounder();
|
||||||
final Shadowable polygon = getPolygonNormal(stringBounder);
|
final Shadowable polygon = getPolygonNormal(stringBounder);
|
||||||
final UGraphic ugOriginal = ug;
|
final UGraphic ugOriginal = ug;
|
||||||
if (withShadow) {
|
if (withShadow)
|
||||||
polygon.setDeltaShadow(4);
|
polygon.setDeltaShadow(4);
|
||||||
}
|
|
||||||
if (backgroundColor == null) {
|
if (backgroundColor == null)
|
||||||
ug = ug.apply(new HColorNone().bg());
|
ug = ug.apply(new HColorNone().bg());
|
||||||
} else {
|
else
|
||||||
ug = ug.apply(backgroundColor.bg());
|
ug = ug.apply(backgroundColor.bg());
|
||||||
}
|
|
||||||
HColor color = noBorder() ? backgroundColor : borderColor;
|
HColor color = noBorder() ? backgroundColor : borderColor;
|
||||||
if (color == null) {
|
if (color == null)
|
||||||
color = new HColorNone();
|
color = new HColorNone();
|
||||||
}
|
|
||||||
ug = ug.apply(color);
|
ug = ug.apply(color);
|
||||||
ug = applyStroke(ug);
|
ug = applyStroke(ug);
|
||||||
ug.draw(polygon);
|
ug.draw(polygon);
|
||||||
TextBlock toDraw = textBlock;
|
TextBlock toDraw = textBlock;
|
||||||
if (textBlock instanceof SheetBlock2) {
|
if (textBlock instanceof SheetBlock2)
|
||||||
toDraw = ((SheetBlock2) textBlock).enlargeMe(left, right);
|
toDraw = ((SheetBlock2) textBlock).enlargeMe(left, right);
|
||||||
}
|
|
||||||
toDraw.drawU(ugOriginal.apply(color).apply(new UTranslate(left, top)));
|
toDraw.drawU(ugOriginal.apply(color).apply(new UTranslate(left, top)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Shadowable getPolygonNormal(final StringBounder stringBounder) {
|
private Shadowable getPolygonNormal(final StringBounder stringBounder) {
|
||||||
final double height = getTextHeight(stringBounder);
|
final double height = getTextHeight(stringBounder);
|
||||||
final double width = getTextWidth(stringBounder);
|
final double width = getTextWidth(stringBounder);
|
||||||
return new URectangle(width, height).rounded(cornersize);
|
return new URectangle(width, height).rounded(cornersize).withCommentAndCodeLine(id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,7 @@ import java.awt.geom.Rectangle2D;
|
|||||||
|
|
||||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
import net.sourceforge.plantuml.ISkinParam;
|
|
||||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
|
||||||
import net.sourceforge.plantuml.posimo.Positionable;
|
import net.sourceforge.plantuml.posimo.Positionable;
|
||||||
import net.sourceforge.plantuml.posimo.PositionableImpl;
|
import net.sourceforge.plantuml.posimo.PositionableImpl;
|
||||||
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
|
||||||
@ -63,22 +61,8 @@ public class TextBlockUtils {
|
|||||||
public static final TextBlock EMPTY_TEXT_BLOCK = TextBlockUtils.empty(0, 0);
|
public static final TextBlock EMPTY_TEXT_BLOCK = TextBlockUtils.empty(0, 0);
|
||||||
|
|
||||||
public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
||||||
double cornersize) {
|
double cornersize, ClockwiseTopRightBottomLeft margins, String id) {
|
||||||
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize);
|
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, margins, id);
|
||||||
}
|
|
||||||
|
|
||||||
public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
|
||||||
double cornersize, double marginX, double marginY) {
|
|
||||||
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, marginX, marginY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TextBlock bordered(TextBlock textBlock, UStroke stroke, HColor borderColor, HColor backgroundColor,
|
|
||||||
double cornersize, ClockwiseTopRightBottomLeft margins) {
|
|
||||||
return new TextBlockBordered(textBlock, stroke, borderColor, backgroundColor, cornersize, margins);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TextBlock title(FontConfiguration font, Display stringsToDisplay, ISkinParam skinParam) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) {
|
public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) {
|
||||||
|
@ -43,9 +43,11 @@ import net.sourceforge.plantuml.ugraphic.UImageSvg;
|
|||||||
public class TileImageSvg extends AbstractTextBlock implements TextBlock {
|
public class TileImageSvg extends AbstractTextBlock implements TextBlock {
|
||||||
|
|
||||||
private final UImageSvg svg;
|
private final UImageSvg svg;
|
||||||
|
private final double scale;
|
||||||
|
|
||||||
public TileImageSvg(String svg) {
|
public TileImageSvg(String svg, double scale) {
|
||||||
this.svg = new UImageSvg(svg, 1);
|
this.svg = new UImageSvg(svg, scale);
|
||||||
|
this.scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||||
|
@ -39,6 +39,7 @@ import net.sourceforge.plantuml.FontParam;
|
|||||||
import net.sourceforge.plantuml.StringLocated;
|
import net.sourceforge.plantuml.StringLocated;
|
||||||
import net.sourceforge.plantuml.UrlBuilder;
|
import net.sourceforge.plantuml.UrlBuilder;
|
||||||
import net.sourceforge.plantuml.command.BlocLines;
|
import net.sourceforge.plantuml.command.BlocLines;
|
||||||
|
import net.sourceforge.plantuml.command.CommandControl;
|
||||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||||
import net.sourceforge.plantuml.command.CommandMultilines2;
|
import net.sourceforge.plantuml.command.CommandMultilines2;
|
||||||
import net.sourceforge.plantuml.command.MultilinesStrategy;
|
import net.sourceforge.plantuml.command.MultilinesStrategy;
|
||||||
@ -97,22 +98,46 @@ public class CommandCreateJson extends CommandMultilines2<AbstractClassOrObjectD
|
|||||||
if (entity1 == null)
|
if (entity1 == null)
|
||||||
return CommandExecutionResult.error("No such entity");
|
return CommandExecutionResult.error("No such entity");
|
||||||
|
|
||||||
|
final JsonValue json = getJsonValue(lines);
|
||||||
|
|
||||||
|
if (json == null)
|
||||||
|
return CommandExecutionResult.error("Bad data");
|
||||||
|
((BodierJSon) entity1.getBodier()).setJson(json);
|
||||||
|
|
||||||
|
return CommandExecutionResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CommandControl finalVerification(BlocLines lines) {
|
||||||
|
final JsonValue json = getJsonValue(lines);
|
||||||
|
if (json == null)
|
||||||
|
return CommandControl.OK_PARTIAL;
|
||||||
|
|
||||||
|
return super.finalVerification(lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonValue getJsonValue(BlocLines lines) {
|
||||||
|
try {
|
||||||
|
final String sb = getJsonString(lines);
|
||||||
|
final DefaultHandler handler = new DefaultHandler();
|
||||||
|
new JsonParser(handler).parse(sb);
|
||||||
|
final JsonValue json = handler.getValue();
|
||||||
|
return json;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getJsonString(BlocLines lines) {
|
||||||
lines = lines.subExtract(1, 1);
|
lines = lines.subExtract(1, 1);
|
||||||
final StringBuilder sb = new StringBuilder("{");
|
final StringBuilder sb = new StringBuilder("{");
|
||||||
for (StringLocated sl : lines) {
|
for (StringLocated sl : lines) {
|
||||||
final String line = sl.getString();
|
final String line = sl.getString();
|
||||||
assert line.length() > 0;
|
assert line.length() > 0;
|
||||||
System.err.println("l=" + line);
|
|
||||||
sb.append(line);
|
sb.append(line);
|
||||||
}
|
}
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
final DefaultHandler handler = new DefaultHandler();
|
|
||||||
new JsonParser(handler).parse(sb.toString());
|
|
||||||
final JsonValue json = handler.getValue();
|
|
||||||
((BodierJSon) entity1.getBodier()).setJson(json);
|
|
||||||
|
|
||||||
return CommandExecutionResult.ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
|
private IEntity executeArg0(AbstractClassOrObjectDiagram diagram, RegexResult line0) throws NoSuchColorException {
|
||||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.MultilinesStrategy;
|
|||||||
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.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
import net.sourceforge.plantuml.cucadiagram.BodierMap;
|
import net.sourceforge.plantuml.cucadiagram.BodierMap;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||||
@ -59,7 +60,9 @@ import net.sourceforge.plantuml.cucadiagram.LinkType;
|
|||||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||||
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||||
|
|
||||||
public class CommandCreateMap extends CommandMultilines2<AbstractClassOrObjectDiagram> {
|
public class CommandCreateMap extends CommandMultilines2<AbstractClassOrObjectDiagram> {
|
||||||
@ -78,12 +81,19 @@ public class CommandCreateMap extends CommandMultilines2<AbstractClassOrObjectDi
|
|||||||
RegexLeaf.spaceZeroOrMore(), //
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
|
||||||
RegexLeaf.spaceZeroOrMore(), //
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
ColorParser.exp1(), //
|
color().getRegex(), //
|
||||||
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
|
new RegexOptional(new RegexConcat(new RegexLeaf("##"),
|
||||||
|
new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
|
||||||
RegexLeaf.spaceZeroOrMore(), //
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
new RegexLeaf("\\{"), //
|
new RegexLeaf("\\{"), //
|
||||||
RegexLeaf.end());
|
RegexLeaf.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ColorParser color() {
|
||||||
|
return ColorParser.simpleColor(ColorType.BACK);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPatternEnd() {
|
public String getPatternEnd() {
|
||||||
return "^[%s]*\\}[%s]*$";
|
return "^[%s]*\\}[%s]*$";
|
||||||
@ -143,9 +153,20 @@ public class CommandCreateMap extends CommandMultilines2<AbstractClassOrObjectDi
|
|||||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||||
diagram.getSkinParam().getIHtmlColorSet()));
|
diagram.getSkinParam().getIHtmlColorSet()));
|
||||||
|
|
||||||
final String s = line0.get("COLOR", 0);
|
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
|
||||||
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
|
diagram.getSkinParam().getIHtmlColorSet());
|
||||||
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
|
final String s = line0.get("LINECOLOR", 1);
|
||||||
|
|
||||||
|
final HColor lineColor = s == null ? null
|
||||||
|
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
|
||||||
|
if (lineColor != null)
|
||||||
|
colors = colors.add(ColorType.LINE, lineColor);
|
||||||
|
|
||||||
|
if (line0.get("LINECOLOR", 0) != null)
|
||||||
|
colors = colors.addLegacyStroke(line0.get("LINECOLOR", 0));
|
||||||
|
|
||||||
|
entity.setColors(colors);
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,6 +223,7 @@ public class PicoWebServer implements Runnable {
|
|||||||
write(out, "Cache-Control: no-cache");
|
write(out, "Cache-Control: no-cache");
|
||||||
write(out, "Server: PlantUML PicoWebServer " + Version.versionString());
|
write(out, "Server: PlantUML PicoWebServer " + Version.versionString());
|
||||||
write(out, "Date: " + new Date());
|
write(out, "Date: " + new Date());
|
||||||
|
write(out, "Access-Control-Allow-Origin: *");
|
||||||
write(out, "Content-type: " + fileFormatOption.getFileFormat().getMimeType());
|
write(out, "Content-type: " + fileFormatOption.getFileFormat().getMimeType());
|
||||||
write(out, "Content-length: " + fileData.length);
|
write(out, "Content-length: " + fileData.length);
|
||||||
write(out, "X-PlantUML-Diagram-Width: " + imageData.getWidth());
|
write(out, "X-PlantUML-Diagram-Width: " + imageData.getWidth());
|
||||||
|
@ -73,6 +73,6 @@ public class PngTitler {
|
|||||||
if (display == null)
|
if (display == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return style.createTextBlockBordered(display, set, spriteContainer);
|
return style.createTextBlockBordered(display, set, spriteContainer, Style.ID_TITLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,9 @@ public class ReadLineReader implements ReadLine {
|
|||||||
private final String description;
|
private final String description;
|
||||||
|
|
||||||
private ReadLineReader(Reader reader, String description, LineLocation parent) {
|
private ReadLineReader(Reader reader, String description, LineLocation parent) {
|
||||||
if (description == null) {
|
if (description == null)
|
||||||
description = "?";
|
description = "?";
|
||||||
}
|
|
||||||
this.br = new BufferedReader(reader);
|
this.br = new BufferedReader(reader);
|
||||||
this.location = new LineLocationImpl(description, parent);
|
this.location = new LineLocationImpl(description, parent);
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@ -80,16 +80,16 @@ public class ReadLineReader implements ReadLine {
|
|||||||
public StringLocated readLine() throws IOException {
|
public StringLocated readLine() throws IOException {
|
||||||
String s = br.readLine();
|
String s = br.readLine();
|
||||||
location = location.oneLineRead();
|
location = location.oneLineRead();
|
||||||
if (s == null) {
|
if (s == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
// if (s.length() > LIMIT) {
|
// if (s.length() > LIMIT) {
|
||||||
// Log.debug("Line truncated from " + s.length() + " to " + LIMIT);
|
// Log.debug("Line truncated from " + s.length() + " to " + LIMIT);
|
||||||
// s = s.substring(0, LIMIT);
|
// s = s.substring(0, LIMIT);
|
||||||
// }
|
// }
|
||||||
if (s.startsWith("\uFEFF")) {
|
if (s.startsWith("\uFEFF"))
|
||||||
s = s.substring(1);
|
s = s.substring(1);
|
||||||
}
|
|
||||||
s = s.replace('\u2013', '-');
|
s = s.replace('\u2013', '-');
|
||||||
// s = BackSlash.convertHiddenNewLine(s);
|
// s = BackSlash.convertHiddenNewLine(s);
|
||||||
// s = s.replace('\u00A0', ' ');
|
// s = s.replace('\u00A0', ' ');
|
||||||
|
@ -244,7 +244,7 @@ public class SURL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean forbiddenURL(String full) {
|
private boolean forbiddenURL(String full) {
|
||||||
if (full.matches("^https?://[.0-9]+/.*"))
|
if (full.matches("^https?://[-#.0-9:\\[\\]+]+/.*"))
|
||||||
return true;
|
return true;
|
||||||
if (full.matches("^https?://[^.]+/.*"))
|
if (full.matches("^https?://[^.]+/.*"))
|
||||||
return true;
|
return true;
|
||||||
|
@ -149,7 +149,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
|||||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
||||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||||
compTitle = style.createTextBlockBordered(page.getTitle(), diagram.getSkinParam().getIHtmlColorSet(),
|
compTitle = style.createTextBlockBordered(page.getTitle(), diagram.getSkinParam().getIHtmlColorSet(),
|
||||||
diagram.getSkinParam());
|
diagram.getSkinParam(), Style.ID_TITLE);
|
||||||
final Dimension2D dimTitle = compTitle.calculateDimension(stringBounder);
|
final Dimension2D dimTitle = compTitle.calculateDimension(stringBounder);
|
||||||
area.setTitleArea(dimTitle.getWidth(), dimTitle.getHeight());
|
area.setTitleArea(dimTitle.getWidth(), dimTitle.getHeight());
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
|||||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.legend)
|
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.legend)
|
||||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||||
legendBlock = style.createTextBlockBordered(diagram.getLegend().getDisplay(),
|
legendBlock = style.createTextBlockBordered(diagram.getLegend().getDisplay(),
|
||||||
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam());
|
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam(), Style.ID_LEGEND);
|
||||||
}
|
}
|
||||||
final Dimension2D dimLegend = legendBlock.calculateDimension(stringBounder);
|
final Dimension2D dimLegend = legendBlock.calculateDimension(stringBounder);
|
||||||
area.setLegend(dimLegend, isLegendTop(), diagram.getLegend().getHorizontalAlignment());
|
area.setLegend(dimLegend, isLegendTop(), diagram.getLegend().getHorizontalAlignment());
|
||||||
|
@ -209,7 +209,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
|||||||
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
|
||||||
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||||
final TextBlock compTitle = style.createTextBlockBordered(diagram.getTitle().getDisplay(),
|
final TextBlock compTitle = style.createTextBlockBordered(diagram.getTitle().getDisplay(),
|
||||||
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam());
|
diagram.getSkinParam().getIHtmlColorSet(), diagram.getSkinParam(), Style.ID_TITLE);
|
||||||
return compTitle;
|
return compTitle;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,6 @@ import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
|||||||
|
|
||||||
public abstract class AbstractTextualComponent extends AbstractComponent {
|
public abstract class AbstractTextualComponent extends AbstractComponent {
|
||||||
|
|
||||||
private final Display display;
|
|
||||||
|
|
||||||
private final int marginX1;
|
private final int marginX1;
|
||||||
private final int marginX2;
|
private final int marginX2;
|
||||||
private final int marginY;
|
private final int marginY;
|
||||||
@ -91,20 +89,18 @@ public abstract class AbstractTextualComponent extends AbstractComponent {
|
|||||||
final UFont fontForStereotype = stereo.getUFont();
|
final UFont fontForStereotype = stereo.getUFont();
|
||||||
final HColor htmlColorForStereotype = stereo.value(PName.FontColor).asColor(spriteContainer.getThemeStyle(),
|
final HColor htmlColorForStereotype = stereo.value(PName.FontColor).asColor(spriteContainer.getThemeStyle(),
|
||||||
getIHtmlColorSet());
|
getIHtmlColorSet());
|
||||||
this.display = display.withoutStereotypeIfNeeded(style);
|
display = display.withoutStereotypeIfNeeded(style);
|
||||||
|
|
||||||
this.marginX1 = marginX1;
|
this.marginX1 = marginX1;
|
||||||
this.marginX2 = marginX2;
|
this.marginX2 = marginX2;
|
||||||
this.marginY = marginY;
|
this.marginY = marginY;
|
||||||
// this.display = keepStereotype ? display : display.withoutStereotype();
|
|
||||||
|
|
||||||
if (this.display.size() == 1 && this.display.get(0).length() == 0)
|
if (display.size() == 1 && display.get(0).length() == 0)
|
||||||
textBlock = new TextBlockEmpty();
|
textBlock = new TextBlockEmpty();
|
||||||
else if (enhanced)
|
else if (enhanced)
|
||||||
textBlock = BodyFactory.create3(this.display, spriteContainer, horizontalAlignment, fc, maxMessageSize,
|
textBlock = BodyFactory.create3(display, spriteContainer, horizontalAlignment, fc, maxMessageSize, style);
|
||||||
style);
|
|
||||||
else
|
else
|
||||||
textBlock = this.display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL,
|
textBlock = display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL,
|
||||||
fontForStereotype, htmlColorForStereotype, marginX1, marginX2);
|
fontForStereotype, htmlColorForStereotype, marginX1, marginX2);
|
||||||
|
|
||||||
this.alignment = horizontalAlignment;
|
this.alignment = horizontalAlignment;
|
||||||
|
@ -150,11 +150,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
|||||||
|
|
||||||
if (inclination1 == 0 && inclination2 == 0)
|
if (inclination1 == 0 && inclination2 == 0)
|
||||||
getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(new ULine(len, 0));
|
getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, posArrow)).draw(new ULine(len, 0));
|
||||||
else if (inclination1 != 0) {
|
else if (inclination1 != 0)
|
||||||
drawLine(getArrowConfiguration().applyStroke(ug), start + len, posArrow, 0, posArrow + inclination1);
|
drawLine(getArrowConfiguration().applyStroke(ug), start + len, posArrow, 0, posArrow + inclination1);
|
||||||
} else if (inclination2 != 0) {
|
else if (inclination2 != 0)
|
||||||
drawLine(getArrowConfiguration().applyStroke(ug), start, posArrow, pos2, posArrow + inclination2);
|
drawLine(getArrowConfiguration().applyStroke(ug), start, posArrow, pos2, posArrow + inclination2);
|
||||||
}
|
|
||||||
|
|
||||||
final ArrowDirection direction2 = getDirection2();
|
final ArrowDirection direction2 = getDirection2();
|
||||||
final double textPos;
|
final double textPos;
|
||||||
@ -203,10 +202,12 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
|||||||
|
|
||||||
if (dressing.getHead() == ArrowHead.ASYNC) {
|
if (dressing.getHead() == ArrowHead.ASYNC) {
|
||||||
if (dressing.getPart() != ArrowPart.BOTTOM_PART)
|
if (dressing.getPart() != ArrowPart.BOTTOM_PART)
|
||||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY()));
|
getArrowConfiguration().applyThicknessOnly(ug).draw(
|
||||||
|
new ULine(getArrowDeltaX(), -getArrowDeltaY()).rotate(Math.atan2(-inclination1, lenFull)));
|
||||||
|
|
||||||
if (dressing.getPart() != ArrowPart.TOP_PART)
|
if (dressing.getPart() != ArrowPart.TOP_PART)
|
||||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(getArrowDeltaX(), getArrowDeltaY()));
|
getArrowConfiguration().applyThicknessOnly(ug)
|
||||||
|
.draw(new ULine(getArrowDeltaX(), getArrowDeltaY()).rotate(Math.atan2(-inclination1, lenFull)));
|
||||||
|
|
||||||
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
||||||
ug = ug.apply(new UStroke(2));
|
ug = ug.apply(new UStroke(2));
|
||||||
@ -237,10 +238,12 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
|
|||||||
|
|
||||||
if (dressing.getHead() == ArrowHead.ASYNC) {
|
if (dressing.getHead() == ArrowHead.ASYNC) {
|
||||||
if (dressing.getPart() != ArrowPart.BOTTOM_PART)
|
if (dressing.getPart() != ArrowPart.BOTTOM_PART)
|
||||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY()));
|
getArrowConfiguration().applyThicknessOnly(ug).draw(
|
||||||
|
new ULine(-getArrowDeltaX(), -getArrowDeltaY()).rotate(Math.atan2(inclination2, lenFull)));
|
||||||
|
|
||||||
if (dressing.getPart() != ArrowPart.TOP_PART)
|
if (dressing.getPart() != ArrowPart.TOP_PART)
|
||||||
getArrowConfiguration().applyThicknessOnly(ug).draw(new ULine(-getArrowDeltaX(), getArrowDeltaY()));
|
getArrowConfiguration().applyThicknessOnly(ug)
|
||||||
|
.draw(new ULine(-getArrowDeltaX(), getArrowDeltaY()).rotate(Math.atan2(inclination2, lenFull)));
|
||||||
|
|
||||||
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
} else if (dressing.getHead() == ArrowHead.CROSSX) {
|
||||||
ug = ug.apply(new UStroke(2));
|
ug = ug.apply(new UStroke(2));
|
||||||
|
@ -144,6 +144,7 @@ public class FromSkinparamToStyle {
|
|||||||
addConvert("arrowThickness", PName.LineThickness, SName.arrow);
|
addConvert("arrowThickness", PName.LineThickness, SName.arrow);
|
||||||
addConvert("arrowColor", PName.LineColor, SName.arrow);
|
addConvert("arrowColor", PName.LineColor, SName.arrow);
|
||||||
addConvert("arrowStyle", PName.LineStyle, SName.arrow);
|
addConvert("arrowStyle", PName.LineStyle, SName.arrow);
|
||||||
|
addConvert("arrowHeadColor", PName.HeadColor, SName.arrow);
|
||||||
|
|
||||||
addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root);
|
addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root);
|
||||||
addConvert("defaultFontName", PName.FontName, SName.root);
|
addConvert("defaultFontName", PName.FontName, SName.root);
|
||||||
@ -210,15 +211,22 @@ public class FromSkinparamToStyle {
|
|||||||
addMagic(SName.usecase);
|
addMagic(SName.usecase);
|
||||||
addMagic(SName.map);
|
addMagic(SName.map);
|
||||||
addMagic(SName.archimate);
|
addMagic(SName.archimate);
|
||||||
|
|
||||||
|
addConvert("IconPrivateColor", PName.LineColor, SName.visibilityIcon, SName.private_);
|
||||||
|
addConvert("IconPrivateBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.private_);
|
||||||
|
addConvert("IconPackageColor", PName.LineColor, SName.visibilityIcon, SName.package_);
|
||||||
|
addConvert("IconPackageBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.package_);
|
||||||
|
addConvert("IconProtectedColor", PName.LineColor, SName.visibilityIcon, SName.protected_);
|
||||||
|
addConvert("IconProtectedBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.protected_);
|
||||||
|
addConvert("IconPublicColor", PName.LineColor, SName.visibilityIcon, SName.public_);
|
||||||
|
addConvert("IconPublicBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.public_);
|
||||||
|
|
||||||
// addConvert("nodeStereotypeFontSize", PName.FontSize, SName.node, SName.stereotype);
|
// addConvert("nodeStereotypeFontSize", PName.FontSize, SName.node, SName.stereotype);
|
||||||
// addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);
|
// addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);
|
||||||
// addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype);
|
// addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype);
|
||||||
// addConvert("sequenceStereotypeFontColor", PName.FontColor, SName.stereotype);
|
// addConvert("sequenceStereotypeFontColor", PName.FontColor, SName.stereotype);
|
||||||
// addConvert("sequenceStereotypeFontName", PName.FontName, SName.stereotype);
|
// addConvert("sequenceStereotypeFontName", PName.FontName, SName.stereotype);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addMagic(SName sname) {
|
private static void addMagic(SName sname) {
|
||||||
@ -231,7 +239,7 @@ public class FromSkinparamToStyle {
|
|||||||
addConvert(cleanName + "BorderStyle", PName.LineStyle, sname);
|
addConvert(cleanName + "BorderStyle", PName.LineStyle, sname);
|
||||||
addConFont(cleanName, sname);
|
addConFont(cleanName, sname);
|
||||||
addConvert(cleanName + "Shadowing", PName.Shadowing, sname);
|
addConvert(cleanName + "Shadowing", PName.Shadowing, sname);
|
||||||
|
|
||||||
addConvert(cleanName + "StereotypeFontSize", PName.FontSize, SName.stereotype, sname);
|
addConvert(cleanName + "StereotypeFontSize", PName.FontSize, SName.stereotype, sname);
|
||||||
addConvert(cleanName + "StereotypeFontStyle", PName.FontStyle, SName.stereotype, sname);
|
addConvert(cleanName + "StereotypeFontStyle", PName.FontStyle, SName.stereotype, sname);
|
||||||
addConvert(cleanName + "StereotypeFontColor", PName.FontColor, SName.stereotype, sname);
|
addConvert(cleanName + "StereotypeFontColor", PName.FontColor, SName.stereotype, sname);
|
||||||
|
@ -46,6 +46,7 @@ public enum PName {
|
|||||||
LineThickness, //
|
LineThickness, //
|
||||||
DiagonalCorner, //
|
DiagonalCorner, //
|
||||||
HyperLinkColor, //
|
HyperLinkColor, //
|
||||||
|
HeadColor, //
|
||||||
LineColor, //
|
LineColor, //
|
||||||
LineStyle, //
|
LineStyle, //
|
||||||
Padding, //
|
Padding, //
|
||||||
|
@ -41,6 +41,7 @@ public enum SName {
|
|||||||
activityDiagram, //
|
activityDiagram, //
|
||||||
actor, //
|
actor, //
|
||||||
agent, //
|
agent, //
|
||||||
|
analog, //
|
||||||
archimate, //
|
archimate, //
|
||||||
arrow, //
|
arrow, //
|
||||||
artifact, //
|
artifact, //
|
||||||
@ -142,6 +143,7 @@ public enum SName {
|
|||||||
spotProtocol, //
|
spotProtocol, //
|
||||||
spotStruct, //
|
spotStruct, //
|
||||||
spotEntity, //
|
spotEntity, //
|
||||||
|
spotException, //
|
||||||
spotClass, //
|
spotClass, //
|
||||||
spotAbstractClass, //
|
spotAbstractClass, //
|
||||||
|
|
||||||
|
@ -269,8 +269,12 @@ public class Style {
|
|||||||
final FontConfiguration fc = getFontConfiguration(spriteContainer.getThemeStyle(), set);
|
final FontConfiguration fc = getFontConfiguration(spriteContainer.getThemeStyle(), set);
|
||||||
return display.create(fc, alignment, spriteContainer);
|
return display.create(fc, alignment, spriteContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ID_TITLE = "_title";
|
||||||
|
public static final String ID_CAPTION = "_caption";
|
||||||
|
public static final String ID_LEGEND = "_legend";
|
||||||
|
|
||||||
public TextBlock createTextBlockBordered(Display note, HColorSet set, ISkinSimple spriteContainer) {
|
public TextBlock createTextBlockBordered(Display note, HColorSet set, ISkinSimple spriteContainer, String id) {
|
||||||
final HorizontalAlignment alignment = this.getHorizontalAlignment();
|
final HorizontalAlignment alignment = this.getHorizontalAlignment();
|
||||||
final TextBlock textBlock = this.createTextBlockInternal(note, set, spriteContainer, alignment);
|
final TextBlock textBlock = this.createTextBlockInternal(note, set, spriteContainer, alignment);
|
||||||
|
|
||||||
@ -281,7 +285,7 @@ public class Style {
|
|||||||
final ClockwiseTopRightBottomLeft margin = this.getMargin();
|
final ClockwiseTopRightBottomLeft margin = this.getMargin();
|
||||||
final ClockwiseTopRightBottomLeft padding = this.getPadding();
|
final ClockwiseTopRightBottomLeft padding = this.getPadding();
|
||||||
final TextBlock result = TextBlockUtils.bordered(textBlock, stroke, lineColor, backgroundColor, cornersize,
|
final TextBlock result = TextBlockUtils.bordered(textBlock, stroke, lineColor, backgroundColor, cornersize,
|
||||||
padding);
|
padding, id);
|
||||||
return TextBlockUtils.withMargin(result, margin);
|
return TextBlockUtils.withMargin(result, margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@ public class ClusterDecoration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static USymbol guess(USymbol symbol, PackageStyle style) {
|
private static USymbol guess(USymbol symbol, PackageStyle style) {
|
||||||
if (symbol != null) {
|
if (symbol != null)
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
|
||||||
return style.toUSymbol();
|
return style.toUSymbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,14 +169,14 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
|||||||
|
|
||||||
double shadow = 0;
|
double shadow = 0;
|
||||||
|
|
||||||
HColor classBorder = lineConfig.getColors().getColor(ColorType.LINE);
|
HColor borderColor = lineConfig.getColors().getColor(ColorType.LINE);
|
||||||
HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER);
|
HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER);
|
||||||
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
||||||
|
|
||||||
shadow = getStyle().value(PName.Shadowing).asDouble();
|
shadow = getStyle().value(PName.Shadowing).asDouble();
|
||||||
|
|
||||||
if (classBorder == null)
|
if (borderColor == null)
|
||||||
classBorder = getStyle().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
borderColor = getStyle().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||||
getSkinParam().getIHtmlColorSet());
|
getSkinParam().getIHtmlColorSet());
|
||||||
|
|
||||||
if (headerBackcolor == null)
|
if (headerBackcolor == null)
|
||||||
@ -189,7 +189,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi
|
|||||||
|
|
||||||
rect.setDeltaShadow(shadow);
|
rect.setDeltaShadow(shadow);
|
||||||
|
|
||||||
ug = ug.apply(classBorder);
|
ug = ug.apply(borderColor);
|
||||||
ug = ug.apply(backcolor.bg());
|
ug = ug.apply(backcolor.bg());
|
||||||
|
|
||||||
final UStroke stroke = getStyle().getStroke(lineConfig.getColors());
|
final UStroke stroke = getStyle().getStroke(lineConfig.getColors());
|
||||||
|
@ -198,6 +198,8 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
|||||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotProtocol);
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotProtocol);
|
||||||
case STRUCT:
|
case STRUCT:
|
||||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStruct);
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStruct);
|
||||||
|
case EXCEPTION:
|
||||||
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotException);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -220,6 +222,8 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
|||||||
return 'P';
|
return 'P';
|
||||||
case STRUCT:
|
case STRUCT:
|
||||||
return 'S';
|
return 'S';
|
||||||
|
case EXCEPTION:
|
||||||
|
return 'X';
|
||||||
}
|
}
|
||||||
assert false;
|
assert false;
|
||||||
return '?';
|
return '?';
|
||||||
|
@ -156,13 +156,16 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
|
|||||||
final double heightTotal = dimTotal.getHeight();
|
final double heightTotal = dimTotal.getHeight();
|
||||||
final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner);
|
final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner);
|
||||||
|
|
||||||
|
HColor borderColor = lineConfig.getColors().getColor(ColorType.LINE);
|
||||||
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
||||||
HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER);
|
HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER);
|
||||||
|
|
||||||
final Style style = getStyle();
|
final Style style = getStyle();
|
||||||
final HColor borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
|
||||||
getSkinParam().getIHtmlColorSet());
|
if (borderColor == null)
|
||||||
|
borderColor = getStyle().value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||||
|
getSkinParam().getIHtmlColorSet());
|
||||||
|
|
||||||
if (headerBackcolor == null)
|
if (headerBackcolor == null)
|
||||||
headerBackcolor = backcolor == null ? getStyleHeader().value(PName.BackGroundColor)
|
headerBackcolor = backcolor == null ? getStyleHeader().value(PName.BackGroundColor)
|
||||||
.asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()) : backcolor;
|
.asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()) : backcolor;
|
||||||
@ -170,7 +173,7 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
|
|||||||
if (backcolor == null)
|
if (backcolor == null)
|
||||||
backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
||||||
getSkinParam().getIHtmlColorSet());
|
getSkinParam().getIHtmlColorSet());
|
||||||
|
|
||||||
rect.setDeltaShadow(style.value(PName.Shadowing).asDouble());
|
rect.setDeltaShadow(style.value(PName.Shadowing).asDouble());
|
||||||
final UStroke stroke = style.getStroke();
|
final UStroke stroke = style.getStroke();
|
||||||
|
|
||||||
@ -184,7 +187,7 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With
|
|||||||
typeIDent.put(UGroupType.ID, "elem_" + getEntity().getCode());
|
typeIDent.put(UGroupType.ID, "elem_" + getEntity().getCode());
|
||||||
ug.startGroup(typeIDent);
|
ug.startGroup(typeIDent);
|
||||||
ug.apply(stroke).draw(rect);
|
ug.apply(stroke).draw(rect);
|
||||||
|
|
||||||
if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) {
|
if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) {
|
||||||
final Shadowable rect2 = new URectangle(widthTotal, dimTitle.getHeight());
|
final Shadowable rect2 = new URectangle(widthTotal, dimTitle.getHeight());
|
||||||
final UGraphic ugHeader = ug.apply(headerBackcolor.bg());
|
final UGraphic ugHeader = ug.apply(headerBackcolor.bg());
|
||||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
|||||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||||
import net.sourceforge.plantuml.ugraphic.UBackground;
|
import net.sourceforge.plantuml.ugraphic.UBackground;
|
||||||
import net.sourceforge.plantuml.ugraphic.UChange;
|
import net.sourceforge.plantuml.ugraphic.UChange;
|
||||||
|
import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||||
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
import net.sourceforge.plantuml.ugraphic.UEmpty;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphicNo;
|
import net.sourceforge.plantuml.ugraphic.UGraphicNo;
|
||||||
@ -111,6 +112,8 @@ public class Footprint {
|
|||||||
drawPath(x, y, (UPath) shape);
|
drawPath(x, y, (UPath) shape);
|
||||||
} else if (shape instanceof URectangle) {
|
} else if (shape instanceof URectangle) {
|
||||||
drawRectangle(x, y, (URectangle) shape);
|
drawRectangle(x, y, (URectangle) shape);
|
||||||
|
} else if (shape instanceof UEllipse) {
|
||||||
|
drawEllipse(x, y, (UEllipse) shape);
|
||||||
} else if (shape instanceof UEmpty) {
|
} else if (shape instanceof UEmpty) {
|
||||||
drawEmpty(x, y, (UEmpty) shape);
|
drawEmpty(x, y, (UEmpty) shape);
|
||||||
} else {
|
} else {
|
||||||
@ -153,6 +156,11 @@ public class Footprint {
|
|||||||
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawEllipse(double x, double y, UEllipse rect) {
|
||||||
|
addPoint(x, y);
|
||||||
|
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
private void drawEmpty(double x, double y, UEmpty rect) {
|
private void drawEmpty(double x, double y, UEmpty rect) {
|
||||||
addPoint(x, y);
|
addPoint(x, y);
|
||||||
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
addPoint(x + rect.getWidth(), y + rect.getHeight());
|
||||||
|
@ -71,6 +71,7 @@ import net.sourceforge.plantuml.SignatureUtils;
|
|||||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||||
import net.sourceforge.plantuml.code.Base64Coder;
|
import net.sourceforge.plantuml.code.Base64Coder;
|
||||||
import net.sourceforge.plantuml.security.SImageIO;
|
import net.sourceforge.plantuml.security.SImageIO;
|
||||||
|
import net.sourceforge.plantuml.security.SecurityProfile;
|
||||||
import net.sourceforge.plantuml.security.SecurityUtils;
|
import net.sourceforge.plantuml.security.SecurityUtils;
|
||||||
import net.sourceforge.plantuml.tikz.TikzGraphics;
|
import net.sourceforge.plantuml.tikz.TikzGraphics;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGroupType;
|
import net.sourceforge.plantuml.ugraphic.UGroupType;
|
||||||
@ -641,8 +642,19 @@ public class SvgGraphics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void createXml(OutputStream os) throws TransformerException, IOException {
|
public void createXml(OutputStream os) throws TransformerException, IOException {
|
||||||
createXmlInternal(os);
|
if (images.size() == 0) {
|
||||||
// s = removeXmlHeader(s);
|
createXmlInternal(os);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
createXmlInternal(baos);
|
||||||
|
String s = new String(baos.toByteArray());
|
||||||
|
for (Map.Entry<String, String> ent : images.entrySet()) {
|
||||||
|
final String k = "<" + ent.getKey() + "/>";
|
||||||
|
s = s.replace(k, ent.getValue());
|
||||||
|
}
|
||||||
|
s = removeXmlHeader(s);
|
||||||
|
os.write(s.getBytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String removeXmlHeader(String s) {
|
private String removeXmlHeader(String s) {
|
||||||
@ -882,7 +894,30 @@ public class SvgGraphics {
|
|||||||
ensureVisible(x + image.getWidth(), y + image.getHeight());
|
ensureVisible(x + image.getWidth(), y + image.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Map<String, String> images = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
|
private void svgImageUnsecure(UImageSvg image, double x, double y) {
|
||||||
|
if (hidden == false) {
|
||||||
|
String svg = manageScale(image);
|
||||||
|
final String pos = "<svg x=\"" + format(x) + "\" y=\"" + format(y) + "\">";
|
||||||
|
svg = pos + svg.substring(5);
|
||||||
|
final String key = "imagesvginlined" + image.getMD5Hex() + images.size();
|
||||||
|
final Element elt = (Element) document.createElement(key);
|
||||||
|
getG().appendChild(elt);
|
||||||
|
images.put(key, svg);
|
||||||
|
}
|
||||||
|
ensureVisible(x, y);
|
||||||
|
ensureVisible(x + image.getData("width"), y + image.getData("height"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void svgImage(UImageSvg image, double x, double y) {
|
public void svgImage(UImageSvg image, double x, double y) {
|
||||||
|
if (SecurityUtils.getSecurityProfile() == SecurityProfile.UNSECURE) {
|
||||||
|
svgImageUnsecure(image, x, y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// https://developer.mozilla.org/fr/docs/Web/SVG/Element/image
|
// https://developer.mozilla.org/fr/docs/Web/SVG/Element/image
|
||||||
if (hidden == false) {
|
if (hidden == false) {
|
||||||
final Element elt = (Element) document.createElement("image");
|
final Element elt = (Element) document.createElement("image");
|
||||||
|
@ -38,6 +38,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Reader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.AFile;
|
import net.sourceforge.plantuml.AFile;
|
||||||
@ -114,7 +115,11 @@ public class EaterTheme extends Eater {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final FileWithSuffix file = context.getFileWithSuffix(from, realName);
|
final FileWithSuffix file = context.getFileWithSuffix(from, realName);
|
||||||
return ReadLineReader.create(file.getReader(UTF_8), "theme " + realName);
|
final Reader tmp = file.getReader(UTF_8);
|
||||||
|
if (tmp == null)
|
||||||
|
throw EaterException.located("No such theme " + realName);
|
||||||
|
|
||||||
|
return ReadLineReader.create(tmp, "theme " + realName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw EaterException.located("Cannot load " + realName);
|
throw EaterException.located("Cannot load " + realName);
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
package net.sourceforge.plantuml.timingdiagram;
|
package net.sourceforge.plantuml.timingdiagram;
|
||||||
|
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
@ -45,6 +47,7 @@ import net.sourceforge.plantuml.ISkinParam;
|
|||||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||||
import net.sourceforge.plantuml.command.Position;
|
import net.sourceforge.plantuml.command.Position;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
@ -52,6 +55,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
|
|||||||
import net.sourceforge.plantuml.graphic.UDrawable;
|
import net.sourceforge.plantuml.graphic.UDrawable;
|
||||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
|
import net.sourceforge.plantuml.style.StyleSignature;
|
||||||
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||||
import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint;
|
import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
@ -61,14 +65,17 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
|
|||||||
public class PlayerAnalog extends Player {
|
public class PlayerAnalog extends Player {
|
||||||
|
|
||||||
private final SortedMap<TimeTick, Double> values = new TreeMap<TimeTick, Double>();
|
private final SortedMap<TimeTick, Double> values = new TreeMap<TimeTick, Double>();
|
||||||
|
|
||||||
|
private final List<TimeConstraint> constraints = new ArrayList<>();
|
||||||
|
|
||||||
private final double ymargin = 8;
|
private final double ymargin = 8;
|
||||||
private Double initialState;
|
private Double initialState;
|
||||||
private Double start;
|
private Double start;
|
||||||
private Double end;
|
private Double end;
|
||||||
private Integer ticksEvery;
|
private Integer ticksEvery;
|
||||||
|
|
||||||
public PlayerAnalog(String code, ISkinParam skinParam, TimingRuler ruler, boolean compact) {
|
public PlayerAnalog(String code, ISkinParam skinParam, TimingRuler ruler, boolean compact, Stereotype stereotype) {
|
||||||
super(code, skinParam, ruler, compact, null);
|
super(code, skinParam, ruler, compact, stereotype);
|
||||||
this.suggestedHeight = 100;
|
this.suggestedHeight = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,16 +101,17 @@ public class PlayerAnalog extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getFullHeight(StringBounder stringBounder) {
|
public double getFullHeight(StringBounder stringBounder) {
|
||||||
return suggestedHeight;
|
return getHeightForConstraints(stringBounder) + suggestedHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) {
|
public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) {
|
||||||
final double x = ruler.getPosInPixel(tick);
|
final double x = ruler.getPosInPixel(tick);
|
||||||
final double value = getValueAt(tick);
|
final double value = getValueAt(stringBounder, tick);
|
||||||
return new IntricatedPoint(new Point2D.Double(x, getYpos(value)), new Point2D.Double(x, getYpos(value)));
|
return new IntricatedPoint(new Point2D.Double(x, getYpos(stringBounder, value)),
|
||||||
|
new Point2D.Double(x, getYpos(stringBounder, value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getValueAt(TimeTick tick) {
|
private double getValueAt(StringBounder stringBounder, TimeTick tick) {
|
||||||
final Double result = values.get(tick);
|
final Double result = values.get(tick);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
return result;
|
return result;
|
||||||
@ -155,14 +163,14 @@ public class PlayerAnalog extends Player {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
|
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
|
||||||
throw new UnsupportedOperationException();
|
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getYpos(double value) {
|
private double getYpos(StringBounder stringBounder, double value) {
|
||||||
final double fullHeight = getFullHeight(null);
|
final double y = (value - getMin()) * (suggestedHeight - 2 * ymargin) / (getMax() - getMin());
|
||||||
final double y = (value - getMin()) * (fullHeight - 2 * ymargin) / (getMax() - getMin());
|
return getHeightForConstraints(stringBounder) + suggestedHeight - ymargin - y;
|
||||||
return fullHeight - ymargin - y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextBlock getPart1(final double fullAvailableWidth, final double specialVSpace) {
|
public TextBlock getPart1(final double fullAvailableWidth, final double specialVSpace) {
|
||||||
@ -224,7 +232,7 @@ public class PlayerAnalog extends Player {
|
|||||||
final TextBlock label = getTextBlock(value);
|
final TextBlock label = getTextBlock(value);
|
||||||
final Dimension2D dim = label.calculateDimension(ug.getStringBounder());
|
final Dimension2D dim = label.calculateDimension(ug.getStringBounder());
|
||||||
ug = ug.apply(UTranslate.dx(fullAvailableWidth - dim.getWidth() - 2));
|
ug = ug.apply(UTranslate.dx(fullAvailableWidth - dim.getWidth() - 2));
|
||||||
label.drawU(ug.apply(UTranslate.dy(getYpos(value) - dim.getHeight() / 2)));
|
label.drawU(ug.apply(UTranslate.dy(getYpos(ug.getStringBounder(), value) - dim.getHeight() / 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextBlock getTextBlock(double value) {
|
private TextBlock getTextBlock(double value) {
|
||||||
@ -239,7 +247,7 @@ public class PlayerAnalog extends Player {
|
|||||||
final ULine hline = ULine.hline(ruler.getWidth());
|
final ULine hline = ULine.hline(ruler.getWidth());
|
||||||
for (int i = first; i <= last; i++)
|
for (int i = first; i <= last; i++)
|
||||||
if (i % ticksEvery == 0)
|
if (i % ticksEvery == 0)
|
||||||
ug.apply(UTranslate.dy(getYpos(i))).draw(hline);
|
ug.apply(UTranslate.dy(getYpos(ug.getStringBounder(), i))).draw(hline);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,14 +261,18 @@ public class PlayerAnalog extends Player {
|
|||||||
double lastx = 0;
|
double lastx = 0;
|
||||||
double lastValue = initialState == null ? 0 : initialState;
|
double lastValue = initialState == null ? 0 : initialState;
|
||||||
for (Map.Entry<TimeTick, Double> ent : values.entrySet()) {
|
for (Map.Entry<TimeTick, Double> ent : values.entrySet()) {
|
||||||
final double y1 = getYpos(lastValue);
|
final double y1 = getYpos(ug.getStringBounder(), lastValue);
|
||||||
final double y2 = getYpos(ent.getValue());
|
final double y2 = getYpos(ug.getStringBounder(), ent.getValue());
|
||||||
final double x = ruler.getPosInPixel(ent.getKey());
|
final double x = ruler.getPosInPixel(ent.getKey());
|
||||||
ug.apply(new UTranslate(lastx, y1)).draw(new ULine(x - lastx, y2 - y1));
|
ug.apply(new UTranslate(lastx, y1)).draw(new ULine(x - lastx, y2 - y1));
|
||||||
lastx = x;
|
lastx = x;
|
||||||
lastValue = ent.getValue();
|
lastValue = ent.getValue();
|
||||||
}
|
}
|
||||||
ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(ULine.hline(ruler.getWidth() - lastx));
|
ug.apply(new UTranslate(lastx, getYpos(ug.getStringBounder(), lastValue)))
|
||||||
|
.draw(ULine.hline(ruler.getWidth() - lastx));
|
||||||
|
|
||||||
|
drawConstraints(ug.apply(UTranslate.dy(getHeightForConstraints(ug.getStringBounder()))));
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -275,8 +287,19 @@ public class PlayerAnalog extends Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected StyleSignatureBasic getStyleSignature() {
|
protected StyleSignature getStyleSignature() {
|
||||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram);
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.analog)
|
||||||
|
.withTOBECHANGED(stereotype);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawConstraints(final UGraphic ug) {
|
||||||
|
for (TimeConstraint constraint : constraints) {
|
||||||
|
constraint.drawU(ug, ruler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getHeightForConstraints(StringBounder stringBounder) {
|
||||||
|
return TimeConstraint.getHeightForConstraints(stringBounder, constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,7 @@ public class PlayerBinary extends Player {
|
|||||||
return LOW_STRING;
|
return LOW_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
|
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
|
||||||
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam));
|
this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam));
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,7 @@ public class PlayerClock extends Player {
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
|
public void createConstraint(TimeTick tick1, TimeTick tick2, String message) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
@ -313,8 +313,8 @@ public class TimingDiagram extends UmlDiagram implements Clocks {
|
|||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerAnalog createAnalog(String code, String full, boolean compact) {
|
public PlayerAnalog createAnalog(String code, String full, boolean compact, Stereotype stereotype) {
|
||||||
final PlayerAnalog player = new PlayerAnalog(full, getSkinParam(), ruler, compactByDefault);
|
final PlayerAnalog player = new PlayerAnalog(full, getSkinParam(), ruler, compactByDefault, stereotype);
|
||||||
players.put(code, player);
|
players.put(code, player);
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ 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.RegexOptional;
|
||||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||||
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||||
import net.sourceforge.plantuml.timingdiagram.PlayerAnalog;
|
import net.sourceforge.plantuml.timingdiagram.PlayerAnalog;
|
||||||
import net.sourceforge.plantuml.timingdiagram.TimingDiagram;
|
import net.sourceforge.plantuml.timingdiagram.TimingDiagram;
|
||||||
|
|
||||||
@ -61,6 +62,8 @@ public class CommandAnalog extends SingleLineCommand2<TimingDiagram> {
|
|||||||
new RegexLeaf("analog"), //
|
new RegexLeaf("analog"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("FULL", "[%g]([^%g]+)[%g]"), //
|
new RegexLeaf("FULL", "[%g]([^%g]+)[%g]"), //
|
||||||
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
|
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexOptional(//
|
new RegexOptional(//
|
||||||
new RegexConcat( //
|
new RegexConcat( //
|
||||||
@ -74,7 +77,11 @@ public class CommandAnalog extends SingleLineCommand2<TimingDiagram> {
|
|||||||
RegexLeaf.spaceOneOrMore())), //
|
RegexLeaf.spaceOneOrMore())), //
|
||||||
new RegexLeaf("as"), //
|
new RegexLeaf("as"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexLeaf("CODE", "([%pLN_.@]+)"), RegexLeaf.end());
|
new RegexLeaf("CODE", "([%pLN_.@]+)"), //
|
||||||
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
|
new RegexLeaf("STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), //
|
||||||
|
RegexLeaf.spaceZeroOrMore(), //
|
||||||
|
RegexLeaf.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -82,7 +89,14 @@ public class CommandAnalog extends SingleLineCommand2<TimingDiagram> {
|
|||||||
final String compact = arg.get("COMPACT", 0);
|
final String compact = arg.get("COMPACT", 0);
|
||||||
final String code = arg.get("CODE", 0);
|
final String code = arg.get("CODE", 0);
|
||||||
final String full = arg.get("FULL", 0);
|
final String full = arg.get("FULL", 0);
|
||||||
final PlayerAnalog player = diagram.createAnalog(code, full, compact != null);
|
|
||||||
|
Stereotype stereotype = null;
|
||||||
|
if (arg.get("STEREOTYPE", 0) != null)
|
||||||
|
stereotype = Stereotype.build(arg.get("STEREOTYPE", 0));
|
||||||
|
else if (arg.get("STEREOTYPE2", 0) != null)
|
||||||
|
stereotype = Stereotype.build(arg.get("STEREOTYPE2", 0));
|
||||||
|
|
||||||
|
final PlayerAnalog player = diagram.createAnalog(code, full, compact != null, stereotype);
|
||||||
final String start = arg.get("START", 0);
|
final String start = arg.get("START", 0);
|
||||||
final String end = arg.get("END", 0);
|
final String end = arg.get("END", 0);
|
||||||
if (start != null && end != null) {
|
if (start != null && end != null) {
|
||||||
|
@ -151,7 +151,8 @@ public class Ribbon implements PDrawing {
|
|||||||
private void drawNotes(UGraphic ug, final Position position) {
|
private void drawNotes(UGraphic ug, final Position position) {
|
||||||
for (TimingNote note : notes)
|
for (TimingNote note : notes)
|
||||||
if (note.getPosition() == position) {
|
if (note.getPosition() == position) {
|
||||||
final double x = ruler.getPosInPixel(note.getWhen());
|
final TimeTick when = note.getWhen();
|
||||||
|
final double x = when == null ? 0 : ruler.getPosInPixel(when);
|
||||||
note.drawU(ug.apply(UTranslate.dx(x)));
|
note.drawU(ug.apply(UTranslate.dx(x)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,12 @@ public class UImageSvg implements UShape {
|
|||||||
throw new IllegalStateException("Cannot find " + name);
|
throw new IllegalStateException("Cannot find " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeight() {
|
public double getHeight() {
|
||||||
return this.getData("height");
|
return this.getData("height") * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public double getWidth() {
|
||||||
return this.getData("width");
|
return this.getData("width") * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getScale() {
|
public double getScale() {
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.ugraphic;
|
package net.sourceforge.plantuml.ugraphic;
|
||||||
|
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
|
||||||
public class ULine extends AbstractShadowable implements UShapeSized {
|
public class ULine extends AbstractShadowable implements UShapeSized {
|
||||||
@ -51,6 +52,14 @@ public class ULine extends AbstractShadowable implements UShapeSized {
|
|||||||
this.dy = dy;
|
this.dy = dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ULine rotate(double theta) {
|
||||||
|
if (theta == 0)
|
||||||
|
return this;
|
||||||
|
final AffineTransform rot = AffineTransform.getRotateInstance(theta);
|
||||||
|
final Point2D result = rot.transform(new Point2D.Double(dx, dy), null);
|
||||||
|
return new ULine(result.getX(), result.getY());
|
||||||
|
}
|
||||||
|
|
||||||
public static ULine hline(double dx) {
|
public static ULine hline(double dx) {
|
||||||
return new ULine(dx, 0);
|
return new ULine(dx, 0);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class UPolygon extends AbstractShadowable {
|
|||||||
(pt1.getY() + pt2.getY()) / 2);
|
(pt1.getY() + pt2.getY()) / 2);
|
||||||
final double delta = middle.distance(center);
|
final double delta = middle.distance(center);
|
||||||
if (delta < 1)
|
if (delta < 1)
|
||||||
return all.get((i - 1) % all.size());
|
return all.get((i + all.size() - 1) % all.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -44,7 +44,7 @@ public class Version {
|
|||||||
private static final int MAJOR_SEPARATOR = 1000000;
|
private static final int MAJOR_SEPARATOR = 1000000;
|
||||||
|
|
||||||
public static int version() {
|
public static int version() {
|
||||||
return 1202205;
|
return 1202206;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int versionPatched() {
|
public static int versionPatched() {
|
||||||
@ -80,7 +80,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 5;
|
final int beta = 3;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long compileTime() {
|
public static long compileTime() {
|
||||||
return 1651316152000L;
|
return 1655832889469L;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String compileTimeString() {
|
public static String compileTimeString() {
|
||||||
|
@ -44,15 +44,15 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class YamlLines implements Iterable<String> {
|
public class YamlLines implements Iterable<String> {
|
||||||
|
|
||||||
public static final String KEY = "([^:\\s]+)";
|
public static final String KEY = "([^:]+)";
|
||||||
|
|
||||||
private List<String> lines = new ArrayList<>();
|
private List<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
public YamlLines(List<String> rawLines) {
|
public YamlLines(List<String> rawLines) {
|
||||||
for (String s : rawLines) {
|
for (String s : rawLines) {
|
||||||
if (s.startsWith("#")) {
|
if (s.startsWith("#"))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
s = removeDiese(s);
|
s = removeDiese(s);
|
||||||
if (s.trim().length() == 0)
|
if (s.trim().length() == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -79,9 +79,9 @@ public class YamlLines implements Iterable<String> {
|
|||||||
|
|
||||||
private String removeDiese(String s) {
|
private String removeDiese(String s) {
|
||||||
final int idx = s.indexOf(" #");
|
final int idx = s.indexOf(" #");
|
||||||
if (idx == -1) {
|
if (idx == -1)
|
||||||
return s;
|
return s;
|
||||||
}
|
|
||||||
return s.substring(0, idx);
|
return s.substring(0, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +104,9 @@ public class YamlLines implements Iterable<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeFirstCols(int startingEmptyCols) {
|
private void removeFirstCols(int startingEmptyCols) {
|
||||||
if (startingEmptyCols == 0) {
|
if (startingEmptyCols == 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
for (ListIterator<String> it = lines.listIterator(); it.hasNext();) {
|
for (ListIterator<String> it = lines.listIterator(); it.hasNext();) {
|
||||||
final String s = it.next().substring(startingEmptyCols);
|
final String s = it.next().substring(startingEmptyCols);
|
||||||
it.set(s);
|
it.set(s);
|
||||||
@ -117,9 +117,8 @@ public class YamlLines implements Iterable<String> {
|
|||||||
int result = Integer.MAX_VALUE;
|
int result = Integer.MAX_VALUE;
|
||||||
for (String s : lines) {
|
for (String s : lines) {
|
||||||
result = Math.min(result, startingSpaces(s));
|
result = Math.min(result, startingSpaces(s));
|
||||||
if (result == 0) {
|
if (result == 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -127,9 +126,9 @@ public class YamlLines implements Iterable<String> {
|
|||||||
private static int startingSpaces(String s) {
|
private static int startingSpaces(String s) {
|
||||||
final Pattern p1 = Pattern.compile("^(\\s*).*");
|
final Pattern p1 = Pattern.compile("^(\\s*).*");
|
||||||
final Matcher m1 = p1.matcher(s);
|
final Matcher m1 = p1.matcher(s);
|
||||||
if (m1.matches()) {
|
if (m1.matches())
|
||||||
return m1.group(1).length();
|
return m1.group(1).length();
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,12 @@ public class CompositeDiagramShape extends DiagramComponent {
|
|||||||
if(workGrid.cellContainsDashedLineChar(previousCell)) shape.setStrokeDashed(true);
|
if(workGrid.cellContainsDashedLineChar(previousCell)) shape.setStrokeDashed(true);
|
||||||
|
|
||||||
boolean finished = false;
|
boolean finished = false;
|
||||||
|
int nb = 0;
|
||||||
while(!finished) {
|
while(!finished) {
|
||||||
|
// https://github.com/plantuml/plantuml/issues/1036
|
||||||
|
nb++;
|
||||||
|
if (nb > 1000)
|
||||||
|
return result;
|
||||||
visitedCells.add(cell);
|
visitedCells.add(cell);
|
||||||
if(workGrid.isPointCell(cell)) {
|
if(workGrid.isPointCell(cell)) {
|
||||||
if(DEBUG) System.out.println("point at "+cell+" (call from line: "+DebugUtils.getLineNumber()+")");
|
if(DEBUG) System.out.println("point at "+cell+" (call from line: "+DebugUtils.getLineNumber()+")");
|
||||||
|
Loading…
Reference in New Issue
Block a user