From 136819ca484cd9d3c725e21bdd6fad56e905e4da Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Sun, 3 May 2015 17:36:36 +0200 Subject: [PATCH] version 8024 --- pom.xml | 5 +- src/net/sourceforge/plantuml/ISkinParam.java | 3 + src/net/sourceforge/plantuml/SkinParam.java | 24 +- .../plantuml/SkinParamDelegator.java | 5 + .../plantuml/cucadiagram/BodyEnhanced2.java | 7 +- .../plantuml/donors/PSystemDonors.java | 2 +- .../sourceforge/plantuml/eps/EpsGraphics.java | 6 +- .../plantuml/graphic/FontConfiguration.java | 14 +- .../plantuml/graphic/QuoteUtils.java | 2 + .../plantuml/graphic/SkinParameter.java | 130 ++++++++++ .../plantuml/graphic/SymbolContext.java | 46 +++- .../sourceforge/plantuml/graphic/USymbol.java | 71 ++---- .../plantuml/graphic/USymbolActor.java | 13 +- .../plantuml/graphic/USymbolArtifact.java | 9 +- .../plantuml/graphic/USymbolBoundary.java | 14 +- .../plantuml/graphic/USymbolCard.java | 15 +- .../plantuml/graphic/USymbolCloud.java | 8 +- .../plantuml/graphic/USymbolComponent1.java | 9 +- .../plantuml/graphic/USymbolComponent2.java | 7 +- .../plantuml/graphic/USymbolControl.java | 16 +- .../plantuml/graphic/USymbolDatabase.java | 10 +- .../plantuml/graphic/USymbolEntityDomain.java | 15 +- .../plantuml/graphic/USymbolFolder.java | 13 +- .../plantuml/graphic/USymbolFrame.java | 8 +- .../plantuml/graphic/USymbolInterface.java | 10 +- .../plantuml/graphic/USymbolNode.java | 13 +- .../plantuml/graphic/USymbolQueue.java | 8 +- .../plantuml/graphic/USymbolRect.java | 16 +- .../graphic/USymbolSimpleAbstract.java | 11 - .../plantuml/graphic/USymbolStorage.java | 7 +- .../sourceforge/plantuml/png/PngTitler.java | 6 +- .../sourceforge/plantuml/postit/PostIt.java | 7 +- .../plantuml/preproc/PreprocessorInclude.java | 14 +- .../sequencediagram/AbstractMessage.java | 11 +- .../plantuml/sequencediagram/Note.java | 8 +- .../plantuml/sequencediagram/Participant.java | 14 +- .../graphic/DrawableSetInitializer.java | 14 +- .../SequenceDiagramFileMakerPuma2.java | 3 +- .../sequencediagram/graphic/Step1Message.java | 5 +- .../graphic/Step1MessageExo.java | 3 +- .../teoz/CommunicationExoTile.java | 16 +- .../teoz/CommunicationTileNoteLeft.java | 10 +- .../teoz/CommunicationTileNoteRight.java | 18 +- .../teoz/CommunicationTileSelfNoteRight.java | 2 +- .../sequencediagram/teoz/EventsHistory.java | 26 +- .../sequencediagram/teoz/GroupingTile.java | 19 +- .../teoz/IntegerColored.java} | 29 ++- .../sequencediagram/teoz/LiveBoxes.java | 21 +- .../sequencediagram/teoz/LivingSpace.java | 9 +- .../sequencediagram/teoz/LivingSpaces.java | 42 +++ .../sequencediagram/teoz/NoteTile.java | 3 +- .../sequencediagram/teoz/ReferenceTile.java | 1 - .../teoz/SequenceDiagramFileMakerTeoz.java | 147 ++++++++--- .../sequencediagram/teoz/Stairs2.java | 35 +-- .../sequencediagram/teoz/StairsPosition.java | 1 + .../sequencediagram/teoz/TileArguments.java | 18 +- .../sequencediagram/teoz/TileBuilder.java | 28 +- .../skin/AbstractTextualComponent.java | 23 +- .../sourceforge/plantuml/skin/StickMan.java | 52 ++-- .../AbstractComponentBlueModernArrow.java | 6 +- .../plantuml/skin/bluemodern/BlueModern.java | 61 +++-- .../bluemodern/ComponentBlueModernActor.java | 6 +- .../bluemodern/ComponentBlueModernArrow.java | 6 +- .../ComponentBlueModernDelayText.java | 4 +- .../ComponentBlueModernDivider.java | 4 +- .../ComponentBlueModernEnglober.java | 4 +- .../ComponentBlueModernGroupingHeader.java | 5 +- .../bluemodern/ComponentBlueModernNote.java | 6 +- .../ComponentBlueModernParticipant.java | 6 +- .../ComponentBlueModernSelfArrow.java | 6 +- .../skin/rose/AbstractComponentRoseArrow.java | 6 +- .../skin/rose/ComponentRoseActiveLine.java | 24 +- .../skin/rose/ComponentRoseActor.java | 18 +- .../skin/rose/ComponentRoseArrow.java | 4 +- .../skin/rose/ComponentRoseBoundary.java | 16 +- .../skin/rose/ComponentRoseControl.java | 16 +- .../skin/rose/ComponentRoseDatabase.java | 17 +- .../skin/rose/ComponentRoseDelayText.java | 4 +- .../skin/rose/ComponentRoseDivider.java | 4 +- .../skin/rose/ComponentRoseEnglober.java | 20 +- .../skin/rose/ComponentRoseEntity.java | 16 +- .../skin/rose/ComponentRoseGroupingElse.java | 17 +- .../rose/ComponentRoseGroupingHeader.java | 34 +-- .../plantuml/skin/rose/ComponentRoseNote.java | 32 +-- .../skin/rose/ComponentRoseNoteBox.java | 29 +-- .../skin/rose/ComponentRoseNoteHexagonal.java | 30 +-- .../skin/rose/ComponentRoseParticipant.java | 24 +- .../skin/rose/ComponentRoseReference.java | 38 +-- .../skin/rose/ComponentRoseSelfArrow.java | 6 +- .../skin/rose/ComponentRoseTitle.java | 6 +- .../sourceforge/plantuml/skin/rose/Rose.java | 240 ++++++++---------- .../sourceforge/plantuml/svek/Boundary.java | 25 +- .../sourceforge/plantuml/svek/Control.java | 21 +- .../plantuml/svek/EntityDomain.java | 23 +- .../svek/image/EntityImageComponent.java | 2 +- .../plantuml/svek/image/EntityImageNote.java | 6 +- .../plantuml/tikz/TikzGraphics.java | 2 +- .../sourceforge/plantuml/ugraphic/UFont.java | 5 +- .../sourceforge/plantuml/ugraphic/UFont2.java | 69 ----- .../sourceforge/plantuml/utils/MathUtils.java | 4 + .../sourceforge/plantuml/version/Version.java | 14 +- 101 files changed, 1114 insertions(+), 874 deletions(-) create mode 100644 src/net/sourceforge/plantuml/graphic/SkinParameter.java rename src/net/sourceforge/plantuml/{skin/BiColor.java => sequencediagram/teoz/IntegerColored.java} (74%) delete mode 100644 src/net/sourceforge/plantuml/ugraphic/UFont2.java diff --git a/pom.xml b/pom.xml index f9c04acb3..dfaa7264e 100644 --- a/pom.xml +++ b/pom.xml @@ -30,13 +30,12 @@ Script Author: Julien Eluard --> - + 4.0.0 net.sourceforge.plantuml plantuml - 8023-SNAPSHOT + 8025-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 658cc028a..d70356759 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.ColorMapper; @@ -80,6 +81,8 @@ public interface ISkinParam extends ISkinSimple { public boolean shadowing(); + public boolean shadowing2(SkinParameter skinParameter); + public PackageStyle getPackageStyle(); public boolean useUml2ForComponent(); diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 6d0113d5c..3b0650178 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15870 $ + * Revision $Revision: 15982 $ * */ package net.sourceforge.plantuml; @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.ColorMapper; @@ -434,6 +435,27 @@ public class SkinParam implements ISkinParam { return true; } + public boolean shadowing2(SkinParameter skinParameter) { + if (skinParameter == null) { + throw new IllegalArgumentException(); + } + final String name = skinParameter.getUpperCaseName(); + final String value = getValue(name + "shadowing"); + if (value == null) { + return shadowing(); + } + if ("false".equalsIgnoreCase(value)) { + return false; + } + if ("true".equalsIgnoreCase(value)) { + return true; + } + if (strictUmlStyle()) { + return false; + } + return true; + } + public PackageStyle getPackageStyle() { final String value = getValue("packageStyle"); final PackageStyle p = PackageStyle.fromString(value); diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index ef18305f5..f171e1bda 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.graphic.SkinParameter; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.ColorMapper; @@ -111,6 +112,10 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.shadowing(); } + public boolean shadowing2(SkinParameter skinParameter) { + return skinParam.shadowing2(skinParameter); + } + public PackageStyle getPackageStyle() { return skinParam.getPackageStyle(); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java index 86375453d..46e28d7c4 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java @@ -61,13 +61,12 @@ public class BodyEnhanced2 implements TextBlock { // private final List urls = new ArrayList(); - public BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple spriteContainer, - HorizontalAlignment align, UFont fontNote, HtmlColor fontColor, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { + public BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple spriteContainer, HorizontalAlignment align, + FontConfiguration titleConfig) { this.rawBody2 = rawBody; - // this.fontParam = fontParam; this.spriteContainer = spriteContainer; - this.titleConfig = new FontConfiguration(fontNote, fontColor, hyperlinkColor, useUnderlineForHyperlink); + this.titleConfig = titleConfig; this.align = align; } diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index f5661d986..9de967620 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemDonors extends AbstractPSystem { - public static final String DONORS = "UDfTaajImp0CXlSwXTUPuH2XOSg4yfYMOS5EJKJZrfMAxHIIqwC2gTrgPOrUto-vTCM_aOSNYkHDoL7OOWElL2IJFImakJv0EPNY6kO-XMY05QqnH8jidgHZABaLR-P2SQJJy-D3CwPqP5XWDeWZL7Poh8CojPOZhFg4CC3S5fV60lL4sGTOHJfqn6OcSb1zrJI70Zpihqh5mqoSPREKFX3K_LMys8eAcPo3XSUC6lUvgwDAHz_8hQvprbdjka4_gDBbMJPlu2cdZoCyEtlKWiesEoK_Hop3NJYtvWoYe2DKuzv6FvW5Tj8YrAUbltUexREyWbmwbzfkq3KnHirJFkMg_-1fTw6Asmltjz9g8wTbppxQ4UvJk1Luj4r7pjoYTKEkm8qvJ0ZNQ3KXtzJOVFOKJDMlFUffNPB_9jj8JMSUF0PCI1lI7viTy0j-0FkXkCC0"; + public static final String DONORS = "UDfTaikosZ0CXlTw2gypquT8IOTEu5pcqEcYEv7e41sCH6s7DddwYhR11gsiqUtx9TU--cyKu9KI1LTBKc7iu1jLsVG4MyrkY50lfRY7TSWXcc17Uuo9KTop3WArz1hSMYdDT7s-lrl6aeu2Mom6IOA65uSzrBcrNc0tPeG9rbpTcoYq2-KOOPVeF92ubUhPz3NB78gmEJsKQe2LUXRtfcCaQCU7UFMX9cHnpWnF1JMUIjT6rPv-e_IspjN0rlM0OJAbRpVPSe3daZxDyEBvOWKDTqSZlqLOu4kyjPO2eg8BDFE9KvZS5WVj4ThhqdyCQEsBl8fyFfVPSR8r2IRBCpxZQl_1q_5EbVHtxjzAjaRUobv2uXc-vd2lyCJTGDvzHlPJgS3F9KoCZsWjeNngiVivKdJDk0zef_LP_dVzIDGDRXCmOaOwaFtOue2_hX_DKjn6Bmn_0C5QlDy0"; // public ImageData exportDiagram(OutputStream os, int num, FileFormatOption // fileFormat) throws IOException { diff --git a/src/net/sourceforge/plantuml/eps/EpsGraphics.java b/src/net/sourceforge/plantuml/eps/EpsGraphics.java index 49e7fb83e..30f26d0a0 100644 --- a/src/net/sourceforge/plantuml/eps/EpsGraphics.java +++ b/src/net/sourceforge/plantuml/eps/EpsGraphics.java @@ -72,11 +72,7 @@ public class EpsGraphics { public EpsGraphics() { header.append("%!PS-Adobe-3.0 EPSF-3.0\n"); - String v = Version.versionString(); - if (v.endsWith("beta") == false) { - v += " "; - } - header.append("%%Creator: PlantUML v" + v + "\n"); + header.append("%%Creator: PlantUML v" + Version.versionString(10) + "\n"); header.append("%%Title: noTitle\n"); // header.append("%%CreationDate: " + new Date() + "\n"); setcolorgradient.add(new PostScriptCommandRaw("3 index 7 index sub 1 index mul 7 index add", true)); diff --git a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java index 485b4062d..9ad78ea29 100644 --- a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java +++ b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15812 $ + * Revision $Revision: 15932 $ * */ package net.sourceforge.plantuml.graphic; @@ -65,6 +65,18 @@ public class FontConfiguration { this(SkinParamUtils.getFont(skinParam, fontParam, stereo), SkinParamUtils.getFontColor(skinParam, fontParam, stereo), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); } + + //--- + + public final boolean useUnderlineForHyperlink() { + return useUnderlineForHyperlink; + } + + public final HtmlColor getHyperlinkColor() { + return hyperlinkColor; + } + + //--- private static EnumSet getStyles(UFont font) { final boolean bold = font.isBold(); diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index 8a6f5331d..f1df1c826 100644 --- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -146,6 +146,8 @@ public class QuoteUtils { "You Shall Not Pass", // "73.6% Of All Statistics Are Made Up", // "We can neither confirm nor deny that this is crashing" + // When the beating of your heart echoes the beating of the drums + // Never trust a computer you can't throw out a window ); private QuoteUtils() { } diff --git a/src/net/sourceforge/plantuml/graphic/SkinParameter.java b/src/net/sourceforge/plantuml/graphic/SkinParameter.java new file mode 100644 index 000000000..ab084967e --- /dev/null +++ b/src/net/sourceforge/plantuml/graphic/SkinParameter.java @@ -0,0 +1,130 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2014, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 8066 $ + * + */ +package net.sourceforge.plantuml.graphic; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.FontParam; + +public class SkinParameter { + + public static final SkinParameter DATABASE = new SkinParameter("DATABASE", ColorParam.databaseBackground, + ColorParam.databaseBorder, FontParam.DATABASE, FontParam.DATABASE_STEREOTYPE); + + public static final SkinParameter ARTIFACT = new SkinParameter("ARTIFACT", ColorParam.artifactBackground, + ColorParam.artifactBorder, FontParam.ARTIFACT, FontParam.ARTIFACT_STEREOTYPE); + + public static final SkinParameter COMPONENT1 = new SkinParameter("COMPONENT1", ColorParam.componentBackground, + ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE); + + public static final SkinParameter NODE = new SkinParameter("NODE", ColorParam.nodeBackground, + ColorParam.nodeBorder, FontParam.NODE, FontParam.NODE_STEREOTYPE); + + public static final SkinParameter STORAGE = new SkinParameter("STORAGE", ColorParam.storageBackground, + ColorParam.storageBorder, FontParam.STORAGE, FontParam.STORAGE_STEREOTYPE); + + public static final SkinParameter QUEUE = new SkinParameter("QUEUE", ColorParam.queueBackground, + ColorParam.queueBorder, FontParam.QUEUE, FontParam.QUEUE_STEREOTYPE); + + public static final SkinParameter CLOUD = new SkinParameter("CLOUD", ColorParam.cloudBackground, + ColorParam.cloudBorder, FontParam.CLOUD, FontParam.CLOUD_STEREOTYPE); + + public static final SkinParameter FRAME = new SkinParameter("FRAME", ColorParam.frameBackground, + ColorParam.frameBorder, FontParam.FRAME, FontParam.FRAME_STEREOTYPE); + + public static final SkinParameter COMPONENT2 = new SkinParameter("COMPONENT2", ColorParam.componentBackground, + ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE); + + public static final SkinParameter AGENT = new SkinParameter("AGENT", ColorParam.agentBackground, + ColorParam.agentBorder, FontParam.AGENT, FontParam.AGENT_STEREOTYPE); + + public static final SkinParameter FOLDER = new SkinParameter("FOLDER", ColorParam.folderBackground, + ColorParam.folderBorder, FontParam.FOLDER, FontParam.FOLDER_STEREOTYPE); + + public static final SkinParameter PACKAGE = new SkinParameter("PACKAGE", ColorParam.packageBackground, + ColorParam.packageBorder, FontParam.FOLDER, FontParam.FOLDER_STEREOTYPE); + + public static final SkinParameter CARD = new SkinParameter("CARD", ColorParam.rectangleBackground, + ColorParam.rectangleBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE); + + public static final SkinParameter ACTOR = new SkinParameter("ACTOR", ColorParam.actorBackground, + ColorParam.actorBorder, FontParam.ACTOR, FontParam.ACTOR_STEREOTYPE); + + public static final SkinParameter BOUNDARY = new SkinParameter("BOUNDARY", ColorParam.boundaryBackground, + ColorParam.boundaryBorder, FontParam.BOUNDARY, FontParam.BOUNDARY_STEREOTYPE); + + public static final SkinParameter CONTROL = new SkinParameter("CONTROL", ColorParam.controlBackground, + ColorParam.controlBorder, FontParam.CONTROL, FontParam.CONTROL_STEREOTYPE); + + public static final SkinParameter ENTITY_DOMAIN = new SkinParameter("ENTITY_DOMAIN", ColorParam.entityBackground, + ColorParam.entityBorder, FontParam.ENTITY, FontParam.ENTITY_STEREOTYPE); + + public static final SkinParameter INTERFACE = new SkinParameter("INTERFACE", ColorParam.interfaceBackground, + ColorParam.interfaceBorder, FontParam.INTERFACE, FontParam.INTERFACE_STEREOTYPE); + + private final ColorParam colorParamBorder; + private final ColorParam colorParamBack; + private final FontParam fontParam; + private final FontParam fontParamStereotype; + private final String name; + + private SkinParameter(String name, ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, + FontParam fontParamStereotype) { + this.name = name; + this.colorParamBack = colorParamBack; + this.colorParamBorder = colorParamBorder; + this.fontParam = fontParam; + this.fontParamStereotype = fontParamStereotype; + } + + public String getUpperCaseName() { + return name; + } + + public ColorParam getColorParamBorder() { + return colorParamBorder; + } + + public ColorParam getColorParamBack() { + return colorParamBack; + } + + public FontParam getFontParam() { + return fontParam; + } + + public FontParam getFontParamStereotype() { + return fontParamStereotype; + } + +} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/SymbolContext.java b/src/net/sourceforge/plantuml/graphic/SymbolContext.java index db5e2a9b0..f33b5ff4d 100644 --- a/src/net/sourceforge/plantuml/graphic/SymbolContext.java +++ b/src/net/sourceforge/plantuml/graphic/SymbolContext.java @@ -44,31 +44,55 @@ public class SymbolContext { private final HtmlColor foreColor; private final UStroke stroke; private final boolean shadowing; + private final double deltaShadow; - private SymbolContext(HtmlColor backColor, HtmlColor foreColor, UStroke stroke, boolean shadowing) { + private SymbolContext(HtmlColor backColor, HtmlColor foreColor, UStroke stroke, boolean shadowing, + double deltaShadow) { this.backColor = backColor; this.foreColor = foreColor; this.stroke = stroke; this.shadowing = shadowing; -// if (backColor instanceof HtmlColorTransparent) { -// throw new UnsupportedOperationException(); -// } + this.deltaShadow = deltaShadow; + // if (backColor instanceof HtmlColorTransparent) { + // throw new UnsupportedOperationException(); + // } + } + + @Override + public String toString() { + return super.toString() + " backColor=" + backColor + " foreColor=" + foreColor; } final public UGraphic apply(UGraphic ug) { - return ug.apply(new UChangeColor(foreColor)).apply(new UChangeBackColor(backColor)).apply(stroke); + return applyStroke(applyColors(ug)); + } + + public UGraphic applyColors(UGraphic ug) { + return ug.apply(new UChangeColor(foreColor)).apply(new UChangeBackColor(backColor)); + } + + public UGraphic applyStroke(UGraphic ug) { + return ug.apply(stroke); } public SymbolContext(HtmlColor backColor, HtmlColor foreColor) { - this(backColor, foreColor, new UStroke(), false); + this(backColor, foreColor, new UStroke(), false, 0); } public SymbolContext withShadow(boolean newShadow) { - return new SymbolContext(backColor, foreColor, stroke, newShadow); + return new SymbolContext(backColor, foreColor, stroke, newShadow, deltaShadow); + } + + public SymbolContext withDeltaShadow(double deltaShadow) { + return new SymbolContext(backColor, foreColor, stroke, shadowing, deltaShadow); } public SymbolContext withStroke(UStroke newStroke) { - return new SymbolContext(backColor, foreColor, newStroke, shadowing); + return new SymbolContext(backColor, foreColor, newStroke, shadowing, deltaShadow); + } + + public SymbolContext withBackColor(HtmlColor backColor) { + return new SymbolContext(backColor, foreColor, stroke, shadowing, deltaShadow); } public HtmlColor getBackColor() { @@ -84,7 +108,11 @@ public class SymbolContext { } public boolean isShadowing() { - return shadowing; + return shadowing || deltaShadow > 0; + } + + public double getDeltaShadow() { + return deltaShadow; } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/net/sourceforge/plantuml/graphic/USymbol.java index bfe6ed70a..7fe7000a3 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbol.java +++ b/src/net/sourceforge/plantuml/graphic/USymbol.java @@ -46,61 +46,46 @@ public abstract class USymbol { private static final Map all = new HashMap(); - public final static USymbol STORAGE = record("STORAGE", new USymbolStorage()); - public final static USymbol DATABASE = record("DATABASE", new USymbolDatabase()); - public final static USymbol CLOUD = record("CLOUD", new USymbolCloud()); - public final static USymbol CARD = record("CARD", new USymbolCard(ColorParam.rectangleBackground, - ColorParam.rectangleBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE)); - public final static USymbol FRAME = record("FRAME", new USymbolFrame()); - public final static USymbol NODE = record("NODE", new USymbolNode()); - public final static USymbol ARTIFACT = record("ARTIFACT", new USymbolArtifact()); - public final static USymbol PACKAGE = record("PACKAGE", new USymbolFolder(ColorParam.packageBackground, - ColorParam.packageBorder)); - public final static USymbol FOLDER = record("FOLDER", new USymbolFolder(ColorParam.folderBackground, - ColorParam.folderBorder)); - public final static USymbol RECTANGLE = record("RECTANGLE", new USymbolRect(ColorParam.rectangleBackground, - ColorParam.rectangleBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE)); - public final static USymbol AGENT = record("AGENT", new USymbolRect(ColorParam.agentBackground, - ColorParam.agentBorder, FontParam.AGENT, FontParam.AGENT_STEREOTYPE)); - public final static USymbol ACTOR = record("ACTOR", new USymbolActor()); + public final static USymbol STORAGE = record("STORAGE", SkinParameter.STORAGE, new USymbolStorage()); + public final static USymbol DATABASE = record("DATABASE", SkinParameter.DATABASE, new USymbolDatabase()); + public final static USymbol CLOUD = record("CLOUD", SkinParameter.CLOUD, new USymbolCloud()); + public final static USymbol CARD = record("CARD", SkinParameter.CARD, new USymbolCard(SkinParameter.CARD)); + public final static USymbol FRAME = record("FRAME", SkinParameter.FRAME, new USymbolFrame()); + public final static USymbol NODE = record("NODE", SkinParameter.NODE, new USymbolNode()); + public final static USymbol ARTIFACT = record("ARTIFACT", SkinParameter.ARTIFACT, new USymbolArtifact()); + public final static USymbol PACKAGE = record("PACKAGE", SkinParameter.PACKAGE, new USymbolFolder( + SkinParameter.PACKAGE)); + public final static USymbol FOLDER = record("FOLDER", SkinParameter.FOLDER, new USymbolFolder(SkinParameter.FOLDER)); + public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.CARD, new USymbolRect(SkinParameter.CARD)); + public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT)); + public final static USymbol ACTOR = record("ACTOR", SkinParameter.ACTOR, new USymbolActor()); public final static USymbol USECASE = null; - public final static USymbol COMPONENT1 = record("COMPONENT1", new USymbolComponent1()); - public final static USymbol COMPONENT2 = record("COMPONENT2", new USymbolComponent2()); - public final static USymbol BOUNDARY = record("BOUNDARY", new USymbolBoundary()); - public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", new USymbolEntityDomain(2)); - public final static USymbol CONTROL = record("CONTROL", new USymbolControl(2)); - public final static USymbol INTERFACE = record("INTERFACE", new USymbolInterface()); - public final static USymbol QUEUE = record("QUEUE", new USymbolQueue()); + public final static USymbol COMPONENT1 = record("COMPONENT1", SkinParameter.COMPONENT1, new USymbolComponent1()); + public final static USymbol COMPONENT2 = record("COMPONENT2", SkinParameter.COMPONENT2, new USymbolComponent2()); + public final static USymbol BOUNDARY = record("BOUNDARY", SkinParameter.BOUNDARY, new USymbolBoundary()); + public final static USymbol ENTITY_DOMAIN = record("ENTITY_DOMAIN", SkinParameter.ENTITY_DOMAIN, + new USymbolEntityDomain(2)); + public final static USymbol CONTROL = record("CONTROL", SkinParameter.CONTROL, new USymbolControl(2)); + public final static USymbol INTERFACE = record("INTERFACE", SkinParameter.INTERFACE, new USymbolInterface()); + public final static USymbol QUEUE = record("QUEUE", SkinParameter.QUEUE, new USymbolQueue()); - private final ColorParam colorParamBorder; - private final ColorParam colorParamBack; - private final FontParam fontParam; - private final FontParam fontParamStereotype; - - public USymbol(ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, - FontParam fontParamStereotype) { - this.colorParamBack = colorParamBack; - this.colorParamBorder = colorParamBorder; - this.fontParam = fontParam; - this.fontParamStereotype = fontParamStereotype; - } + abstract public SkinParameter getSkinParameter(); public FontParam getFontParam() { - return fontParam; - + return getSkinParameter().getFontParam(); } public FontParam getFontParamStereotype() { - return fontParamStereotype; + return getSkinParameter().getFontParamStereotype(); } public ColorParam getColorParamBack() { - return colorParamBack; + return getSkinParameter().getColorParamBack(); } public ColorParam getColorParamBorder() { - return colorParamBorder; + return getSkinParameter().getColorParamBorder(); } public static USymbol getFromString(String s) { @@ -114,7 +99,7 @@ public abstract class USymbol { return result; } - private static USymbol record(String code, USymbol symbol) { + private static USymbol record(String code, SkinParameter skinParameter, USymbol symbol) { all.put(StringUtils.goUpperCase(code), symbol); return symbol; } @@ -161,7 +146,7 @@ public abstract class USymbol { public boolean manageHorizontalLine() { return false; } - + public int suppHeightBecauseOfShape() { return 0; } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolActor.java b/src/net/sourceforge/plantuml/graphic/USymbolActor.java index 45ba89e6f..0ae935a19 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolActor.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolActor.java @@ -33,20 +33,21 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.skin.StickMan; +import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolActor extends USymbolSimpleAbstract { - public USymbolActor() { - super(ColorParam.actorBackground, ColorParam.actorBorder, FontParam.ACTOR, FontParam.ACTOR_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.ACTOR; } + @Override protected TextBlock getDrawing(SymbolContext symbolContext) { - return new StickMan(symbolContext.getBackColor(), symbolContext.getForeColor(), - symbolContext.isShadowing() ? 4.0 : 0.0); + final double deltaShadow = symbolContext.isShadowing() ? 4.0 : 0.0; + return new StickMan(symbolContext.withDeltaShadow(deltaShadow).withStroke(new UStroke(2))); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java index 267a4cb5c..bf6fcb962 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java @@ -35,9 +35,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -46,11 +44,12 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolArtifact extends USymbol { - public USymbolArtifact() { - super(ColorParam.artifactBackground, ColorParam.artifactBorder, FontParam.ARTIFACT, - FontParam.ARTIFACT_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.ARTIFACT; } + private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing) { final URectangle form = new URectangle(widthTotal, heightTotal); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java b/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java index 5ee0d421a..08d8772ba 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java @@ -33,20 +33,20 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.svek.Boundary; +import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolBoundary extends USymbolSimpleAbstract { - - public USymbolBoundary() { - super(ColorParam.boundaryBackground, ColorParam.boundaryBorder, FontParam.BOUNDARY, FontParam.BOUNDARY_STEREOTYPE); + + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.BOUNDARY; } @Override protected TextBlock getDrawing(final SymbolContext symbolContext) { - return new Boundary(symbolContext.getBackColor(), symbolContext.getForeColor(), - symbolContext.isShadowing() ? 4.0 : 0.0, 2); + return new Boundary(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( + new UStroke(2))); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCard.java b/src/net/sourceforge/plantuml/graphic/USymbolCard.java index 31c06d6bf..ca5ee078e 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCard.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCard.java @@ -35,20 +35,25 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolCard extends USymbol { + + private final SkinParameter skinParameter; - public USymbolCard(ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, - FontParam fontParamStereotype) { - super(colorParamBack, colorParamBorder, fontParam, fontParamStereotype); + public USymbolCard(SkinParameter skinParameter) { + this.skinParameter = skinParameter; } + + @Override + public SkinParameter getSkinParameter() { + return skinParameter; + } + private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double top) { final URectangle shape = new URectangle(width, height); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java index 4b40a658f..4457d137b 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java @@ -35,19 +35,19 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolCloud extends USymbol { - public USymbolCloud() { - super(ColorParam.cloudBackground, ColorParam.cloudBorder, FontParam.CLOUD, FontParam.CLOUD_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.CLOUD; } + private void drawCloud(UGraphic ug, double width, double height, boolean shadowing) { final UPath shape = getSpecificFrontierForCloud(width, height); if (shadowing) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java index 3f04b6858..c7d8e558f 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java @@ -35,18 +35,17 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolComponent1 extends USymbol { - - public USymbolComponent1() { - super(ColorParam.componentBackground, ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE); + + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.COMPONENT1; } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java index 7da134338..e8d827120 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java @@ -44,9 +44,10 @@ import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolComponent2 extends USymbol { - - public USymbolComponent2() { - super(ColorParam.componentBackground, ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE); + + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.COMPONENT2; } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolControl.java b/src/net/sourceforge/plantuml/graphic/USymbolControl.java index 9bff25369..e7a18d649 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolControl.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolControl.java @@ -33,23 +33,27 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.svek.Control; +import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolControl extends USymbolSimpleAbstract { private final double thickness; - + public USymbolControl(double thickness) { - super(ColorParam.controlBackground, ColorParam.controlBorder, FontParam.CONTROL, FontParam.CONTROL_STEREOTYPE); this.thickness = thickness; } + + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.CONTROL; + } + @Override protected TextBlock getDrawing(final SymbolContext symbolContext) { - return new Control(symbolContext.getBackColor(), symbolContext.getForeColor(), - symbolContext.isShadowing() ? 4.0 : 0.0, thickness); + return new Control(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( + new UStroke(thickness))); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java index 80f0ad5b3..43a1c9d24 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java @@ -35,9 +35,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -47,11 +45,13 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolDatabase extends USymbol { - public USymbolDatabase() { - super(ColorParam.databaseBackground, ColorParam.databaseBorder, FontParam.DATABASE, - FontParam.DATABASE_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.DATABASE; } + + private void drawDatabase(UGraphic ug, double width, double height, boolean shadowing) { final UPath shape = new UPath(); if (shadowing) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java index 4b21e61ed..7fea5c5ec 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java @@ -33,23 +33,26 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.svek.EntityDomain; +import net.sourceforge.plantuml.ugraphic.UStroke; class USymbolEntityDomain extends USymbolSimpleAbstract { private final double thickness; public USymbolEntityDomain(double thickness) { - super(ColorParam.entityBackground, ColorParam.entityBorder, FontParam.ENTITY, FontParam.ENTITY_STEREOTYPE); this.thickness = thickness; } + + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.ENTITY_DOMAIN; + } + @Override protected TextBlock getDrawing(final SymbolContext symbolContext) { - return new EntityDomain(symbolContext.getBackColor(), symbolContext.getForeColor(), - symbolContext.isShadowing() ? 4.0 : 0.0, thickness); + return new EntityDomain(symbolContext.withDeltaShadow(symbolContext.isShadowing() ? 4.0 : 0.0).withStroke( + new UStroke(thickness))); } - } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java index 8c7c22459..a79687fa2 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java @@ -35,9 +35,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -52,8 +50,15 @@ public class USymbolFolder extends USymbol { private final static int marginTitleY1 = 3; private final static int marginTitleY2 = 3; - public USymbolFolder(ColorParam colorParamBack, ColorParam colorParamBorder) { - super(colorParamBack, colorParamBorder, FontParam.FOLDER, FontParam.FOLDER_STEREOTYPE); + private final SkinParameter skinParameter; + + public USymbolFolder(SkinParameter skinParameter) { + this.skinParameter = skinParameter; + } + + @Override + public SkinParameter getSkinParameter() { + return skinParameter; } private void drawFolder(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java index e7b860873..6b479df87 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java @@ -35,9 +35,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -45,10 +43,12 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolFrame extends USymbol { - public USymbolFrame() { - super(ColorParam.frameBackground, ColorParam.frameBorder, FontParam.FRAME, FontParam.FRAME_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.FRAME; } + private void drawFrame(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing) { final URectangle shape = new URectangle(width, height); if (shadowing) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolInterface.java b/src/net/sourceforge/plantuml/graphic/USymbolInterface.java index f407f51a3..e90efb823 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolInterface.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolInterface.java @@ -33,17 +33,15 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.svek.CircleInterface2; public class USymbolInterface extends USymbolSimpleAbstract { - public USymbolInterface() { - super(ColorParam.interfaceBackground, ColorParam.interfaceBorder, FontParam.INTERFACE, - FontParam.INTERFACE_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.INTERFACE; } - + @Override protected TextBlock getDrawing(SymbolContext symbolContext) { return new CircleInterface2(symbolContext.getBackColor(), symbolContext.getForeColor(), diff --git a/src/net/sourceforge/plantuml/graphic/USymbolNode.java b/src/net/sourceforge/plantuml/graphic/USymbolNode.java index 285cb3955..1f5431769 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolNode.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolNode.java @@ -35,9 +35,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -45,10 +43,12 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolNode extends USymbol { - public USymbolNode() { - super(ColorParam.nodeBackground, ColorParam.nodeBorder, FontParam.NODE, FontParam.NODE_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.NODE; } + private void drawNode(UGraphic ug, double width, double height, boolean shadowing) { final UPolygon shape = new UPolygon(); shape.addPoint(0, 10); @@ -102,7 +102,7 @@ class USymbolNode extends USymbol { ug = symbolContext.apply(ug); drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); ug = ug.apply(new UTranslate(-4, 11)); - + final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; stereotype.drawU(ug.apply(new UTranslate(posStereo, 2))); @@ -117,7 +117,7 @@ class USymbolNode extends USymbol { } }; } - + @Override public int suppHeightBecauseOfShape() { return 5; @@ -128,5 +128,4 @@ class USymbolNode extends USymbol { return 60; } - } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/graphic/USymbolQueue.java b/src/net/sourceforge/plantuml/graphic/USymbolQueue.java index f2206f844..e44d3449b 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolQueue.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolQueue.java @@ -35,9 +35,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -47,10 +45,12 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolQueue extends USymbol { - public USymbolQueue() { - super(ColorParam.queueBackground, ColorParam.queueBorder, FontParam.QUEUE, FontParam.QUEUE_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.QUEUE; } + private final double dx = 5; private void drawDatabase(UGraphic ug, double width, double height, boolean shadowing) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolRect.java b/src/net/sourceforge/plantuml/graphic/USymbolRect.java index b16ce4057..7e4dec31a 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolRect.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolRect.java @@ -35,19 +35,25 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolRect extends USymbol { + + private final SkinParameter skinParameter; - public USymbolRect(ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, - FontParam fontParamStereotype) { - super(colorParamBack, colorParamBorder, fontParam, fontParamStereotype); + + public USymbolRect(SkinParameter skinParameter) { + this.skinParameter = skinParameter; } + + @Override + public SkinParameter getSkinParameter() { + return skinParameter; + } + private void drawRect(UGraphic ug, double width, double height, boolean shadowing) { final URectangle shape = new URectangle(width, height); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java index 8bc2531cc..b1149385f 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolSimpleAbstract.java @@ -35,23 +35,12 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; abstract class USymbolSimpleAbstract extends USymbol { -// public USymbolSimpleAbstract(ColorParam colorParamBack, ColorParam colorParamBorder) { -// super(colorParamBack, colorParamBorder); -// } - - public USymbolSimpleAbstract(ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, - FontParam fontParamStereotype) { - super(colorParamBack, colorParamBorder, fontParam, fontParamStereotype); - } - public TextBlock asSmall(final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext) { if (stereotype == null) { throw new IllegalArgumentException(); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java index 1a0c145eb..da25efe6f 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java @@ -35,17 +35,16 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; class USymbolStorage extends USymbol { - public USymbolStorage() { - super(ColorParam.storageBackground, ColorParam.storageBorder, FontParam.STORAGE, FontParam.STORAGE_STEREOTYPE); + @Override + public SkinParameter getSkinParameter() { + return SkinParameter.STORAGE; } private void drawStorage(UGraphic ug, double width, double height, boolean shadowing) { diff --git a/src/net/sourceforge/plantuml/png/PngTitler.java b/src/net/sourceforge/plantuml/png/PngTitler.java index d72e024bd..1752c593c 100644 --- a/src/net/sourceforge/plantuml/png/PngTitler.java +++ b/src/net/sourceforge/plantuml/png/PngTitler.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 14708 $ + * Revision $Revision: 15991 $ * */ package net.sourceforge.plantuml.png; @@ -85,7 +85,7 @@ public class PngTitler { new SpriteContainerEmpty()); } - public double getOffsetX(double imWidth, StringBounder stringBounder) { + private double getOffsetX(double imWidth, StringBounder stringBounder) { final TextBlock textBloc = getTextBlock(); if (textBloc == null) { return 0; @@ -98,7 +98,7 @@ public class PngTitler { return (dimText.getWidth() - imWidth) / 2; } - public double getOffsetY(StringBounder stringBounder) { + private double getOffsetY(StringBounder stringBounder) { final TextBlock textBloc = getTextBlock(); if (textBloc == null) { return 0; diff --git a/src/net/sourceforge/plantuml/postit/PostIt.java b/src/net/sourceforge/plantuml/postit/PostIt.java index 30e5a621e..66a275abc 100644 --- a/src/net/sourceforge/plantuml/postit/PostIt.java +++ b/src/net/sourceforge/plantuml/postit/PostIt.java @@ -44,8 +44,8 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.rose.ComponentRoseNote; @@ -111,8 +111,9 @@ public class PostIt { final SkinParam param = SkinParam.noShadowing(); final UFont fontNote = param.getFont(FontParam.NOTE, null, false); - final ComponentRoseNote note = new ComponentRoseNote(new BiColor(noteBackgroundColor, borderColor), fontNote.toFont2(HtmlColorUtils.BLACK, true, HtmlColorUtils.BLUE), - text, 0, 0, new SpriteContainerEmpty(), 0, new UStroke()); + final ComponentRoseNote note = new ComponentRoseNote( + new SymbolContext(noteBackgroundColor, borderColor).withStroke(new UStroke()), fontNote.toFont2( + HtmlColorUtils.BLACK, true, HtmlColorUtils.BLUE), text, 0, 0, new SpriteContainerEmpty()); return note; } } diff --git a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java index f48287b4d..9cf345185 100644 --- a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java +++ b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java @@ -29,7 +29,7 @@ * Original Author: Arnaud Roques * Modified by: Nicolas Jouanin * - * Revision $Revision: 15613 $ + * Revision $Revision: 15993 $ * */ package net.sourceforge.plantuml.preproc; @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.utils.StartUtils; class PreprocessorInclude implements ReadLine { @@ -88,6 +89,15 @@ class PreprocessorInclude implements ReadLine { } public String readLine() throws IOException { + final String result = readLineInternal(); + if (result != null && (StartUtils.isArobaseEndDiagram(result) || StartUtils.isArobaseStartDiagram(result))) { + // http://plantuml.sourceforge.net/qa/?qa=3389/error-generating-when-same-file-included-different-diagram + filesUsed.clear(); + } + return result; + } + + private String readLineInternal() throws IOException { if (included != null) { final String s = included.readLine(); if (s != null) { @@ -113,9 +123,7 @@ class PreprocessorInclude implements ReadLine { if (mUrl.find()) { return manageUrlInclude(mUrl); } - return s; - } private String manageUrlInclude(Matcher m) throws IOException { diff --git a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java index 491db00b3..0ba2005a7 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java +++ b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java @@ -37,6 +37,8 @@ import java.util.EnumSet; import java.util.HashSet; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; @@ -68,12 +70,11 @@ public abstract class AbstractMessage implements EventWithDeactivate { public void goParallel() { this.parallel = true; } - + public boolean isParallel() { return parallel; } - final public Url getUrl() { if (url == null) { return urlNote; @@ -163,10 +164,14 @@ public abstract class AbstractMessage implements EventWithDeactivate { return notePosition; } - public final HtmlColor getSpecificBackColor() { + private final HtmlColor getSpecificBackColor() { return noteBackColor; } + public SkinParamBackcolored getSkinParamNoteBackcolored(ISkinParam skinParam) { + return new SkinParamBackcolored(skinParam, getSpecificBackColor()); + } + public final NotePosition getNotePosition() { return notePosition; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Note.java b/src/net/sourceforge/plantuml/sequencediagram/Note.java index 724e2e6df..f0e67e9d3 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Note.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Note.java @@ -28,11 +28,13 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15048 $ + * Revision $Revision: 16005 $ * */ package net.sourceforge.plantuml.sequencediagram; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; @@ -124,4 +126,8 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable this.style = style; } + public SkinParamBackcolored getSkinParamBackcolored(ISkinParam skinParam) { + return new SkinParamBackcolored(skinParam, getSpecificBackColor()); + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Participant.java b/src/net/sourceforge/plantuml/sequencediagram/Participant.java index 1d68bc99a..b872dec70 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Participant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Participant.java @@ -28,12 +28,14 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12299 $ + * Revision $Revision: 15995 $ * */ package net.sourceforge.plantuml.sequencediagram; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; @@ -146,4 +148,14 @@ public class Participant implements SpecificBackcolorable { return type.getBackgroundColorParam(); } + public SkinParamBackcolored getSkinParamBackcolored(ISkinParam skinParam) { + HtmlColor specificBackColor = getSpecificBackColor(); + final boolean clickable = getUrl() != null; + final HtmlColor stereoBackColor = skinParam.getHtmlColor(getBackgroundColorParam(), getStereotype(), clickable); + if (stereoBackColor != null && specificBackColor == null) { + specificBackColor = stereoBackColor; + } + return new SkinParamBackcolored(skinParam, specificBackColor, clickable); + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java index 277c4de44..aa876542c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 14860 $ + * Revision $Revision: 16005 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -42,7 +42,6 @@ import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SkinParamBackcoloredReference; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.Delay; @@ -431,7 +430,7 @@ class DrawableSetInitializer { p2 = tmp; } } - final ISkinParam skinParam = new SkinParamBackcolored(drawableSet.getSkinParam(), n.getSpecificBackColor()); + final ISkinParam skinParam = n.getSkinParamBackcolored(drawableSet.getSkinParam()); final ComponentType type = getNoteComponentType(n.getStyle()); final NoteBox noteBox = new NoteBox(freeY2.getFreeY(range), drawableSet.getSkin().createComponent(type, null, skinParam, n.getStrings()), p1, p2, n.getPosition(), n.getUrl()); @@ -581,15 +580,8 @@ class DrawableSetInitializer { } else { throw new IllegalArgumentException(); } - HtmlColor specificBackColor = p.getSpecificBackColor(); - final boolean clickable = p.getUrl() != null; - final HtmlColor stereoBackColor = drawableSet.getSkinParam().getHtmlColor(p.getBackgroundColorParam(), - p.getStereotype(), clickable); - if (stereoBackColor != null && specificBackColor == null) { - specificBackColor = stereoBackColor; - } - final ISkinParam skinParam = new SkinParamBackcolored(drawableSet.getSkinParam(), specificBackColor, clickable); + final ISkinParam skinParam = p.getSkinParamBackcolored(drawableSet.getSkinParam()); final Display participantDisplay = p.getDisplay(skinParam.forceSequenceParticipantUnderlined()); final Component head = drawableSet.getSkin().createComponent(headType, null, skinParam, participantDisplay); final Component tail = drawableSet.getSkin().createComponent(tailType, null, skinParam, participantDisplay); diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java index 1858177d2..554da2ab1 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java @@ -173,7 +173,8 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { // System.err.println("scale=" + scale); final ImageBuilder imageBuilder = new ImageBuilder(diagram.getSkinParam().getColorMapper(), oneOf(scale, - dpiFactor), diagram.getSkinParam().getBackgroundColor(), null, null, 3, 10, diagram.getAnimation(), diagram.getSkinParam().handwritten()); + dpiFactor), diagram.getSkinParam().getBackgroundColor(), null, null, 3, 10, diagram.getAnimation(), + diagram.getSkinParam().handwritten()); imageBuilder.addUDrawable(new UDrawable() { public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java index 54ac38c8b..7f9829314 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15524 $ + * Revision $Revision: 16005 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -72,8 +72,7 @@ class Step1Message extends Step1Abstract { } if (message.getNote() != null) { - final ISkinParam skinParam = new SkinParamBackcolored(drawingSet.getSkinParam(), - message.getSpecificBackColor()); + final ISkinParam skinParam = message.getSkinParamNoteBackcolored(drawingSet.getSkinParam()); setNote(drawingSet.getSkin().createComponent(ComponentType.NOTE, null, skinParam, message.getNote())); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java index e6089e807..1604e1883 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1MessageExo.java @@ -60,8 +60,7 @@ class Step1MessageExo extends Step1Abstract { message.isShortArrow(), message.getArrowConfiguration()); if (message.getNote() != null) { - final ISkinParam skinParam = new SkinParamBackcolored(drawingSet.getSkinParam(), - message.getSpecificBackColor()); + final ISkinParam skinParam = message.getSkinParamNoteBackcolored(drawingSet.getSkinParam()); setNote(drawingSet.getSkin().createComponent(ComponentType.NOTE, null, skinParam, message.getNote())); // throw new UnsupportedOperationException(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java index 141dea87a..afb80c87b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java @@ -41,16 +41,16 @@ import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.ArrowComponent; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; -import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -public class CommunicationExoTile implements Tile { +public class CommunicationExoTile implements TileWithUpdateStairs { private final LivingSpace livingSpace; private final MessageExo message; @@ -58,12 +58,11 @@ public class CommunicationExoTile implements Tile { private final ISkinParam skinParam; private final Real alpha; private final Real omega; - + public Event getEvent() { return message; } - public CommunicationExoTile(LivingSpace livingSpace, MessageExo message, Skin skin, ISkinParam skinParam, Real alpha, Real omega) { this.livingSpace = livingSpace; @@ -115,6 +114,15 @@ public class CommunicationExoTile implements Tile { } } + public void updateStairs(StringBounder stringBounder, double y) { + final ArrowComponent comp = (ArrowComponent) getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + final double arrowY = comp.getStartPoint(stringBounder, dim).getY(); + + livingSpace.addStepForLivebox(getEvent(), y + arrowY); + + } + private Real getPoint1(final StringBounder stringBounder) { if (message.getType().isRightBorder()) { return livingSpace.getPosC(stringBounder); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java index 454e22ac9..ea70fb72c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java @@ -39,14 +39,12 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.Event; -import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.ArrowComponent; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; -import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -54,7 +52,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class CommunicationTileNoteLeft implements TileWithUpdateStairs { private final TileWithUpdateStairs tile; - private final Message message; + private final AbstractMessage message; private final Skin skin; private final ISkinParam skinParam; private final Display notes; @@ -66,7 +64,7 @@ public class CommunicationTileNoteLeft implements TileWithUpdateStairs { } - public CommunicationTileNoteLeft(TileWithUpdateStairs tile, Message message, Skin skin, ISkinParam skinParam, + public CommunicationTileNoteLeft(TileWithUpdateStairs tile, AbstractMessage message, Skin skin, ISkinParam skinParam, LivingSpace livingSpace) { this.tile = tile; this.message = message; @@ -83,7 +81,7 @@ public class CommunicationTileNoteLeft implements TileWithUpdateStairs { private Component getComponent(StringBounder stringBounder) { - final Component comp = skin.createComponent(ComponentType.NOTE, null, skinParam, notes); + final Component comp = skin.createComponent(ComponentType.NOTE, null, message.getSkinParamNoteBackcolored(skinParam), notes); return comp; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java index 1aab8254a..b49b28f0c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java @@ -39,13 +39,12 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.Event; -import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; -import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -53,20 +52,19 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class CommunicationTileNoteRight implements TileWithUpdateStairs { private final TileWithUpdateStairs tile; - private final Message message; + private final AbstractMessage message; private final Skin skin; private final ISkinParam skinParam; private final Display notes; // private final NotePosition notePosition; private final LivingSpace livingSpace; - + public Event getEvent() { return message; } - - public CommunicationTileNoteRight(TileWithUpdateStairs tile, Message message, Skin skin, ISkinParam skinParam, - LivingSpace livingSpace) { + public CommunicationTileNoteRight(TileWithUpdateStairs tile, AbstractMessage message, Skin skin, + ISkinParam skinParam, LivingSpace livingSpace) { this.tile = tile; this.message = message; this.skin = skin; @@ -75,14 +73,14 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs { // this.notePosition = message.getNotePosition(); this.livingSpace = livingSpace; } - + public void updateStairs(StringBounder stringBounder, double y) { tile.updateStairs(stringBounder, y); } - private Component getComponent(StringBounder stringBounder) { - final Component comp = skin.createComponent(ComponentType.NOTE, null, skinParam, notes); + final Component comp = skin.createComponent(ComponentType.NOTE, null, + message.getSkinParamNoteBackcolored(skinParam), notes); return comp; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java index 020d4616e..4611deb66 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java @@ -81,7 +81,7 @@ public class CommunicationTileSelfNoteRight implements TileWithUpdateStairs { private Component getComponent(StringBounder stringBounder) { - final Component comp = skin.createComponent(ComponentType.NOTE, null, skinParam, notes); + final Component comp = skin.createComponent(ComponentType.NOTE, null, message.getSkinParamNoteBackcolored(skinParam), notes); return comp; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java index 71b583b1c..4d1017ff5 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java @@ -38,6 +38,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.LifeEvent; import net.sourceforge.plantuml.sequencediagram.Message; @@ -127,6 +128,27 @@ public class EventsHistory { return false; } + private HtmlColor getActivateColor(Event event) { + for (Iterator it = events.iterator(); it.hasNext();) { + final Event current = it.next(); + if (event != current) { + continue; + } + if (current instanceof Message) { + final Event next = nextButSkippingNotes(it); + if (next instanceof LifeEvent) { + final LifeEvent le = (LifeEvent) next; + if (le.isActivate()) { + return le.getSpecificBackColor(); + } + return null; + } + } + return null; + } + return null; + } + private Event nextButSkippingNotes(Iterator it) { while (true) { if (it.hasNext() == false) { @@ -151,11 +173,11 @@ public class EventsHistory { if (position != null) { assert position <= totalHeight : "position=" + position + " totalHeight=" + totalHeight; value = getLevelAt(event, EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE); - result.addStep(new StairsPosition(position, isNextEventADestroy(event)), value); + result.addStep(new StairsPosition(position, isNextEventADestroy(event)), value, getActivateColor(event)); } } System.err.println("EventsHistory::getStairs finishing totalHeight=" + totalHeight); - result.addStep(new StairsPosition(totalHeight, false), value); + result.addStep(new StairsPosition(totalHeight, false), value, null); // System.err.println("EventsHistory::getStairs " + p + " result=" + result); return result; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java index 73e290aae..87f4cdd08 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java @@ -44,7 +44,6 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.RealMax; import net.sourceforge.plantuml.real.RealMin; -import net.sourceforge.plantuml.real.RealUtils; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.Grouping; import net.sourceforge.plantuml.sequencediagram.GroupingLeaf; @@ -54,7 +53,6 @@ import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; -import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -80,13 +78,14 @@ public class GroupingTile implements Tile { return start; } - public GroupingTile(Iterator it, GroupingStart start, TileArguments tileArguments) { - final StringBounder stringBounder = tileArguments.getStringBounder(); + public GroupingTile(Iterator it, GroupingStart start, TileArguments tileArgumentsBachColorChanged, + TileArguments tileArgumentsOriginal) { + final StringBounder stringBounder = tileArgumentsOriginal.getStringBounder(); this.start = start; this.display = start.getTitle().equals("group") ? Display.create(start.getComment()) : Display.create( start.getTitle(), start.getComment()); - this.skin = tileArguments.getSkin(); - this.skinParam = tileArguments.getSkinParam(); + this.skin = tileArgumentsOriginal.getSkin(); + this.skinParam = tileArgumentsBachColorChanged.getSkinParam(); // this.max = min.addAtLeast(dim1.getWidth()); while (it.hasNext()) { @@ -95,12 +94,12 @@ public class GroupingTile implements Tile { if (ev instanceof GroupingLeaf && ((Grouping) ev).getType() == GroupingType.END) { break; } - final Tile tile = TileBuilder.buildOne(it, tileArguments, ev, this); + final Tile tile = TileBuilder.buildOne(it, tileArgumentsOriginal, ev, this); if (tile != null) { tiles.add(tile); min.put(tile.getMinX(stringBounder).addFixed(-MARGINX)); final Real m = tile.getMaxX(stringBounder); - max.put(m == tileArguments.getOmega() ? m : m.addFixed(MARGINX)); + max.put(m == tileArgumentsOriginal.getOmega() ? m : m.addFixed(MARGINX)); bodyHeight += tile.getPreferredHeight(stringBounder); } } @@ -108,8 +107,8 @@ public class GroupingTile implements Tile { final double width = dim1.getWidth(); System.err.println("width=" + width); if (min.size() == 0) { - min.put(tileArguments.getOrigin()); - max.put(tileArguments.getOmega()); + min.put(tileArgumentsOriginal.getOrigin()); + max.put(tileArgumentsOriginal.getOmega()); } // max.ensureBiggerThan(min.addFixed(width)); this.max.ensureBiggerThan(getMinX(stringBounder).addFixed(width + 16)); diff --git a/src/net/sourceforge/plantuml/skin/BiColor.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java similarity index 74% rename from src/net/sourceforge/plantuml/skin/BiColor.java rename to src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java index 4db5f68f7..9a9653537 100644 --- a/src/net/sourceforge/plantuml/skin/BiColor.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/IntegerColored.java @@ -28,29 +28,34 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 8151 $ + * Revision $Revision: 6054 $ * */ -package net.sourceforge.plantuml.skin; +package net.sourceforge.plantuml.sequencediagram.teoz; import net.sourceforge.plantuml.graphic.HtmlColor; -public class BiColor { +public class IntegerColored { - private final HtmlColor yellowBack; - private final HtmlColor redBorder; + private final int value; + private final HtmlColor color; - public BiColor(HtmlColor yellowBack, HtmlColor redBorder) { - this.yellowBack = yellowBack; - this.redBorder = redBorder; + public IntegerColored(int value, HtmlColor color) { + this.value = value; + this.color = color; } - public HtmlColor getYellowBack() { - return yellowBack; + @Override + public String toString() { + return "" + value + " " + color; } - public HtmlColor getRedBorder() { - return redBorder; + public int getValue() { + return value; + } + + public HtmlColor getColor() { + return color; } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java index 4910fc7be..2a2ffe2ac 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxes.java @@ -37,6 +37,8 @@ import java.awt.geom.Dimension2D; import java.util.Iterator; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamBackcolored; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; @@ -71,22 +73,31 @@ public class LiveBoxes implements UDrawable { } private void drawOneLevel(UGraphic ug, int levelToDraw, Stairs2 stairs, Context2D context) { - final Component comp = skin.createComponent(ComponentType.ALIVE_BOX_CLOSE_CLOSE, null, skinParam, null); + final Component comp1 = skin.createComponent(ComponentType.ALIVE_BOX_CLOSE_CLOSE, null, skinParam, null); final Component cross = skin.createComponent(ComponentType.DESTROY, null, skinParam, null); final Dimension2D dimCross = cross.getPreferredDimension(ug.getStringBounder()); - final double width = comp.getPreferredWidth(ug.getStringBounder()); + final double width = comp1.getPreferredWidth(ug.getStringBounder()); ug = ug.apply(new UTranslate((levelToDraw - 1) * width / 2.0, 0)); double y1 = Double.MAX_VALUE; + HtmlColor color = null; for (Iterator it = stairs.getYs().iterator(); it.hasNext();) { final StairsPosition yposition = it.next(); System.err.println("LiveBoxes::drawOneLevel " + levelToDraw + " " + yposition); - final int level = stairs.getValue(yposition.getValue()); + final IntegerColored integerColored = stairs.getValue(yposition.getValue()); + System.err.println("integerColored=" + integerColored); + final int level = integerColored.getValue(); if (y1 == Double.MAX_VALUE && level == levelToDraw) { y1 = yposition.getValue(); + color = integerColored.getColor(); } else if (y1 != Double.MAX_VALUE && (it.hasNext() == false || level < levelToDraw)) { final double y2 = yposition.getValue(); final Area area = new Area(width, y2 - y1); + + final ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, color); + final Component comp = skin + .createComponent(ComponentType.ALIVE_BOX_CLOSE_CLOSE, null, skinParam2, null); + comp.drawU(ug.apply(new UTranslate(-width / 2, y1)), area, context); System.err.println("LiveBoxes::drawOneLevel one block " + y1 + " " + y2); if (yposition.isDestroy()) { @@ -101,4 +112,8 @@ public class LiveBoxes implements UDrawable { } } + private UGraphic withColor(UGraphic ug) { + return ug; + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java index 57bdd5ea7..a77948273 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.Skin; +import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; public class LivingSpace { @@ -60,6 +61,7 @@ public class LivingSpace { private final ComponentType tailType; private final boolean useContinueLineBecauseOfDelay; private final MutingLine mutingLine; + private final Rose rose = new Rose(); // private final LivingSpaceImpl previous; // private LivingSpace next; @@ -158,14 +160,17 @@ public class LivingSpace { // } public void drawHead(UGraphic ug, Context2D context) { - final Component comp = skin.createComponent(headType, null, skinParam, p.getDisplay(false)); + // final Component comp = skin.createComponent(headType, null, skinParam, p.getDisplay(false)); + final Component comp = rose.createComponent(headType, null, p.getSkinParamBackcolored(skinParam), + p.getDisplay(false)); final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder()); final Area area = new Area(dim); comp.drawU(ug, area, context); } public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) { - final Component comp = skin.createComponent(headType, null, skinParam, p.getDisplay(false)); + // final Component comp = skin.createComponent(headType, null, skinParam, p.getDisplay(false)); + final Component comp = rose.createComponent(headType, null, skinParam, p.getDisplay(false)); final Dimension2D dim = comp.getPreferredDimension(stringBounder); return dim; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java index b5cf9d2df..3ea19797b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpaces.java @@ -33,11 +33,17 @@ */ package net.sourceforge.plantuml.sequencediagram.teoz; +import java.awt.geom.Dimension2D; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.sequencediagram.Participant; +import net.sourceforge.plantuml.skin.Context2D; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; public class LivingSpaces { @@ -55,4 +61,40 @@ public class LivingSpaces { return all.get(participant); } + public void drawHeads(final UGraphic ug, Context2D context, VerticalAlignment verticalAlignment) { + final StringBounder stringBounder = ug.getStringBounder(); + final double headHeight = getHeadHeight(stringBounder); + for (LivingSpace livingSpace : values()) { + final double x = livingSpace.getPosB().getCurrentValue(); + double y = 0; + if (verticalAlignment == VerticalAlignment.BOTTOM) { + final Dimension2D dimHead = livingSpace.getHeadPreferredDimension(stringBounder); + y = headHeight - dimHead.getHeight(); + } + livingSpace.drawHead(ug.apply(new UTranslate(x, y)), context); + } + } + + public double getHeadHeight(StringBounder stringBounder) { + double headHeight = 0; + for (LivingSpace livingSpace : values()) { + final Dimension2D headDim = livingSpace.getHeadPreferredDimension(stringBounder); + headHeight = Math.max(headHeight, headDim.getHeight()); + } + return headHeight; + } + + public void drawLifeLines(final UGraphic ug, double height, Context2D context) { + int i = 0; + for (LivingSpace livingSpace : values()) { + // if (i++ == 0) { + // System.err.println("TEMPORARY SKIPPING OTHERS"); + // continue; + // } + // System.err.println("drawing lines " + livingSpace); + final double x = livingSpace.getPosC(ug.getStringBounder()).getCurrentValue(); + livingSpace.drawLineAndLiveBoxes(ug.apply(new UTranslate(x, 0)), height, context); + } + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java index 0cdc27d16..e93aac3ce 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java @@ -72,7 +72,8 @@ public class NoteTile implements Tile { } private Component getComponent(StringBounder stringBounder) { - final Component comp = skin.createComponent(ComponentType.NOTE, null, skinParam, note.getStrings()); + final Component comp = skin.createComponent(ComponentType.NOTE, null, note.getSkinParamBackcolored(skinParam), + note.getStrings()); return comp; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java index 04a9f41dc..4aeb89591 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; -import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index 9e4fd402e..921ef67cb 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -39,22 +39,33 @@ import java.io.OutputStream; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; +import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.core.ImageData; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.HorizontalAlignment; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.VerticalAlignment; +import net.sourceforge.plantuml.png.PngTitler; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.RealUtils; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker; +import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.Component; +import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.SimpleContext2D; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic2; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.hand.UGraphicHandwritten; +import net.sourceforge.plantuml.utils.MathUtils; public class SequenceDiagramFileMakerTeoz implements FileMaker { @@ -76,7 +87,6 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { final Real origin = RealUtils.createOrigin(); Real currentPos = origin.addAtLeast(0); - double headHeight = 0; LivingSpace last = null; LivingSpaces livingSpaces = new LivingSpaces(); for (Participant p : diagram.participants().values()) { @@ -84,40 +94,81 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { diagram.events()); last = livingSpace; ((LivingSpaces) livingSpaces).put(p, livingSpace); - final Dimension2D headDim = livingSpace.getHeadPreferredDimension(stringBounder); currentPos = livingSpace.getPosD(stringBounder).addAtLeast(0); - headHeight = Math.max(headHeight, headDim.getHeight()); } - // livingSpaces = new LivingSpacesDeltaSimple(livingSpaces); final MainTile mainTile = new MainTile(diagram, skin, last.getPosD(stringBounder).addAtLeast(0), livingSpaces, origin); mainTile.addConstraints(stringBounder); origin.compile(); - final double height = mainTile.getPreferredHeight(stringBounder) + 2 * headHeight; + final double mainHeight = mainTile.getPreferredHeight(stringBounder) + 2 + * livingSpaces.getHeadHeight(stringBounder); final Real min1 = mainTile.getMinX(stringBounder); final Real max1 = mainTile.getMaxX(stringBounder); // System.err.println("min1=" + min1.getCurrentValue()); // System.err.println("max1=" + max1.getCurrentValue()); - final Dimension2D dim = new Dimension2DDouble(max1.getCurrentValue() - min1.getCurrentValue(), height); - final UGraphic2 ug = (UGraphic2) fileFormatOption.createUGraphic(dim).apply( + final Component compTitle = getCompTitle(); + + final double mainWidth = max1.getCurrentValue() - min1.getCurrentValue(); + + Dimension2D dimTitle = new Dimension2DDouble(0, 0); + if (compTitle != null) { + dimTitle = compTitle.getPreferredDimension(stringBounder); + } + + final PngTitler footer = getFooter(); + Dimension2D dimFooter = new Dimension2DDouble(0, 0); + if (footer != null && footer.getTextBlock() != null) { + dimFooter = footer.getTextBlock().calculateDimension(stringBounder); + } + + final PngTitler header = getHeader(); + Dimension2D dimHeader = new Dimension2DDouble(0, 0); + if (header != null && header.getTextBlock() != null) { + dimHeader = header.getTextBlock().calculateDimension(stringBounder); + } + + final double totalWidth = MathUtils.max(mainWidth, dimTitle.getWidth(), dimFooter.getWidth(), + dimHeader.getWidth()); + final double totalHeight = mainHeight + dimTitle.getHeight() + dimHeader.getHeight() + dimFooter.getHeight(); + final Dimension2D dim = new Dimension2DDouble(totalWidth, totalHeight); + final UGraphic2 ug2 = (UGraphic2) fileFormatOption.createUGraphic(skinParam.getColorMapper(), + diagram.getDpiFactor(fileFormatOption), dim, skinParam.getBackgroundColor(), false).apply( new UTranslate(-min1.getCurrentValue(), 0)); - stringBounder = ug.getStringBounder(); - final Context2D context = new SimpleContext2D(false); - drawHeads(ug, livingSpaces, context); - // mainTile.beforeDrawing(ug.getStringBounder(), livingSpaces.values()); - mainTile.drawU(ug.apply(new UTranslate(0, headHeight))); - drawLifeLines(ug.apply(new UTranslate(0, headHeight)), mainTile.getPreferredHeight(stringBounder), - livingSpaces, context); - drawHeads(ug.apply(new UTranslate(0, mainTile.getPreferredHeight(stringBounder) + headHeight)), livingSpaces, - context); - mainTile.drawForeground(ug.apply(new UTranslate(0, headHeight))); + UGraphic ug = diagram.getSkinParam().handwritten() ? new UGraphicHandwritten(ug2) : ug2; - ug.writeImageTOBEMOVED(os, isWithMetadata ? diagram.getMetadata() : null, diagram.getDpi(fileFormatOption)); + if (footer != null && footer.getTextBlock() != null) { + double dx = 0; + if (diagram.getFooterAlignment() == HorizontalAlignment.RIGHT) { + dx = totalWidth - dimFooter.getWidth(); + } else if (diagram.getFooterAlignment() == HorizontalAlignment.CENTER) { + dx = (totalWidth - dimFooter.getWidth()) / 2; + } + footer.getTextBlock().drawU( + ug.apply(new UTranslate(dx, mainHeight + dimTitle.getHeight() + dimHeader.getHeight()))); + } + if (header != null && header.getTextBlock() != null) { + double dx = 0; + if (diagram.getHeaderAlignment() == HorizontalAlignment.RIGHT) { + dx = totalWidth - dimHeader.getWidth(); + } else if (diagram.getHeaderAlignment() == HorizontalAlignment.CENTER) { + dx = (totalWidth - dimHeader.getWidth()) / 2; + } + header.getTextBlock().drawU(ug.apply(new UTranslate(dx, 0))); + } + if (compTitle != null) { + compTitle.drawU(ug.apply(new UTranslate((totalWidth - dimTitle.getWidth()) / 2, 0)), new Area(dimTitle), + new SimpleContext2D(false)); + ug = ug.apply(new UTranslate((totalWidth - mainWidth) / 2, dimTitle.getHeight() + dimHeader.getHeight())); + } + + drawMainTile(ug, mainTile, livingSpaces); + + ug2.writeImageTOBEMOVED(os, isWithMetadata ? diagram.getMetadata() : null, diagram.getDpi(fileFormatOption)); final Dimension2D info = new Dimension2DDouble(dim.getWidth(), dim.getHeight()); // if (fileFormatOption.getFileFormat() == FileFormat.PNG && ug instanceof UGraphicG2d) { @@ -133,25 +184,55 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { return new ImageDataSimple(info); } - private void drawLifeLines(final UGraphic ug, double height, LivingSpaces livingSpaces, Context2D context) { - int i = 0; - for (LivingSpace livingSpace : livingSpaces.values()) { - // if (i++ == 0) { - // System.err.println("TEMPORARY SKIPPING OTHERS"); - // continue; - // } - // System.err.println("drawing lines " + livingSpace); - final double x = livingSpace.getPosC(ug.getStringBounder()).getCurrentValue(); - livingSpace.drawLineAndLiveBoxes(ug.apply(new UTranslate(x, 0)), height, context); + private Component getCompTitle() { + final Display title = diagram.getTitle(); + + final Component compTitle; + if (title == null) { + compTitle = null; + } else { + compTitle = skin.createComponent(ComponentType.TITLE, null, diagram.getSkinParam(), title); } + return compTitle; } - private void drawHeads(final UGraphic ug, LivingSpaces livingSpaces, Context2D context) { - for (LivingSpace livingSpace : livingSpaces.values()) { - // System.err.println("drawing heads " + livingSpace); - final double x = livingSpace.getPosB().getCurrentValue(); - livingSpace.drawHead(ug.apply(new UTranslate(x, 0)), context); + private PngTitler getFooter() { + if (diagram.getFooter() == null) { + return null; } + final HtmlColor hyperlinkColor = diagram.getSkinParam().getHyperlinkColor(); + final HtmlColor titleColor = diagram.getSkinParam().getFontHtmlColor(FontParam.FOOTER, null); + final String fontFamily = diagram.getSkinParam().getFont(FontParam.FOOTER, null, false).getFamily(null); + final int fontSize = diagram.getSkinParam().getFont(FontParam.FOOTER, null, false).getSize(); + final PngTitler pngTitler = new PngTitler(titleColor, diagram.getFooter(), fontSize, fontFamily, + diagram.getFooterAlignment(), hyperlinkColor, diagram.getSkinParam().useUnderlineForHyperlink()); + return pngTitler; + } + + private PngTitler getHeader() { + final HtmlColor hyperlinkColor = diagram.getSkinParam().getHyperlinkColor(); + final HtmlColor titleColor = diagram.getSkinParam().getFontHtmlColor(FontParam.HEADER, null); + final String fontFamily = diagram.getSkinParam().getFont(FontParam.HEADER, null, false).getFamily(null); + final int fontSize = diagram.getSkinParam().getFont(FontParam.HEADER, null, false).getSize(); + final PngTitler pngTitler = new PngTitler(titleColor, diagram.getHeader(), fontSize, fontFamily, + diagram.getHeaderAlignment(), hyperlinkColor, diagram.getSkinParam().useUnderlineForHyperlink()); + return pngTitler; + } + + private void drawMainTile(final UGraphic ug, final MainTile mainTile, LivingSpaces livingSpaces) { + final StringBounder stringBounder = ug.getStringBounder(); + + final Context2D context = new SimpleContext2D(false); + livingSpaces.drawHeads(ug, context, VerticalAlignment.BOTTOM); + + final double headHeight = livingSpaces.getHeadHeight(stringBounder); + + mainTile.drawU(ug.apply(new UTranslate(0, headHeight))); + livingSpaces.drawLifeLines(ug.apply(new UTranslate(0, headHeight)), mainTile.getPreferredHeight(stringBounder), + context); + livingSpaces.drawHeads(ug.apply(new UTranslate(0, mainTile.getPreferredHeight(stringBounder) + headHeight)), + context, VerticalAlignment.TOP); + mainTile.drawForeground(ug.apply(new UTranslate(0, headHeight))); } public int getNbPages() { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java index 572577be1..ce5e4bf80 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java @@ -39,14 +39,16 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.sourceforge.plantuml.graphic.HtmlColor; + public class Stairs2 { private final List ys = new ArrayList(); - private final List values = new ArrayList(); - private final Map cache = new HashMap(); + private final List values = new ArrayList(); + private final Map cache = new HashMap(); - public void addStep(StairsPosition position, int value) { - System.err.println("Stairs2::addStep " + position + " " + value); + public void addStep(StairsPosition position, int value, HtmlColor color) { + System.err.println("Stairs2::addStep " + position + " " + value + " color=" + color); assert ys.size() == values.size(); if (ys.size() > 0) { final double lastY = ys.get(ys.size() - 1).getValue(); @@ -54,19 +56,20 @@ public class Stairs2 { throw new IllegalArgumentException(); } if (lastY == position.getValue()) { - values.set(ys.size() - 1, value); + values.set(ys.size() - 1, new IntegerColored(value, color)); cache.clear(); return; } } ys.add(position); - values.add(value); + values.add(new IntegerColored(value, color)); cache.clear(); } public int getMaxValue() { int max = Integer.MIN_VALUE; - for (Integer v : values) { + for (IntegerColored vc : values) { + final int v = vc.getValue(); if (v > max) { max = v; } @@ -78,23 +81,23 @@ public class Stairs2 { return Collections.unmodifiableList(ys); } - public int getValue(double y) { - Integer result = cache.get(y); - if (result == null) { - result = getValueSlow(new StairsPosition(y, false)); - cache.put(y, result); + public IntegerColored getValue(double y) { + IntegerColored resultc = cache.get(y); + if (resultc == null) { + resultc = getValueSlow(new StairsPosition(y, false)); + cache.put(y, resultc); } - return result; + return resultc; } - private int getValueSlow(StairsPosition y) { + private IntegerColored getValueSlow(StairsPosition y) { final int idx = Collections.binarySearch(ys, y); if (idx >= 0) { return values.get(idx); } final int insertPoint = -idx - 1; if (insertPoint == 0) { - return 0; + return new IntegerColored(0, null); } return values.get(insertPoint - 1); } @@ -104,7 +107,7 @@ public class Stairs2 { if (size == 0) { return 0; } - return values.get(size - 1); + return values.get(size - 1).getValue(); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java index b4f8cc7f8..34a9a72a5 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/StairsPosition.java @@ -33,6 +33,7 @@ */ package net.sourceforge.plantuml.sequencediagram.teoz; + public class StairsPosition implements Comparable { private final double value; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java index 0c45a6888..9cad60bc4 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java @@ -33,13 +33,14 @@ */ package net.sourceforge.plantuml.sequencediagram.teoz; -import java.util.Collections; -import java.util.Map; - import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamBackcolored; +import net.sourceforge.plantuml.SkinParamBackcoloredReference; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.Participant; +import net.sourceforge.plantuml.sequencediagram.Reference; import net.sourceforge.plantuml.skin.Skin; public class TileArguments { @@ -60,6 +61,17 @@ public class TileArguments { this.skinParam = skinParam; } + public TileArguments withBackColorGeneral(HtmlColor backColorElement, HtmlColor backColorGeneral) { + return new TileArguments(stringBounder, omega, livingSpaces, skin, new SkinParamBackcolored(skinParam, + backColorElement, backColorGeneral), origin); + } + + public TileArguments withBackColor(Reference reference) { + final ISkinParam newSkinParam = new SkinParamBackcoloredReference(skinParam, reference.getBackColorElement(), + reference.getBackColorGeneral()); + return new TileArguments(stringBounder, omega, livingSpaces, skin, newSkinParam, origin); + } + public final StringBounder getStringBounder() { return stringBounder; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java index 85976738b..e014f9fbb 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java @@ -39,6 +39,8 @@ import java.util.Iterator; import java.util.List; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamBackcoloredReference; +import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sequencediagram.Delay; import net.sourceforge.plantuml.sequencediagram.Divider; @@ -102,6 +104,21 @@ public class TileBuilder { reverse ? livingSpace1 : livingSpace2); } } + } else if (ev instanceof MessageExo) { + final MessageExo exo = (MessageExo) ev; + final LivingSpace livingSpace1 = livingSpaces.get(exo.getParticipant()); + tile = new CommunicationExoTile(livingSpace1, exo, skin, skinParam, tileArguments.getOrigin(), + tileArguments.getOmega()); + if (exo.getNote() != null) { + final NotePosition notePosition = exo.getNotePosition(); + if (notePosition == NotePosition.LEFT) { + tile = new CommunicationTileNoteLeft((TileWithUpdateStairs) tile, exo, skin, skinParam, + livingSpace1); + } else if (notePosition == NotePosition.RIGHT) { + tile = new CommunicationTileNoteRight((TileWithUpdateStairs) tile, exo, skin, skinParam, + livingSpace1); + } + } } else if (ev instanceof Note) { final Note note = (Note) ev; final LivingSpace livingSpace1 = livingSpaces.get(note.getParticipant()); @@ -111,21 +128,17 @@ public class TileBuilder { } else if (ev instanceof Divider) { final Divider divider = (Divider) ev; tile = new DividerTile(divider, skin, skinParam, tileArguments.getOrigin(), tileArguments.getOmega()); - } else if (ev instanceof MessageExo) { - final MessageExo exo = (MessageExo) ev; - final LivingSpace livingSpace1 = livingSpaces.get(exo.getParticipant()); - tile = new CommunicationExoTile(livingSpace1, exo, skin, skinParam, tileArguments.getOrigin(), - tileArguments.getOmega()); } else if (ev instanceof GroupingStart) { final GroupingStart start = (GroupingStart) ev; - tile = new GroupingTile(it, start, tileArguments); + tile = new GroupingTile(it, start, tileArguments.withBackColorGeneral(start.getBackColorElement(), + start.getBackColorGeneral()), tileArguments); // tile = TileUtils.withMargin(tile, 10, 10, 10, 10); } else if (ev instanceof GroupingLeaf && ((GroupingLeaf) ev).getType() == GroupingType.ELSE) { final GroupingLeaf anElse = (GroupingLeaf) ev; tile = new ElseTile(anElse, skin, skinParam, parent); } else if (ev instanceof Reference) { final Reference ref = (Reference) ev; - tile = new ReferenceTile(ref, tileArguments); + tile = new ReferenceTile(ref, tileArguments.withBackColor(ref)); } else if (ev instanceof Delay) { final Delay delay = (Delay) ev; tile = new DelayTile(delay, tileArguments); @@ -138,5 +151,4 @@ public class TileBuilder { } return tile; } - } diff --git a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index 268040d00..f9fcbcbdb 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15907 $ + * Revision $Revision: 15936 $ * */ package net.sourceforge.plantuml.skin; @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; public abstract class AbstractTextualComponent extends AbstractComponent { @@ -62,19 +61,19 @@ public abstract class AbstractTextualComponent extends AbstractComponent { private final UFont font; private final HtmlColor fontColor; - public AbstractTextualComponent(CharSequence label, UFont2 font, HorizontalAlignment horizontalAlignment, int marginX1, - int marginX2, int marginY, ISkinSimple spriteContainer, double maxMessageSize, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + public AbstractTextualComponent(CharSequence label, FontConfiguration font, + HorizontalAlignment horizontalAlignment, int marginX1, int marginX2, int marginY, + ISkinSimple spriteContainer, double maxMessageSize, UFont fontForStereotype, + HtmlColor htmlColorForStereotype) { this(Display.getWithNewlines(label == null ? "" : label.toString()), font, horizontalAlignment, marginX1, marginX2, marginY, spriteContainer, maxMessageSize, false, fontForStereotype, htmlColorForStereotype); } - public AbstractTextualComponent(Display strings, UFont2 font, HorizontalAlignment horizontalAlignment, int marginX1, - int marginX2, int marginY, ISkinSimple spriteContainer, double maxMessageSize, + public AbstractTextualComponent(Display strings, FontConfiguration font, HorizontalAlignment horizontalAlignment, + int marginX1, int marginX2, int marginY, ISkinSimple spriteContainer, double maxMessageSize, boolean enhanced, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { this.font = font.getFont(); this.fontColor = font.getColor(); - assert fontColor.equals(font.getColor()); this.marginX1 = marginX1; this.marginX2 = marginX2; this.marginY = marginY; @@ -83,12 +82,10 @@ public abstract class AbstractTextualComponent extends AbstractComponent { if (strings.size() == 1 && strings.get(0).length() == 0) { textBlock = new TextBlockEmpty(); } else if (enhanced) { - textBlock = new BodyEnhanced2(strings, FontParam.NOTE, spriteContainer, HorizontalAlignment.LEFT, - font.getFont(), fontColor, font.getHyperlinkColor(), font.useUnderlineForHyperlink()); + textBlock = new BodyEnhanced2(strings, FontParam.NOTE, spriteContainer, HorizontalAlignment.LEFT, font); } else { - textBlock = TextBlockUtils.create(strings, new FontConfiguration(font.getFont(), fontColor, font.getHyperlinkColor(), - font.useUnderlineForHyperlink()), horizontalAlignment, spriteContainer, maxMessageSize, false, - fontForStereotype, htmlColorForStereotype); + textBlock = TextBlockUtils.create(strings, font, horizontalAlignment, spriteContainer, maxMessageSize, + false, fontForStereotype, htmlColorForStereotype); } } diff --git a/src/net/sourceforge/plantuml/skin/StickMan.java b/src/net/sourceforge/plantuml/skin/StickMan.java index 9c307a6d9..1676f2348 100644 --- a/src/net/sourceforge/plantuml/skin/StickMan.java +++ b/src/net/sourceforge/plantuml/skin/StickMan.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 15957 $ * */ package net.sourceforge.plantuml.skin; @@ -38,9 +38,8 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; @@ -49,8 +48,6 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class StickMan implements TextBlock { - private final double thickness; - private final double armsY = 8; private final double armsLenght = 13; private final double bodyLenght = 27; @@ -58,34 +55,23 @@ public class StickMan implements TextBlock { private final double legsY = 15; private final double headDiam = 16; - private final HtmlColor backgroundColor; - private final HtmlColor foregroundColor; + private final SymbolContext symbolContext; - private double deltaShadow; - - public void setDeltaShadow(double deltaShadow) { - this.deltaShadow = deltaShadow; + public StickMan(SymbolContext symbolContext) { + this.symbolContext = symbolContext; } - public StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow, double thickness) { - this.backgroundColor = backgroundColor; - this.foregroundColor = foregroundColor; - this.deltaShadow = deltaShadow; - this.thickness = thickness; - } - - public StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow) { - this(backgroundColor, foregroundColor, deltaShadow, 2); + private StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow) { + this(new SymbolContext(backgroundColor, foregroundColor).withDeltaShadow(deltaShadow).withStroke(new UStroke(2))); } public StickMan(HtmlColor backgroundColor, HtmlColor foregroundColor) { - this(backgroundColor, foregroundColor, 0, 2); + this(new SymbolContext(backgroundColor, foregroundColor).withStroke(new UStroke(2))); } public void drawU(UGraphic ug) { - ug = ug.apply(new UStroke(thickness)); - final double startX = Math.max(armsLenght, legsX) - headDiam / 2.0 + thickness; + final double startX = Math.max(armsLenght, legsX) - headDiam / 2.0 + thickness(); final UEllipse head = new UEllipse(headDiam, headDiam); final double centerX = startX + headDiam / 2; @@ -99,22 +85,26 @@ public class StickMan implements TextBlock { path.lineTo(-legsX, bodyLenght + legsY); path.moveTo(0, bodyLenght); path.lineTo(legsX, bodyLenght + legsY); - if (deltaShadow != 0) { - head.setDeltaShadow(deltaShadow); - path.setDeltaShadow(deltaShadow); + if (symbolContext.getDeltaShadow() != 0) { + head.setDeltaShadow(symbolContext.getDeltaShadow()); + path.setDeltaShadow(symbolContext.getDeltaShadow()); } - ug = ug.apply(new UChangeBackColor(backgroundColor)).apply(new UChangeColor(foregroundColor)); - ug.apply(new UTranslate(startX, thickness)).draw(head); - ug.apply(new UTranslate(centerX, headDiam + thickness)).draw(path); + ug = symbolContext.apply(ug); + ug.apply(new UTranslate(startX, thickness())).draw(head); + ug.apply(new UTranslate(centerX, headDiam + thickness())).draw(path); + } + + private double thickness() { + return symbolContext.getStroke().getThickness(); } public double getPreferredWidth() { - return Math.max(armsLenght, legsX) * 2 + 2 * thickness; + return Math.max(armsLenght, legsX) * 2 + 2 * thickness(); } public double getPreferredHeight() { - return headDiam + bodyLenght + legsY + 2 * thickness + deltaShadow + 1; + return headDiam + bodyLenght + legsY + 2 * thickness() + symbolContext.getDeltaShadow() + 1; } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/AbstractComponentBlueModernArrow.java b/src/net/sourceforge/plantuml/skin/bluemodern/AbstractComponentBlueModernArrow.java index 91db728fc..143a5f11c 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/AbstractComponentBlueModernArrow.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/AbstractComponentBlueModernArrow.java @@ -28,19 +28,19 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.bluemodern; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.ArrowComponent; import net.sourceforge.plantuml.skin.ArrowConfiguration; -import net.sourceforge.plantuml.ugraphic.UFont2; public abstract class AbstractComponentBlueModernArrow extends AbstractTextualComponent implements ArrowComponent { @@ -52,7 +52,7 @@ public abstract class AbstractComponentBlueModernArrow extends AbstractTextualCo private final ArrowConfiguration arrowConfiguration; private final HtmlColor foregroundColor; - public AbstractComponentBlueModernArrow(HtmlColor foregroundColor, UFont2 font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { + public AbstractComponentBlueModernArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { super(stringsToDisplay, font, HorizontalAlignment.LEFT, 17, 17, 2, spriteContainer, 0, false, null, null); this.arrowConfiguration = arrowConfiguration; diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/BlueModern.java b/src/net/sourceforge/plantuml/skin/bluemodern/BlueModern.java index 3fdfce6e3..62f7c7196 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/BlueModern.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/BlueModern.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15913 $ + * Revision $Revision: 15947 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -41,8 +41,8 @@ import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorSet; import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; @@ -79,17 +79,19 @@ public class BlueModern implements Skin { if (type.isArrow()) { final HtmlColor sequenceArrow = config.getColor() == null ? HtmlColorUtils.BLACK : config.getColor(); if (config.isSelfArrow()) { - return new ComponentBlueModernSelfArrow(sequenceArrow, normalFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, config, - param); + return new ComponentBlueModernSelfArrow(sequenceArrow, normalFont.toFont2(HtmlColorUtils.BLACK, + useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, config, param); } - return new ComponentBlueModernArrow(sequenceArrow, useUnderlineForHyperlink, normalFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, config, - param); + return new ComponentBlueModernArrow(sequenceArrow, useUnderlineForHyperlink, normalFont.toFont2( + HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, config, param); } if (type == ComponentType.PARTICIPANT_HEAD) { - return new ComponentBlueModernParticipant(blue1, blue2, participantFont.toFont2(HtmlColorUtils.WHITE, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); + return new ComponentBlueModernParticipant(blue1, blue2, participantFont.toFont2(HtmlColorUtils.WHITE, + useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); } if (type == ComponentType.PARTICIPANT_TAIL) { - return new ComponentBlueModernParticipant(blue1, blue2, participantFont.toFont2(HtmlColorUtils.WHITE, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); + return new ComponentBlueModernParticipant(blue1, blue2, participantFont.toFont2(HtmlColorUtils.WHITE, + useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); } if (type == ComponentType.PARTICIPANT_LINE) { return new ComponentBlueModernLine(lineColor); @@ -98,14 +100,16 @@ public class BlueModern implements Skin { return new ComponentBlueModernLine(lineColor); } if (type == ComponentType.ACTOR_HEAD) { - return new ComponentBlueModernActor(blue2, blue1, participantFont.toFont2(blue1, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, true, param); + return new ComponentBlueModernActor(blue2, blue1, participantFont.toFont2(blue1, useUnderlineForHyperlink, + hyperlinkColor), stringsToDisplay, true, param); } if (type == ComponentType.ACTOR_TAIL) { - return new ComponentBlueModernActor(blue2, blue1, participantFont.toFont2(blue1, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay,false, param); + return new ComponentBlueModernActor(blue2, blue1, participantFont.toFont2(blue1, useUnderlineForHyperlink, + hyperlinkColor), stringsToDisplay, false, param); } if (type == ComponentType.NOTE) { - return new ComponentBlueModernNote(HtmlColorUtils.WHITE, HtmlColorUtils.BLACK, normalFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), - stringsToDisplay, param); + return new ComponentBlueModernNote(HtmlColorUtils.WHITE, HtmlColorUtils.BLACK, normalFont.toFont2( + HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); } if (type == ComponentType.ALIVE_BOX_CLOSE_CLOSE) { return new ComponentBlueModernActiveLine(blue1, true, true); @@ -123,43 +127,50 @@ public class BlueModern implements Skin { return new ComponentBlueModernDelayLine(lineColor); } if (type == ComponentType.DELAY_TEXT) { - return new ComponentBlueModernDelayText(param.getFont( - FontParam.SEQUENCE_DELAY, null, false).toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); + return new ComponentBlueModernDelayText(param.getFont(FontParam.SEQUENCE_DELAY, null, false).toFont2( + HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); } if (type == ComponentType.DESTROY) { return new ComponentRoseDestroy(red); } if (type == ComponentType.GROUPING_HEADER) { return new ComponentBlueModernGroupingHeader(blue1, blue3, borderGroupColor, HtmlColorUtils.BLACK, - normalFont.toFont2(HtmlColorUtils.WHITE, useUnderlineForHyperlink, hyperlinkColor), smallFont, stringsToDisplay, param); + normalFont.toFont2(HtmlColorUtils.WHITE, useUnderlineForHyperlink, hyperlinkColor), smallFont, + stringsToDisplay, param); } if (type == ComponentType.GROUPING_ELSE) { - return new ComponentRoseGroupingElse(HtmlColorUtils.BLACK, smallFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay.get(0), param, blue3, - Rose.getStroke(param, LineParam.sequenceGroupBorder, 2)); + return new ComponentRoseGroupingElse(HtmlColorUtils.BLACK, smallFont.toFont2(HtmlColorUtils.BLACK, + useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay.get(0), param, blue3); } if (type == ComponentType.GROUPING_SPACE) { return new ComponentRoseGroupingSpace(7); } if (type == ComponentType.TITLE) { - return new ComponentRoseTitle(bigFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, param); + return new ComponentRoseTitle(bigFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, + hyperlinkColor), stringsToDisplay, param); } if (type == ComponentType.REFERENCE) { - return new ComponentRoseReference(HtmlColorUtils.WHITE, normalFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), blue1, borderGroupColor, blue3, - normalFont, stringsToDisplay, HorizontalAlignment.CENTER, param, 0, Rose.getStroke(param, LineParam.sequenceDividerBorder, 2)); + return new ComponentRoseReference(normalFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, + hyperlinkColor), new SymbolContext(blue1, borderGroupColor).withStroke(Rose.getStroke(param, + LineParam.sequenceDividerBorder, 2)), normalFont.toFont2(HtmlColorUtils.WHITE, + useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, HorizontalAlignment.CENTER, param, + blue3); } if (type == ComponentType.NEWPAGE) { return new ComponentBlueModernNewpage(blue1); } if (type == ComponentType.DIVIDER) { - return new ComponentBlueModernDivider(normalFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), blue2, blue1, HtmlColorUtils.BLACK, stringsToDisplay, param); + return new ComponentBlueModernDivider(normalFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, + hyperlinkColor), blue2, blue1, HtmlColorUtils.BLACK, stringsToDisplay, param); } if (type == ComponentType.SIGNATURE) { - return new ComponentRoseTitle(smallFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), Display.create( - "This skin was created ", "in April 2009."), param); + return new ComponentRoseTitle(smallFont.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, + hyperlinkColor), Display.create("This skin was created ", "in April 2009."), param); } if (type == ComponentType.ENGLOBER) { - return new ComponentBlueModernEnglober(blue1, blue3, stringsToDisplay, param.getFont(FontParam.SEQUENCE_BOX, null, false).toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, hyperlinkColor), - param); + return new ComponentBlueModernEnglober(blue1, blue3, stringsToDisplay, param.getFont( + FontParam.SEQUENCE_BOX, null, false).toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, + hyperlinkColor), param); } return null; diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernActor.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernActor.java index acc95c664..e1dc795b3 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernActor.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernActor.java @@ -28,13 +28,14 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.bluemodern; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -43,7 +44,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.StickMan; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -52,7 +52,7 @@ public class ComponentBlueModernActor extends AbstractTextualComponent { private final StickMan stickman; private final boolean head; - public ComponentBlueModernActor(HtmlColor backgroundColor, HtmlColor foregroundColor, UFont2 font, + public ComponentBlueModernActor(HtmlColor backgroundColor, HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, boolean head, ISkinSimple spriteContainer) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false, null, null); diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java index 7f5ffaeae..86e755fa1 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -39,6 +39,7 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; @@ -47,7 +48,6 @@ import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.ArrowPart; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -56,7 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentBlueModernArrow extends AbstractComponentBlueModernArrow { - public ComponentBlueModernArrow(HtmlColor foregroundColor, boolean useUnderlineForHyperlink, UFont2 font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, + public ComponentBlueModernArrow(HtmlColor foregroundColor, boolean useUnderlineForHyperlink, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer); } diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayText.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayText.java index 392fe0c36..d2870c355 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayText.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayText.java @@ -37,18 +37,18 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentBlueModernDelayText extends AbstractTextualComponent { - public ComponentBlueModernDelayText(UFont2 font, Display stringsToDisplay, + public ComponentBlueModernDelayText(FontConfiguration font, Display stringsToDisplay, ISkinSimple spriteContainer) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, 0, false, null, null); diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDivider.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDivider.java index 101c872ff..bbd723375 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDivider.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDivider.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; @@ -46,7 +47,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -59,7 +59,7 @@ public class ComponentBlueModernDivider extends AbstractTextualComponent { private final HtmlColor background2; private final HtmlColor borderColor; - public ComponentBlueModernDivider(UFont2 font, HtmlColor background1, HtmlColor background2, + public ComponentBlueModernDivider(FontConfiguration font, HtmlColor background1, HtmlColor background2, HtmlColor borderColor, Display stringsToDisplay, ISkinSimple spriteContainer) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, 0, false, null, null); diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernEnglober.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernEnglober.java index 922fcb583..6e96b5fbe 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernEnglober.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernEnglober.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -44,7 +45,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -56,7 +56,7 @@ public class ComponentBlueModernEnglober extends AbstractTextualComponent { private final HtmlColor backColor; public ComponentBlueModernEnglober(HtmlColor borderColor, HtmlColor backColor, Display strings, - UFont2 font, ISkinSimple spriteContainer) { + FontConfiguration font, ISkinSimple spriteContainer) { super(strings, font, HorizontalAlignment.CENTER, 4, 4, 1, spriteContainer, 0, false, null, null); this.borderColor = borderColor; diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java index 61a99e7d5..496428b53 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernGroupingHeader.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -68,7 +67,7 @@ public class ComponentBlueModernGroupingHeader extends AbstractTextualComponent private final HtmlColor borderColor; public ComponentBlueModernGroupingHeader(HtmlColor headerBackgroundColor, HtmlColor generalBackgroundColor, - HtmlColor borderColor, HtmlColor fontColor2, UFont2 bigFont, UFont smallFont, Display strings, ISkinSimple spriteContainer) { + HtmlColor borderColor, HtmlColor fontColor2, FontConfiguration bigFont, UFont smallFont, Display strings, ISkinSimple spriteContainer) { super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null); this.headerBackgroundColor = headerBackgroundColor; diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNote.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNote.java index ac054a755..2cdbc1a8f 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNote.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNote.java @@ -28,13 +28,14 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.bluemodern; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -42,7 +43,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -55,7 +55,7 @@ final public class ComponentBlueModernNote extends AbstractTextualComponent { private final HtmlColor back; private final HtmlColor foregroundColor; - public ComponentBlueModernNote(HtmlColor back, HtmlColor foregroundColor, UFont2 font, + public ComponentBlueModernNote(HtmlColor back, HtmlColor foregroundColor, FontConfiguration font, Display strings, ISkinSimple spriteContainer) { super(strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, 0, false, null, null); diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernParticipant.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernParticipant.java index 77684fbfb..fe7cf8287 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernParticipant.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernParticipant.java @@ -28,20 +28,20 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.bluemodern; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -51,7 +51,7 @@ public class ComponentBlueModernParticipant extends AbstractTextualComponent { private final HtmlColor blue1; private final HtmlColor blue2; - public ComponentBlueModernParticipant(HtmlColor blue1, HtmlColor blue2, UFont2 font, + public ComponentBlueModernParticipant(HtmlColor blue1, HtmlColor blue2, FontConfiguration font, Display stringsToDisplay, ISkinSimple spriteContainer) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, 0, false, null, null); diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java index 06e39a3a9..10ce461e4 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -38,6 +38,7 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.Area; @@ -45,7 +46,6 @@ import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowPart; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -56,7 +56,7 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr private final double arrowWidth = 45; - public ComponentBlueModernSelfArrow(HtmlColor foregroundColor, UFont2 font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { + public ComponentBlueModernSelfArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer); } diff --git a/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java index 552876e21..10794d263 100644 --- a/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java @@ -28,19 +28,19 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.ArrowComponent; import net.sourceforge.plantuml.skin.ArrowConfiguration; -import net.sourceforge.plantuml.ugraphic.UFont2; public abstract class AbstractComponentRoseArrow extends AbstractTextualComponent implements ArrowComponent { @@ -49,7 +49,7 @@ public abstract class AbstractComponentRoseArrow extends AbstractTextualComponen private final HtmlColor foregroundColor; private final ArrowConfiguration arrowConfiguration; - public AbstractComponentRoseArrow(HtmlColor foregroundColor, UFont2 font, Display stringsToDisplay, + public AbstractComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment, double maxMessageSize) { super(stringsToDisplay, font, textHorizontalAlignment, 7, 7, 1, spriteContainer, diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java index 02fa9b1a3..c1f77c2f8 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java @@ -28,15 +28,15 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15913 $ + * Revision $Revision: 15967 $ * */ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -48,19 +48,14 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseActiveLine extends AbstractComponent { - private final HtmlColor foregroundColor; - private final HtmlColor lifeLineBackground; + private final SymbolContext symbolContext; private final boolean closeUp; private final boolean closeDown; - private final boolean withShadow; - public ComponentRoseActiveLine(HtmlColor lifeLineBackground, HtmlColor foregroundColor, boolean closeUp, - boolean closeDown, boolean withShadow) { - this.foregroundColor = foregroundColor; - this.lifeLineBackground = lifeLineBackground; + public ComponentRoseActiveLine(SymbolContext symbolContext, boolean closeUp, boolean closeDown) { + this.symbolContext = symbolContext; this.closeUp = closeUp; this.closeDown = closeDown; - this.withShadow = withShadow; } protected void drawInternalU(UGraphic ug, Area area) { @@ -69,15 +64,16 @@ public class ComponentRoseActiveLine extends AbstractComponent { final int x = (int) (dimensionToUse.getWidth() - getPreferredWidth(stringBounder)) / 2; final URectangle rect = new URectangle(getPreferredWidth(stringBounder), dimensionToUse.getHeight()); - if (withShadow) { + if (symbolContext.isShadowing()) { rect.setDeltaShadow(1); } - ug = ug.apply(new UChangeColor(foregroundColor)); + ug = ug.apply(new UChangeColor(symbolContext.getForeColor())); if (closeUp && closeDown) { - ug.apply(new UChangeBackColor(lifeLineBackground)).apply(new UTranslate(x, 0)).draw(rect); + ug.apply(new UChangeBackColor(symbolContext.getBackColor())).apply(new UTranslate(x, 0)).draw(rect); return; } - ug.apply(new UChangeBackColor(lifeLineBackground)).apply(new UChangeColor(lifeLineBackground)).apply(new UTranslate(x, 0)).draw(rect); + ug.apply(new UChangeBackColor(symbolContext.getBackColor())).apply(new UChangeColor(symbolContext.getBackColor())) + .apply(new UTranslate(x, 0)).draw(rect); final ULine vline = new ULine(0, dimensionToUse.getHeight()); ug.apply(new UTranslate(x, 0)).draw(vline); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java index ad45bc32d..08506576e 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActor.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15913 $ + * Revision $Revision: 15955 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -37,18 +37,17 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.skin.StickMan; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseActor extends AbstractTextualComponent { @@ -56,13 +55,12 @@ public class ComponentRoseActor extends AbstractTextualComponent { private final TextBlock stickman; private final boolean head; - public ComponentRoseActor(BiColor biColor, UFont2 font, Display stringsToDisplay, - boolean head, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { - super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, - spriteContainer, 0, false, fontForStereotype, htmlColorForStereotype); + public ComponentRoseActor(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, + ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false, + fontForStereotype, htmlColorForStereotype); this.head = head; - this.stickman = new StickMan(biColor.getYellowBack(), biColor.getRedBorder(), deltaShadow, stroke.getThickness()); + this.stickman = new StickMan(biColor); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java index 65b80f19c..537f5e449 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java @@ -38,6 +38,7 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -51,7 +52,6 @@ import net.sourceforge.plantuml.skin.ArrowPart; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -63,7 +63,7 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { private final HorizontalAlignment messagePosition; private final boolean niceArrow; - public ComponentRoseArrow(HtmlColor foregroundColor, UFont2 font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer, + public ComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment, double maxMessageSize, boolean niceArrow) { super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, textHorizontalAlignment, maxMessageSize); this.messagePosition = messagePosition; diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java index af36163a6..74160e2e8 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseBoundary.java @@ -37,18 +37,17 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.svek.Boundary; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseBoundary extends AbstractTextualComponent { @@ -56,13 +55,12 @@ public class ComponentRoseBoundary extends AbstractTextualComponent { private final TextBlock stickman; private final boolean head; - public ComponentRoseBoundary(BiColor biColor, UFont2 font, Display stringsToDisplay, - boolean head, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { - super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, - spriteContainer, 0, false, fontForStereotype, htmlColorForStereotype); + public ComponentRoseBoundary(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, + ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false, + fontForStereotype, htmlColorForStereotype); this.head = head; - this.stickman = new Boundary(biColor.getYellowBack(), biColor.getRedBorder(), deltaShadow, stroke.getThickness()); + this.stickman = new Boundary(biColor); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java index f93fff042..6ed670aae 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseControl.java @@ -37,18 +37,17 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.svek.Control; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseControl extends AbstractTextualComponent { @@ -56,13 +55,12 @@ public class ComponentRoseControl extends AbstractTextualComponent { private final TextBlock stickman; private final boolean head; - public ComponentRoseControl(BiColor biColor, UFont2 font, Display stringsToDisplay, - boolean head, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { - super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, - spriteContainer, 0, false, fontForStereotype, htmlColorForStereotype); + public ComponentRoseControl(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, + ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false, + fontForStereotype, htmlColorForStereotype); this.head = head; - this.stickman = new Control(biColor.getYellowBack(), biColor.getRedBorder(), deltaShadow, stroke.getThickness()); + this.stickman = new Control(biColor); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java index bee4171bd..f1be9a47c 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDatabase.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -46,9 +47,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -58,16 +57,14 @@ public class ComponentRoseDatabase extends AbstractTextualComponent { private final TextBlock stickman; private final boolean head; - public ComponentRoseDatabase(BiColor biColor, UFont2 font, Display stringsToDisplay, - boolean head, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { - super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, - spriteContainer, 0, false, fontForStereotype, htmlColorForStereotype); + public ComponentRoseDatabase(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, + ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false, + fontForStereotype, htmlColorForStereotype); this.head = head; - // this.stickman = new Control(yellow, red, deltaShadow, stroke.getThickness()); - final SymbolContext symbolContext = new SymbolContext(biColor.getYellowBack(), biColor.getRedBorder()).withStroke(new UStroke(1.5)).withShadow( - deltaShadow > 0); + final SymbolContext symbolContext = new SymbolContext(biColor.getBackColor(), biColor.getForeColor()) + .withStroke(new UStroke(1.5)).withShadow(biColor.getDeltaShadow() > 0); this.stickman = USymbol.DATABASE.asSmall(TextBlockUtils.empty(16, 17), TextBlockUtils.empty(0, 0), symbolContext); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java index 6c76da0a7..7011d87da 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayText.java @@ -37,18 +37,18 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseDelayText extends AbstractTextualComponent { - public ComponentRoseDelayText(UFont2 font, Display stringsToDisplay, ISkinSimple spriteContainer) { + public ComponentRoseDelayText(FontConfiguration font, Display stringsToDisplay, ISkinSimple spriteContainer) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 0, 0, 4, spriteContainer, 0, false, null, null); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java index 4105c0b52..06611f39a 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java @@ -37,6 +37,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; @@ -46,7 +47,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -61,7 +61,7 @@ public class ComponentRoseDivider extends AbstractTextualComponent { private final boolean withShadow; private final UStroke stroke; - public ComponentRoseDivider(UFont2 font, HtmlColor background, Display stringsToDisplay, + public ComponentRoseDivider(FontConfiguration font, HtmlColor background, Display stringsToDisplay, ISkinSimple spriteContainer, boolean withShadow, UStroke stroke) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 4, 4, 4, spriteContainer, 0, false, null, null); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java index a33120054..0fef92ed3 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEnglober.java @@ -37,35 +37,29 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseEnglober extends AbstractTextualComponent { - private final HtmlColor borderColor; - private final HtmlColor backColor; + private final SymbolContext symbolContext; - public ComponentRoseEnglober(HtmlColor backColor, HtmlColor borderColor, Display strings, UFont2 font, - ISkinSimple spriteContainer) { - super(strings, font, HorizontalAlignment.CENTER, 3, 3, 1, spriteContainer, 0, false, - null, null); - this.borderColor = borderColor; - this.backColor = backColor; + public ComponentRoseEnglober(SymbolContext symbolContext, Display strings, FontConfiguration font, ISkinSimple spriteContainer) { + super(strings, font, HorizontalAlignment.CENTER, 3, 3, 1, spriteContainer, 0, false, null, null); + this.symbolContext = symbolContext; } @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ug.apply(new UChangeBackColor(backColor)).apply(new UChangeColor(borderColor)); + ug = symbolContext.apply(ug); ug.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight())); final double xpos = (dimensionToUse.getWidth() - getPureTextWidth(ug.getStringBounder())) / 2; getTextBlock().drawU(ug.apply(new UTranslate(xpos, 0))); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java index 124ac9f3b..8e0cace86 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseEntity.java @@ -37,18 +37,17 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.svek.EntityDomain; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseEntity extends AbstractTextualComponent { @@ -56,13 +55,12 @@ public class ComponentRoseEntity extends AbstractTextualComponent { private final TextBlock stickman; private final boolean head; - public ComponentRoseEntity(BiColor biColor, UFont2 font, Display stringsToDisplay, - boolean head, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke, - UFont fontForStereotype, HtmlColor htmlColorForStereotype) { - super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, - spriteContainer, 0, false, fontForStereotype, htmlColorForStereotype); + public ComponentRoseEntity(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, boolean head, + ISkinSimple spriteContainer, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { + super(stringsToDisplay, font, HorizontalAlignment.CENTER, 3, 3, 0, spriteContainer, 0, false, + fontForStereotype, htmlColorForStereotype); this.head = head; - this.stickman = new EntityDomain(biColor.getYellowBack(), biColor.getRedBorder(), deltaShadow, stroke.getThickness()); + this.stickman = new EntityDomain(biColor); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java index ea83be980..03a02dfd3 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -43,7 +44,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -54,15 +54,16 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent { private final HtmlColor groupBorder; private final HtmlColor backgroundColor; - private final UStroke stroke; - public ComponentRoseGroupingElse(HtmlColor groupBorder, UFont2 smallFont, CharSequence comment, - ISkinSimple spriteContainer, HtmlColor backgroundColor, UStroke stroke) { - super(comment == null ? null : "[" + comment + "]", smallFont, HorizontalAlignment.LEFT, 5, - 5, 1, spriteContainer, 0, null, null); + // private final UStroke stroke; + + public ComponentRoseGroupingElse(HtmlColor groupBorder, FontConfiguration smallFont, CharSequence comment, + ISkinSimple spriteContainer, HtmlColor backgroundColor) { + super(comment == null ? null : "[" + comment + "]", smallFont, HorizontalAlignment.LEFT, 5, 5, 1, + spriteContainer, 0, null, null); this.groupBorder = groupBorder; this.backgroundColor = backgroundColor; - this.stroke = stroke; + // this.stroke = stroke; } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java index e6a78f7d5..63d2effa3 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15913 $ + * Revision $Revision: 15964 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -41,15 +41,14 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -63,28 +62,21 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { private final TextBlock commentTextBlock; - private final HtmlColor groupBackground; - private final HtmlColor groupBorder; private final HtmlColor background; - private final double deltaShadow; - private final UStroke stroke; + private final SymbolContext symbolContext; - public ComponentRoseGroupingHeader(HtmlColor background, BiColor biColor, - UFont2 bigFont, UFont smallFont, Display strings, ISkinSimple spriteContainer, double deltaShadow, - UStroke stroke) { - super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, - spriteContainer, 0, null, null); - this.groupBackground = biColor.getYellowBack(); - this.groupBorder = biColor.getRedBorder(); + public ComponentRoseGroupingHeader(HtmlColor background, SymbolContext symbolContext, FontConfiguration bigFont, UFont smallFont, + Display strings, ISkinSimple spriteContainer) { + super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null); + this.symbolContext = symbolContext; this.background = background; - this.stroke = stroke; - this.deltaShadow = deltaShadow; if (strings.size() == 1 || strings.get(1) == null) { this.commentTextBlock = null; } else { final Display display = Display.getWithNewlines("[" + strings.get(1) + "]"); this.commentTextBlock = TextBlockUtils.create(display, new FontConfiguration(smallFont, bigFont.getColor(), - bigFont.getHyperlinkColor(), bigFont.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, spriteContainer); + bigFont.getHyperlinkColor(), bigFont.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, + spriteContainer); } if (this.background == null) { throw new IllegalArgumentException(); @@ -125,16 +117,16 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ug.apply(stroke).apply(new UChangeColor(groupBorder)); + ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor())); final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()); - rect.setDeltaShadow(deltaShadow); + rect.setDeltaShadow(symbolContext.getDeltaShadow()); ug.apply(new UChangeBackColor(background)).draw(rect); } @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = ug.apply(stroke).apply(new UChangeColor(groupBorder)); + ug = symbolContext.applyStroke(ug).apply(new UChangeColor(symbolContext.getForeColor())); final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()); ug.draw(rect); @@ -152,7 +144,7 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { polygon.addPoint(0, textHeight); polygon.addPoint(0, 0); - ug.apply(new UChangeColor(groupBorder)).apply(new UChangeBackColor(groupBackground)).draw(polygon); + symbolContext.applyColors(ug).draw(polygon); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java index 7de0bbaa3..c3eb762a5 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNote.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15913 $ + * Revision $Revision: 15961 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -36,15 +36,15 @@ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.ULine; @@ -55,34 +55,27 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; final public class ComponentRoseNote extends AbstractTextualComponent implements Stencil { private final int cornersize = 10; - private final HtmlColor back; - private final HtmlColor foregroundColor; private final double paddingX; private final double paddingY; - private final double deltaShadow; - private final UStroke stroke; + private final SymbolContext symbolContext; - public ComponentRoseNote(BiColor biColor, UFont2 font, Display strings, - double paddingX, double paddingY, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke) { - super(strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, 0, true, - null, null); - this.back = biColor.getYellowBack(); - this.foregroundColor = biColor.getRedBorder(); + public ComponentRoseNote(SymbolContext symbolContext, FontConfiguration font, Display strings, double paddingX, double paddingY, + ISkinSimple spriteContainer) { + super(strings, font, HorizontalAlignment.LEFT, 6, 15, 5, spriteContainer, 0, true, null, null); this.paddingX = paddingX; this.paddingY = paddingY; - this.deltaShadow = deltaShadow; - this.stroke = stroke; + this.symbolContext = symbolContext; } @Override final public double getPreferredWidth(StringBounder stringBounder) { - final double result = getTextWidth(stringBounder) + 2 * getPaddingX() + deltaShadow; + final double result = getTextWidth(stringBounder) + 2 * getPaddingX() + symbolContext.getDeltaShadow(); return result; } @Override final public double getPreferredHeight(StringBounder stringBounder) { - return getTextHeight(stringBounder) + 2 * getPaddingY() + deltaShadow; + return getTextHeight(stringBounder) + 2 * getPaddingY() + symbolContext.getDeltaShadow(); } @Override @@ -117,10 +110,9 @@ final public class ComponentRoseNote extends AbstractTextualComponent implements polygon.addPoint(x2, cornersize); polygon.addPoint(x2 - cornersize, 0); polygon.addPoint(0, 0); - polygon.setDeltaShadow(deltaShadow); + polygon.setDeltaShadow(symbolContext.getDeltaShadow()); - ug = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(foregroundColor)); - ug = ug.apply(stroke); + ug = symbolContext.apply(ug); ug.draw(polygon); ug.apply(new UTranslate(x2 - cornersize, 0)).draw(new ULine(0, cornersize)); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java index d8f71320b..42bc0b36d 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteBox.java @@ -35,15 +35,12 @@ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -51,19 +48,12 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; final public class ComponentRoseNoteBox extends AbstractTextualComponent { - private final HtmlColor back; - private final HtmlColor foregroundColor; - private final double deltaShadow; - private final UStroke stroke; + private final SymbolContext symbolContext; - public ComponentRoseNoteBox(BiColor biColor, UFont2 font, - Display strings, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke) { - super(strings, font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, 0, false, - null, null); - this.back = biColor.getYellowBack(); - this.foregroundColor = biColor.getRedBorder(); - this.deltaShadow = deltaShadow; - this.stroke = stroke; + public ComponentRoseNoteBox(SymbolContext symbolContext, FontConfiguration font, Display strings, + ISkinSimple spriteContainer) { + super(strings, font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, 0, false, null, null); + this.symbolContext = symbolContext; } @Override @@ -101,10 +91,9 @@ final public class ComponentRoseNoteBox extends AbstractTextualComponent { x2 = (int) (area.getDimensionToUse().getWidth() - 2 * getPaddingX()); } - ug = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(foregroundColor)); - ug = ug.apply(stroke); + ug = symbolContext.apply(ug); final URectangle rect = new URectangle(x2, textHeight); - rect.setDeltaShadow(deltaShadow); + rect.setDeltaShadow(symbolContext.getDeltaShadow()); ug.draw(rect); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java index cb11a1767..7615f961a 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNoteHexagonal.java @@ -35,15 +35,12 @@ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -52,19 +49,13 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; final public class ComponentRoseNoteHexagonal extends AbstractTextualComponent { private final int cornersize = 10; - private final HtmlColor back; - private final HtmlColor foregroundColor; - private final double deltaShadow; - private final UStroke stroke; + private final SymbolContext symbolContext; + - public ComponentRoseNoteHexagonal(BiColor biColor, UFont2 font, - Display strings, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke) { - super(strings, font, HorizontalAlignment.LEFT, 12, 12, 4, spriteContainer, 0, false, - null, null); - this.back = biColor.getYellowBack(); - this.foregroundColor = biColor.getRedBorder(); - this.deltaShadow = deltaShadow; - this.stroke = stroke; + public ComponentRoseNoteHexagonal(SymbolContext symbolContext, FontConfiguration font, Display strings, + ISkinSimple spriteContainer) { + super(strings, font, HorizontalAlignment.LEFT, 12, 12, 4, spriteContainer, 0, false, null, null); + this.symbolContext = symbolContext; } @Override @@ -111,9 +102,8 @@ final public class ComponentRoseNoteHexagonal extends AbstractTextualComponent { polygon.addPoint(0, textHeight / 2); polygon.addPoint(cornersize, 0); - ug = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(foregroundColor)); - polygon.setDeltaShadow(deltaShadow); - ug = ug.apply(stroke); + ug = symbolContext.apply(ug); + polygon.setDeltaShadow(symbolContext.getDeltaShadow()); ug.draw(polygon); ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java index a0e8ca11a..76eccbcd9 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java @@ -28,24 +28,24 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15913 $ + * Revision $Revision: 15953 $ * */ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -59,16 +59,16 @@ public class ComponentRoseParticipant extends AbstractTextualComponent { private final double roundCorner; private final UStroke stroke; - public ComponentRoseParticipant(BiColor biColor, UFont2 font, - Display stringsToDisplay, ISkinSimple spriteContainer, double deltaShadow, double roundCorner, - UStroke stroke, UFont fontForStereotype, HtmlColor htmlColorForStereotype) { - super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, - spriteContainer, 0, false, fontForStereotype, htmlColorForStereotype); - this.back = biColor.getYellowBack(); + public ComponentRoseParticipant(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, + ISkinSimple spriteContainer, double roundCorner, UFont fontForStereotype, + HtmlColor htmlColorForStereotype) { + super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, 0, false, + fontForStereotype, htmlColorForStereotype); + this.back = biColor.getBackColor(); this.roundCorner = roundCorner; - this.deltaShadow = deltaShadow; - this.foregroundColor = biColor.getRedBorder(); - this.stroke = stroke; + this.deltaShadow = biColor.getDeltaShadow(); + this.foregroundColor = biColor.getForeColor(); + this.stroke = biColor.getStroke(); } @Override diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java index afd3dbc0a..43f660ddc 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseReference.java @@ -41,14 +41,11 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -57,31 +54,23 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentRoseReference extends AbstractTextualComponent { - private final HtmlColor backgroundHeader; - private final HtmlColor borderColor; private final HtmlColor background; private final int cornersize = 10; private final TextBlock textHeader; private final double heightFooter = 5; private final double xMargin = 2; private final HorizontalAlignment position; - private final double deltaShadow; - private final UStroke stroke; + private final SymbolContext symbolContext; - public ComponentRoseReference(HtmlColor fontHeaderColor, UFont2 font, HtmlColor backgroundHeader, - HtmlColor borderColor, HtmlColor background, UFont header, Display stringsToDisplay, - HorizontalAlignment position, ISkinSimple spriteContainer, double deltaShadow, UStroke stroke) { + public ComponentRoseReference(FontConfiguration font, SymbolContext symbolContext, FontConfiguration header, + Display stringsToDisplay, HorizontalAlignment position, ISkinSimple spriteContainer, HtmlColor background) { super(stringsToDisplay.subList(1, stringsToDisplay.size()), font, HorizontalAlignment.LEFT, 4, 4, 4, spriteContainer, 0, false, null, null); this.position = position; - this.backgroundHeader = backgroundHeader; + this.symbolContext = symbolContext; this.background = background; - this.borderColor = borderColor; - this.deltaShadow = deltaShadow; - this.stroke = stroke; - textHeader = TextBlockUtils.create(stringsToDisplay.subList(0, 1), new FontConfiguration(header, - fontHeaderColor, font.getHyperlinkColor(), font.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, + this.textHeader = TextBlockUtils.create(stringsToDisplay.subList(0, 1), header, HorizontalAlignment.LEFT, spriteContainer); } @@ -93,11 +82,11 @@ public class ComponentRoseReference extends AbstractTextualComponent { final int textHeaderWidth = (int) (getHeaderWidth(stringBounder)); final int textHeaderHeight = (int) (getHeaderHeight(stringBounder)); - ug = ug.apply(stroke); - final URectangle rect = new URectangle(dimensionToUse.getWidth() - xMargin * 2 - deltaShadow, - dimensionToUse.getHeight() - heightFooter); - rect.setDeltaShadow(deltaShadow); - ug = ug.apply(new UChangeBackColor(background)).apply(new UChangeColor(borderColor)); + final URectangle rect = new URectangle( + dimensionToUse.getWidth() - xMargin * 2 - symbolContext.getDeltaShadow(), dimensionToUse.getHeight() + - heightFooter); + rect.setDeltaShadow(symbolContext.getDeltaShadow()); + ug = symbolContext.withBackColor(background).apply(ug); ug.apply(new UTranslate(xMargin, 0)).draw(rect); final UPolygon polygon = new UPolygon(); @@ -110,7 +99,7 @@ public class ComponentRoseReference extends AbstractTextualComponent { polygon.addPoint(0, textHeaderHeight); polygon.addPoint(0, 0); - ug = ug.apply(new UChangeBackColor(backgroundHeader)).apply(new UChangeColor(borderColor)); + ug = symbolContext.apply(ug); ug.apply(new UTranslate(xMargin, 0)).draw(polygon); ug = ug.apply(new UStroke()); @@ -146,7 +135,8 @@ public class ComponentRoseReference extends AbstractTextualComponent { @Override public double getPreferredWidth(StringBounder stringBounder) { - return Math.max(getTextWidth(stringBounder), getHeaderWidth(stringBounder)) + xMargin * 2 + deltaShadow; + return Math.max(getTextWidth(stringBounder), getHeaderWidth(stringBounder)) + xMargin * 2 + + symbolContext.getDeltaShadow(); } } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java index ea4294080..36d8109b0 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -38,6 +38,7 @@ import java.awt.geom.Point2D; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -49,7 +50,6 @@ import net.sourceforge.plantuml.skin.ArrowPart; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -61,7 +61,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { private final double arrowWidth = 45; private final boolean niceArrow; - public ComponentRoseSelfArrow(HtmlColor foregroundColor, UFont2 font, Display stringsToDisplay, + public ComponentRoseSelfArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, double maxMessageSize, boolean niceArrow) { super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, HorizontalAlignment.LEFT, diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java index 6afbb8fb3..accb1811f 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseTitle.java @@ -28,19 +28,19 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15908 $ + * Revision $Revision: 15934 $ * */ package net.sourceforge.plantuml.skin.rose; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -48,7 +48,7 @@ public class ComponentRoseTitle extends AbstractTextualComponent { private final int outMargin = 5; - public ComponentRoseTitle(UFont2 font, Display stringsToDisplay, ISkinSimple spriteContainer) { + public ComponentRoseTitle(FontConfiguration font, Display stringsToDisplay, ISkinSimple spriteContainer) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, 0, false, null, null); } diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java index 8a6423d01..54c2a5d1b 100644 --- a/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15913 $ + * Revision $Revision: 15981 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -40,17 +40,17 @@ import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.skin.ArrowDirection; -import net.sourceforge.plantuml.skin.BiColor; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Skin; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.UFont2; import net.sourceforge.plantuml.ugraphic.UStroke; public class Rose implements Skin { @@ -77,37 +77,18 @@ public class Rose implements Skin { return result; } - private UFont2 getUFont2(ISkinParam param, FontParam fontParam) { + private FontConfiguration getUFont2(ISkinParam param, FontParam fontParam) { final UFont font = param.getFont(fontParam, null, false); final HtmlColor fontColor = getFontColor(param, fontParam); - return font.toFont2(fontColor, param.useUnderlineForHyperlink(), param.getHyperlinkColor()); + return new FontConfiguration(font, fontColor, param.getHyperlinkColor(), param.useUnderlineForHyperlink()); } public Component createComponent(ComponentType type, ArrowConfiguration config, ISkinParam param, Display stringsToDisplay) { - final HtmlColor background = param.getBackgroundColor(); - final HtmlColor hyperlinkColor = param.getHyperlinkColor(); - final boolean useUnderlineForHyperlink = param.useUnderlineForHyperlink(); - final HtmlColor groupBorder = getHtmlColor(param, ColorParam.sequenceGroupBorder); - final HtmlColor groupBackground = getHtmlColor(param, ColorParam.sequenceGroupBackground); - final HtmlColor sequenceDividerBackground = getHtmlColor(param, ColorParam.sequenceDividerBackground); - final HtmlColor sequenceReferenceBackground = getHtmlColor(param, ColorParam.sequenceReferenceBackground); - final HtmlColor sequenceReferenceHeaderBackground = getHtmlColor(param, - ColorParam.sequenceReferenceHeaderBackground); - final HtmlColor sequenceReferenceBorder = getHtmlColor(param, ColorParam.sequenceReferenceBorder); - final HtmlColor lifeLineBackgroundColor = getHtmlColor(param, ColorParam.sequenceLifeLineBackground); - final HtmlColor sequenceActorBackground = getHtmlColor(param, ColorParam.actorBackground); - final HtmlColor sequenceParticipantBackground = getHtmlColor(param, ColorParam.participantBackground); - - // final UFont fontArrow = param.getFont(FontParam.SEQUENCE_ARROW, null, false); final UFont fontGrouping = param.getFont(FontParam.SEQUENCE_GROUP, null, false); - // final UFont fontParticipant = param.getFont(FontParam.PARTICIPANT, null, false); - // final UFont fontActor = param.getFont(FontParam.ACTOR, null, false); final UFont newFontForStereotype = param.getFont(FontParam.SEQUENCE_STEREOTYPE, null, false); - final double deltaShadow = param.shadowing() ? 4.0 : 0; - if (type.isArrow()) { // if (param.maxMessageSize() > 0) { // final FontConfiguration fc = new FontConfiguration(fontArrow, HtmlColorUtils.BLACK); @@ -128,18 +109,14 @@ public class Rose implements Skin { param.strictUmlStyle() == false); } if (type == ComponentType.PARTICIPANT_HEAD) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.participantBorder); - return new ComponentRoseParticipant(new BiColor(sequenceParticipantBackground, borderColor), getUFont2( - param, FontParam.PARTICIPANT), stringsToDisplay, param, deltaShadow, param.getRoundCorner(), - getStroke(param, LineParam.sequenceParticipantBorder, 1.5), newFontForStereotype, getFontColor( - param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, + FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype, + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.PARTICIPANT_TAIL) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.participantBorder); - return new ComponentRoseParticipant(new BiColor(sequenceParticipantBackground, borderColor), getUFont2( - param, FontParam.PARTICIPANT), stringsToDisplay, param, deltaShadow, param.getRoundCorner(), - getStroke(param, LineParam.sequenceParticipantBorder, 1.5), newFontForStereotype, getFontColor( - param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, + FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype, + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.PARTICIPANT_LINE) { final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); @@ -150,171 +127,170 @@ public class Rose implements Skin { return new ComponentRoseLine(borderColor, true, getStroke(param, LineParam.sequenceLifeLineBorder, 1.5)); } if (type == ComponentType.ACTOR_HEAD) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseActor(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, - FontParam.ACTOR), stringsToDisplay, true, param, deltaShadow, getStroke(param, - LineParam.sequenceActorBorder, 2), newFontForStereotype, getFontColor(param, + return new ComponentRoseActor(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.ACTOR_TAIL) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseActor(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, - FontParam.ACTOR), stringsToDisplay, false, param, deltaShadow, getStroke(param, - LineParam.sequenceActorBorder, 2), newFontForStereotype, getFontColor(param, + return new ComponentRoseActor(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.BOUNDARY_HEAD) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseBoundary(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, - FontParam.ACTOR), stringsToDisplay, true, param, deltaShadow, getStroke(param, - LineParam.sequenceActorBorder, 2), newFontForStereotype, getFontColor(param, + return new ComponentRoseBoundary(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.BOUNDARY_TAIL) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseBoundary(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, - FontParam.ACTOR), stringsToDisplay, false, param, deltaShadow, getStroke(param, - LineParam.sequenceActorBorder, 2), newFontForStereotype, getFontColor(param, + return new ComponentRoseBoundary(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.CONTROL_HEAD) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseControl(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, true, param, deltaShadow, getStroke(param, LineParam.sequenceActorBorder, 2), - newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseControl(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, + FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.CONTROL_TAIL) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseControl(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, false, param, deltaShadow, getStroke(param, LineParam.sequenceActorBorder, 2), - newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseControl(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, + FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.ENTITY_HEAD) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseEntity(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, true, param, deltaShadow, getStroke(param, LineParam.sequenceActorBorder, 2), - newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseEntity(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, + FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.ENTITY_TAIL) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseEntity(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, false, param, deltaShadow, getStroke(param, LineParam.sequenceActorBorder, 2), - newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseEntity(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, + FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.DATABASE_HEAD) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseDatabase(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, true, param, deltaShadow, getStroke(param, LineParam.sequenceActorBorder, 2), - newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseDatabase(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, + FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.DATABASE_TAIL) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.actorBorder); - return new ComponentRoseDatabase(new BiColor(sequenceActorBackground, borderColor), getUFont2(param, FontParam.ACTOR), - stringsToDisplay, false, param, deltaShadow, getStroke(param, LineParam.sequenceActorBorder, 2), - newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + return new ComponentRoseDatabase(getSymbolContext(param, ColorParam.actorBorder), getUFont2(param, + FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, + FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.NOTE) { - final HtmlColor noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground); - final HtmlColor borderColor = getHtmlColor(param, ColorParam.noteBorder); - final UFont fontNote = param.getFont(FontParam.NOTE, null, false); - return new ComponentRoseNote(new BiColor(noteBackgroundColor, borderColor), fontNote.toFont2( - getFontColor(param, FontParam.NOTE), useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, - paddingX, paddingY, param, deltaShadow, getStroke(param, LineParam.noteBorder, 1)); + return new ComponentRoseNote(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param, + FontParam.NOTE), stringsToDisplay, paddingX, paddingY, param); } if (type == ComponentType.NOTE_HEXAGONAL) { - final HtmlColor noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground); - final HtmlColor borderColor = getHtmlColor(param, ColorParam.noteBorder); - final UFont fontNote = param.getFont(FontParam.NOTE, null, false); - return new ComponentRoseNoteHexagonal(new BiColor(noteBackgroundColor, borderColor), fontNote.toFont2( - getFontColor(param, FontParam.NOTE), useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, - param, deltaShadow, getStroke(param, LineParam.noteBorder, 1)); + return new ComponentRoseNoteHexagonal(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param, + FontParam.NOTE), stringsToDisplay, param); } if (type == ComponentType.NOTE_BOX) { - final HtmlColor noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground); - final HtmlColor borderColor = getHtmlColor(param, ColorParam.noteBorder); - final UFont fontNote = param.getFont(FontParam.NOTE, null, false); - return new ComponentRoseNoteBox(new BiColor(noteBackgroundColor, borderColor), fontNote.toFont2( - getFontColor(param, FontParam.NOTE), useUnderlineForHyperlink, hyperlinkColor), stringsToDisplay, - param, deltaShadow, getStroke(param, LineParam.noteBorder, 1)); + return new ComponentRoseNoteBox(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param, + FontParam.NOTE), stringsToDisplay, param); } if (type == ComponentType.GROUPING_HEADER) { - return new ComponentRoseGroupingHeader(background, new BiColor(groupBackground, groupBorder), getUFont2(param, - FontParam.SEQUENCE_GROUP_HEADER), fontGrouping, stringsToDisplay, param, deltaShadow, getStroke( - param, LineParam.sequenceGroupBorder, 2)); + return new ComponentRoseGroupingHeader(param.getBackgroundColor(), getSymbolContext(param, + ColorParam.sequenceGroupBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER), fontGrouping, + stringsToDisplay, param); } if (type == ComponentType.GROUPING_ELSE) { - return new ComponentRoseGroupingElse(groupBorder, getUFont2(param, FontParam.SEQUENCE_GROUP), - stringsToDisplay.get(0), param, background, getStroke(param, LineParam.sequenceGroupBorder, 2)); + return new ComponentRoseGroupingElse(getHtmlColor(param, ColorParam.sequenceGroupBorder), getUFont2(param, + FontParam.SEQUENCE_GROUP), stringsToDisplay.get(0), param, param.getBackgroundColor()); } if (type == ComponentType.GROUPING_SPACE) { return new ComponentRoseGroupingSpace(7); } if (type == ComponentType.ALIVE_BOX_CLOSE_CLOSE) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseActiveLine(lifeLineBackgroundColor, borderColor, true, true, deltaShadow > 0); + return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), true, true); } if (type == ComponentType.ALIVE_BOX_CLOSE_OPEN) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseActiveLine(lifeLineBackgroundColor, borderColor, true, false, deltaShadow > 0); + return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), true, false); } if (type == ComponentType.ALIVE_BOX_OPEN_CLOSE) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseActiveLine(lifeLineBackgroundColor, borderColor, false, true, deltaShadow > 0); + return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), false, true); } if (type == ComponentType.ALIVE_BOX_OPEN_OPEN) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseActiveLine(lifeLineBackgroundColor, borderColor, false, false, deltaShadow > 0); + return new ComponentRoseActiveLine(getSymbolContext(param, ColorParam.sequenceLifeLineBorder), false, false); } if (type == ComponentType.DELAY_LINE) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseDelayLine(borderColor); + return new ComponentRoseDelayLine(getHtmlColor(param, ColorParam.sequenceLifeLineBorder)); } if (type == ComponentType.DELAY_TEXT) { - return new ComponentRoseDelayText(param.getFont(FontParam.SEQUENCE_DELAY, null, false).toFont2( - getFontColor(param, FontParam.SEQUENCE_DELAY), useUnderlineForHyperlink, hyperlinkColor), - stringsToDisplay, param); + return new ComponentRoseDelayText(getUFont2(param, FontParam.SEQUENCE_DELAY), stringsToDisplay, param); } if (type == ComponentType.DESTROY) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); - return new ComponentRoseDestroy(borderColor); + return new ComponentRoseDestroy(getHtmlColor(param, ColorParam.sequenceLifeLineBorder)); } if (type == ComponentType.NEWPAGE) { return new ComponentRoseNewpage(getFontColor(param, FontParam.SEQUENCE_GROUP)); } if (type == ComponentType.DIVIDER) { - return new ComponentRoseDivider(param.getFont(FontParam.SEQUENCE_DIVIDER, null, false).toFont2( - getFontColor(param, FontParam.SEQUENCE_DIVIDER), useUnderlineForHyperlink, hyperlinkColor), - sequenceDividerBackground, stringsToDisplay, param, deltaShadow > 0, getStroke(param, - LineParam.sequenceDividerBorder, 2)); + return new ComponentRoseDivider(getUFont2(param, FontParam.SEQUENCE_DIVIDER), getHtmlColor(param, + ColorParam.sequenceDividerBackground), stringsToDisplay, param, deltaShadow(param) > 0, getStroke( + param, LineParam.sequenceDividerBorder, 2)); } if (type == ComponentType.REFERENCE) { - final UFont fontGroupingHeader = param.getFont(FontParam.SEQUENCE_GROUP_HEADER, null, false); - return new ComponentRoseReference(getFontColor(param, FontParam.SEQUENCE_GROUP), getUFont2(param, - FontParam.SEQUENCE_REFERENCE), sequenceReferenceHeaderBackground, sequenceReferenceBorder, - sequenceReferenceBackground, fontGroupingHeader, stringsToDisplay, - param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param, deltaShadow, getStroke( - param, LineParam.sequenceReferenceBorder, 2)); + return new ComponentRoseReference(getUFont2(param, FontParam.SEQUENCE_REFERENCE), getSymbolContext(param, + ColorParam.sequenceReferenceBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER), + stringsToDisplay, param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param, + getHtmlColor(param, ColorParam.sequenceReferenceBackground)); } if (type == ComponentType.TITLE) { - return new ComponentRoseTitle(param.getFont(FontParam.SEQUENCE_TITLE, null, false).toFont2( - getFontColor(param, FontParam.SEQUENCE_TITLE), useUnderlineForHyperlink, hyperlinkColor), - stringsToDisplay, param); + return new ComponentRoseTitle(getUFont2(param, FontParam.SEQUENCE_TITLE), stringsToDisplay, param); } if (type == ComponentType.SIGNATURE) { - return new ComponentRoseTitle(fontGrouping.toFont2(HtmlColorUtils.BLACK, useUnderlineForHyperlink, - hyperlinkColor), Display.create("This skin was created ", "in April 2009."), param); + return new ComponentRoseTitle(fontGrouping.toFont2(HtmlColorUtils.BLACK, param.useUnderlineForHyperlink(), + param.getHyperlinkColor()), Display.create("This skin was created ", "in April 2009."), param); } if (type == ComponentType.ENGLOBER) { - final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceBoxBorder); - final HtmlColor backColor = getHtmlColor(param, ColorParam.sequenceBoxBackground); - return new ComponentRoseEnglober(backColor, borderColor, stringsToDisplay, param.getFont( - FontParam.SEQUENCE_BOX, null, false).toFont2(getFontColor(param, FontParam.SEQUENCE_BOX), - useUnderlineForHyperlink, hyperlinkColor), param); + return new ComponentRoseEnglober(getSymbolContext(param, ColorParam.sequenceBoxBorder), stringsToDisplay, + getUFont2(param, FontParam.SEQUENCE_BOX), param); } return null; } + private double deltaShadow(ISkinParam param) { + return param.shadowing() ? 4.0 : 0; + } + + private SymbolContext getSymbolContext(ISkinParam param, ColorParam color) { + if (color == ColorParam.participantBorder) { + return new SymbolContext(getHtmlColor(param, ColorParam.participantBackground), getHtmlColor(param, + ColorParam.participantBorder)).withStroke( + getStroke(param, LineParam.sequenceParticipantBorder, 1.5)).withDeltaShadow(deltaShadow(param)); + } + if (color == ColorParam.actorBorder) { + return new SymbolContext(getHtmlColor(param, ColorParam.actorBackground), getHtmlColor(param, + ColorParam.actorBorder)).withStroke(getStroke(param, LineParam.sequenceActorBorder, 2)) + .withDeltaShadow(deltaShadow(param)); + } + if (color == ColorParam.sequenceLifeLineBorder) { + return new SymbolContext(getHtmlColor(param, ColorParam.sequenceLifeLineBackground), getHtmlColor(param, + ColorParam.sequenceLifeLineBorder)).withDeltaShadow(deltaShadow(param)); + } + if (color == ColorParam.noteBorder) { + return new SymbolContext(getHtmlColor(param, ColorParam.noteBackground), getHtmlColor(param, + ColorParam.noteBorder)).withStroke(getStroke(param, LineParam.noteBorder, 1)).withDeltaShadow( + deltaShadow(param)); + } + if (color == ColorParam.sequenceGroupBorder) { + return new SymbolContext(getHtmlColor(param, ColorParam.sequenceGroupBackground), getHtmlColor(param, + ColorParam.sequenceGroupBorder)).withStroke(getStroke(param, LineParam.sequenceGroupBorder, 2)) + .withDeltaShadow(deltaShadow(param)); + } + if (color == ColorParam.sequenceBoxBorder) { + return new SymbolContext(getHtmlColor(param, ColorParam.sequenceBoxBackground), getHtmlColor(param, + ColorParam.sequenceBoxBorder)); + } + if (color == ColorParam.sequenceReferenceBorder) { + return new SymbolContext(getHtmlColor(param, ColorParam.sequenceReferenceHeaderBackground), getHtmlColor( + param, ColorParam.sequenceReferenceBorder)).withStroke( + getStroke(param, LineParam.sequenceReferenceBorder, 2)).withDeltaShadow(deltaShadow(param)); + } + throw new IllegalArgumentException(); + } + static public UStroke getStroke(ISkinParam param, LineParam lineParam, double defaultValue) { final UStroke result = param.getThickness(lineParam, null); if (result == null) { diff --git a/src/net/sourceforge/plantuml/svek/Boundary.java b/src/net/sourceforge/plantuml/svek/Boundary.java index 8b90a8e98..0311862f0 100644 --- a/src/net/sourceforge/plantuml/svek/Boundary.java +++ b/src/net/sourceforge/plantuml/svek/Boundary.java @@ -38,12 +38,12 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -54,17 +54,11 @@ public class Boundary implements TextBlock { private final double radius = 12; private final double left = 17; - private final HtmlColor backgroundColor; - private final HtmlColor foregroundColor; - private final double thickness; + + private final SymbolContext symbolContext; - private final double deltaShadow; - - public Boundary(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow, double thickness) { - this.backgroundColor = backgroundColor; - this.foregroundColor = foregroundColor; - this.deltaShadow = deltaShadow; - this.thickness = thickness; + public Boundary(SymbolContext symbolContext) { + this.symbolContext = symbolContext; } public void drawU(UGraphic ug) { @@ -72,22 +66,21 @@ public class Boundary implements TextBlock { double y = 0; x += margin; y += margin; - ug = ug.apply(new UStroke(thickness)).apply(new UChangeBackColor(backgroundColor)) - .apply(new UChangeColor(foregroundColor)); + ug = symbolContext.apply(ug); final UEllipse circle = new UEllipse(radius * 2, radius * 2); - circle.setDeltaShadow(deltaShadow); + circle.setDeltaShadow(symbolContext.getDeltaShadow()); final UPath path1 = new UPath(); path1.moveTo(0, 0); path1.lineTo(0, radius * 2); - path1.setDeltaShadow(deltaShadow); + path1.setDeltaShadow(symbolContext.getDeltaShadow()); final UPath path = new UPath(); path.moveTo(0, 0); path.lineTo(0, radius * 2); path.moveTo(0, radius); path.lineTo(left, radius); - path.setDeltaShadow(deltaShadow); + path.setDeltaShadow(symbolContext.getDeltaShadow()); ug.apply(new UTranslate(x, y)).draw(path); // final ULine line1 = new ULine(0, radius * 2); diff --git a/src/net/sourceforge/plantuml/svek/Control.java b/src/net/sourceforge/plantuml/svek/Control.java index 638ff1de8..cafd347e8 100644 --- a/src/net/sourceforge/plantuml/svek/Control.java +++ b/src/net/sourceforge/plantuml/svek/Control.java @@ -38,6 +38,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -52,17 +53,10 @@ public class Control implements TextBlock { private final double margin = 4; private final double radius = 12; - private final HtmlColor backgroundColor; - private final HtmlColor foregroundColor; - private final double thickness; + private final SymbolContext symbolContext; - private final double deltaShadow; - - public Control(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow, double thickness) { - this.backgroundColor = backgroundColor; - this.foregroundColor = foregroundColor; - this.deltaShadow = deltaShadow; - this.thickness = thickness; + public Control(SymbolContext symbolContext) { + this.symbolContext = symbolContext; } public void drawU(UGraphic ug) { @@ -70,14 +64,13 @@ public class Control implements TextBlock { double y = 0; x += margin; y += margin; - ug = ug.apply(new UStroke(thickness)); - ug = ug.apply(new UChangeBackColor(backgroundColor)).apply(new UChangeColor(foregroundColor)); + ug = symbolContext.apply(ug); final UEllipse circle = new UEllipse(radius * 2, radius * 2); - circle.setDeltaShadow(deltaShadow); + circle.setDeltaShadow(symbolContext.getDeltaShadow()); ug.apply(new UTranslate(x, y)).draw(circle); ug = ug.apply(new UStroke()); - ug = ug.apply(new UChangeBackColor(foregroundColor)); + ug = ug.apply(new UChangeBackColor(symbolContext.getForeColor())); final UPolygon polygon = new UPolygon(); polygon.addPoint(0, 0); final int xAile = 6; diff --git a/src/net/sourceforge/plantuml/svek/EntityDomain.java b/src/net/sourceforge/plantuml/svek/EntityDomain.java index 9db304be9..4187e35a0 100644 --- a/src/net/sourceforge/plantuml/svek/EntityDomain.java +++ b/src/net/sourceforge/plantuml/svek/EntityDomain.java @@ -36,15 +36,12 @@ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.ugraphic.UChangeBackColor; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class EntityDomain implements TextBlock { @@ -53,17 +50,10 @@ public class EntityDomain implements TextBlock { private final double radius = 12; private final double suppY = 2; - private final HtmlColor backgroundColor; - private final HtmlColor foregroundColor; - private final double thickness; + private final SymbolContext symbolContext; - private final double deltaShadow; - - public EntityDomain(HtmlColor backgroundColor, HtmlColor foregroundColor, double deltaShadow, double thickness) { - this.backgroundColor = backgroundColor; - this.foregroundColor = foregroundColor; - this.deltaShadow = deltaShadow; - this.thickness = thickness; + public EntityDomain(SymbolContext symbolContext) { + this.symbolContext = symbolContext; } public void drawU(UGraphic ug) { @@ -71,10 +61,9 @@ public class EntityDomain implements TextBlock { double y = 0; x += margin; y += margin; - ug = ug.apply(new UStroke(thickness)).apply(new UChangeBackColor(backgroundColor)) - .apply(new UChangeColor(foregroundColor)); + ug = symbolContext.apply(ug); final UEllipse circle = new UEllipse(radius * 2, radius * 2); - circle.setDeltaShadow(deltaShadow); + circle.setDeltaShadow(symbolContext.getDeltaShadow()); ug.apply(new UTranslate(x, y)).draw(circle); ug.apply(new UTranslate(x, y + 2 * radius + suppY)).draw(new ULine(2 * radius, 0)); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageComponent.java b/src/net/sourceforge/plantuml/svek/image/EntityImageComponent.java index c0f178122..4abb16d30 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageComponent.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageComponent.java @@ -86,7 +86,7 @@ public class EntityImageComponent extends AbstractEntityImage { // backcolor = HtmlColorUtils.BLUE; final HtmlColor forecolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBorder(), getStereo()); final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow( - getSkinParam().shadowing()); + getSkinParam().shadowing2(symbol.getSkinParameter())); TextBlock stereo = TextBlockUtils.empty(0, 0); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java index 6519de4df..7e8457de0 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graph2.GeomUtils; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; @@ -106,8 +107,9 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { if (strings.size() == 1 && strings.get(0).length() == 0) { textBlock = new TextBlockEmpty(); } else { - textBlock = new BodyEnhanced2(strings, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, fontNote, - fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); + textBlock = new BodyEnhanced2(strings, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, + new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), + skinParam.useUnderlineForHyperlink())); } } diff --git a/src/net/sourceforge/plantuml/tikz/TikzGraphics.java b/src/net/sourceforge/plantuml/tikz/TikzGraphics.java index 0c1f9e147..8b31390dd 100644 --- a/src/net/sourceforge/plantuml/tikz/TikzGraphics.java +++ b/src/net/sourceforge/plantuml/tikz/TikzGraphics.java @@ -83,7 +83,7 @@ public class TikzGraphics { out(os, "\\usepackage{aeguill}"); // out(os, "\\usetikzlibrary{trees}"); out(os, "\\begin{document}"); - out(os, "% generated by Plantuml " + Version.versionString()); + out(os, "% generated by Plantuml " + Version.versionString(10)); for (Map.Entry ent : colornames.entrySet()) { out(os, definecolor(ent.getValue(), ent.getKey())); diff --git a/src/net/sourceforge/plantuml/ugraphic/UFont.java b/src/net/sourceforge/plantuml/ugraphic/UFont.java index bbbca457a..44db6ace2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UFont.java +++ b/src/net/sourceforge/plantuml/ugraphic/UFont.java @@ -39,6 +39,7 @@ import java.awt.Graphics2D; import java.awt.font.FontRenderContext; import java.awt.font.LineMetrics; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -60,8 +61,8 @@ public class UFont { return font; } - public UFont2 toFont2(HtmlColor color, boolean useUnderlineForHyperlink, HtmlColor hyperlinkColor) { - return new UFont2(this, color, useUnderlineForHyperlink, hyperlinkColor); + public FontConfiguration toFont2(HtmlColor color, boolean useUnderlineForHyperlink, HtmlColor hyperlinkColor) { + return new FontConfiguration(this, color, hyperlinkColor, useUnderlineForHyperlink); } public UFont scaled(double scale) { diff --git a/src/net/sourceforge/plantuml/ugraphic/UFont2.java b/src/net/sourceforge/plantuml/ugraphic/UFont2.java deleted file mode 100644 index 336ffcc6b..000000000 --- a/src/net/sourceforge/plantuml/ugraphic/UFont2.java +++ /dev/null @@ -1,69 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2014, Arnaud Roques - * - * Project Info: http://plantuml.sourceforge.net - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * [Java is a trademark or registered trademark of Sun Microsystems, Inc. - * in the United States and other countries.] - * - * Original Author: Arnaud Roques - * - * Revision $Revision: 3837 $ - * - */ -package net.sourceforge.plantuml.ugraphic; - -import net.sourceforge.plantuml.graphic.HtmlColor; - -public class UFont2 { - - private final UFont font; - - private final HtmlColor color; - private final HtmlColor hyperlinkColor; - private final boolean useUnderlineForHyperlink; - - public UFont2(UFont font, HtmlColor color, boolean useUnderlineForHyperlink, HtmlColor hyperlinkColor) { - this.font = font; - this.color = color; - this.hyperlinkColor = hyperlinkColor; - this.useUnderlineForHyperlink = useUnderlineForHyperlink; - } - - public final UFont getFont() { - return font; - } - - public boolean useUnderlineForHyperlink() { - return useUnderlineForHyperlink; - } - - public HtmlColor getHyperlinkColor() { - return hyperlinkColor; - } - - public HtmlColor getColor() { - return color; - } - -} diff --git a/src/net/sourceforge/plantuml/utils/MathUtils.java b/src/net/sourceforge/plantuml/utils/MathUtils.java index 2cd9f9a4e..418a1e3c5 100644 --- a/src/net/sourceforge/plantuml/utils/MathUtils.java +++ b/src/net/sourceforge/plantuml/utils/MathUtils.java @@ -43,6 +43,10 @@ public class MathUtils { return Math.max(Math.max(a, b), c); } + public static double max(double a, double b, double c, double d) { + return Math.max(Math.max(a, b), Math.max(c, d)); + } + public static double limitation(double v, double min, double max) { if (min >= max) { // assert false : "min="+min+" max="+max+" v="+v; diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index fdaea3116..64c245af9 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15915 $ + * Revision $Revision: 16013 $ * */ package net.sourceforge.plantuml.version; @@ -38,7 +38,7 @@ import java.util.Date; public class Version { public static int version() { - return 8023; + return 8024; } public static String versionString() { @@ -48,13 +48,21 @@ public class Version { return "" + version(); } + public static String versionString(int size) { + final StringBuilder sb = new StringBuilder(versionString()); + while (sb.length() < size) { + sb.append(' '); + } + return sb.toString(); + } + private static int beta() { final int beta = 0; return beta; } private static long compileTime() { - return 1429551104146L; + return 1430665511202L; } public static String compileTimeString() {