From 902ab3e9089a4502c5e2c79bfb99981bc881d277 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Mon, 28 Sep 2015 22:42:17 +0200 Subject: [PATCH] version 8031 --- src/net/sourceforge/plantuml/BlockUml.java | 4 + .../sourceforge/plantuml/BlockUmlBuilder.java | 8 +- src/net/sourceforge/plantuml/ColorParam.java | 163 ++++++++------- src/net/sourceforge/plantuml/DirWatcher.java | 6 +- src/net/sourceforge/plantuml/DirWatcher2.java | 4 +- .../plantuml/FileFormatOption.java | 8 +- src/net/sourceforge/plantuml/FontParam.java | 11 +- .../sourceforge/plantuml/GeneratedImage.java | 56 +---- .../plantuml/GeneratedImageImpl.java | 92 +++++++++ src/net/sourceforge/plantuml/ISkinParam.java | 7 +- src/net/sourceforge/plantuml/ISkinSimple.java | 1 + .../plantuml/ISourceFileReader.java | 3 + .../plantuml/LineConfigurable.java | 10 +- src/net/sourceforge/plantuml/SkinParam.java | 28 ++- .../sourceforge/plantuml/SkinParamColors.java | 76 +++++++ .../plantuml/SkinParamDelegator.java | 10 +- .../plantuml/SkinParamForceColor.java | 1 - .../sourceforge/plantuml/SkinParamUtils.java | 2 +- .../plantuml/SourceFileReader.java | 7 +- .../plantuml/SourceFileReader2.java | 5 +- .../plantuml/SpecificBackcolorable.java | 8 +- .../plantuml/SpriteContainerEmpty.java | 4 + .../command/CommandLinkActivity.java | 6 +- .../command/CommandLinkLongActivity.java | 5 +- .../command/CommandPartition.java | 8 +- .../activitydiagram3/ActivityDiagram3.java | 24 ++- .../plantuml/activitydiagram3/Branch.java | 1 - .../activitydiagram3/InstructionIf.java | 16 +- .../activitydiagram3/InstructionSimple.java | 14 +- .../activitydiagram3/InstructionWhile.java | 1 - .../command/CommandActivity3.java | 13 +- .../command/CommandActivityLegacy1.java | 3 +- .../command/CommandActivityLong3.java | 14 +- .../ftile/EntityImageLegend.java | 8 +- .../activitydiagram3/ftile/FtileFactory.java | 9 +- .../ftile/FtileFactoryDelegator.java | 25 +-- .../activitydiagram3/ftile/Swimlane.java | 20 +- .../activitydiagram3/ftile/Swimlanes.java | 24 ++- .../ftile/vcompact/FloatingNote.java | 12 +- .../vcompact/FtileFactoryDelegatorIf.java | 27 +-- .../vcompact/FtileFactoryDelegatorRepeat.java | 15 +- .../vcompact/FtileFactoryDelegatorWhile.java | 13 +- .../ftile/vcompact/FtileGroup.java | 2 +- .../ftile/vcompact/FtileIfAndStop.java | 20 +- .../ftile/vcompact/FtileIfLong2.java | 28 ++- .../ftile/vcompact/FtileIfLongUnused.java | 6 +- .../ftile/vcompact/FtileIfOrigin.java | 35 ++-- .../ftile/vcompact/FtileRepeat.java | 22 +- .../ftile/vcompact/FtileWhile.java | 25 +-- .../ftile/vcompact/FtileWithNoteOpale.java | 11 +- .../ftile/vcompact/VCompactFactory.java | 17 +- .../vcompact/cond/ConditionalBuilder.java | 48 ++--- .../ftile/vcompact/cond/FtileIfWithLinks.java | 4 +- .../ftile/vertical/FtileBox.java | 25 ++- .../command/CommandCreateClass.java | 33 ++- .../command/CommandCreateClassMultilines.java | 52 +++-- .../command/CommandCreateElementFull2.java | 3 +- .../command/CommandLinkClass.java | 58 ++++-- .../plantuml/command/CommandNamespace.java | 3 +- .../plantuml/command/CommandPackage.java | 19 +- .../plantuml/command/CommandPackageEmpty.java | 5 +- .../note/FactoryNoteActivityCommand.java | 3 +- .../command/note/FactoryNoteCommand.java | 3 +- .../note/FactoryNoteOnEntityCommand.java | 17 +- .../note/FactoryNoteOnLinkCommand.java | 14 +- .../sequence/FactorySequenceNoteCommand.java | 3 +- ...FactorySequenceNoteOverSeveralCommand.java | 3 +- .../plantuml/command/regex/RegexLeaf.java | 5 + .../sourceforge/plantuml/creole/AtomImg.java | 29 ++- .../sourceforge/plantuml/creole/AtomText.java | 10 +- .../plantuml/creole/PSystemCreole.java | 7 +- .../plantuml/cucadiagram/BodyEnhanced.java | 6 +- .../plantuml/cucadiagram/GroupRoot.java | 52 ++--- .../plantuml/cucadiagram/IEntity.java | 4 + .../plantuml/cucadiagram/Link.java | 38 ++-- .../plantuml/cucadiagram/LinkStyle.java | 17 ++ .../cucadiagram/MethodsOrFieldsArea.java | 8 +- .../cucadiagram/entity/EntityImpl.java | 63 +++--- .../command/CommandCreateElementFull.java | 20 +- .../CommandCreateElementMultilines.java | 3 +- .../command/CommandLinkElement.java | 54 +++-- .../command/CommandPackageWithUSymbol.java | 3 +- .../plantuml/donors/PSystemDonors.java | 2 +- .../plantuml/flowdiagram/ActivityBox.java | 7 +- src/net/sourceforge/plantuml/golem/Tile.java | 3 +- .../sourceforge/plantuml/graph/Elastane.java | 6 +- .../plantuml/graph/EntityImageActivity.java | 8 +- .../graph/EntityImageCircleInterface.java | 8 +- .../plantuml/graph/EntityImageDefault.java | 10 +- .../plantuml/graph/EntityImageNote.java | 10 +- .../plantuml/graph/EntityImageUsecase.java | 12 +- .../plantuml/graph/MethodsOrFieldsArea.java | 5 +- .../plantuml/graphic/DateEventUtils.java | 5 +- .../plantuml/graphic/FontConfiguration.java | 69 +++++-- .../plantuml/graphic/GraphicStrings.java | 12 +- .../plantuml/graphic/HtmlColorSetSimple.java | 6 + .../plantuml/graphic/USymbolComponent2.java | 15 +- .../plantuml/graphic/color/ColorParser.java | 49 ++++- .../plantuml/graphic/color/ColorType.java | 47 +++++ .../plantuml/graphic/color/Colors.java | 189 +++++++++++++++++ .../plantuml/jungle/GTileNode.java | 6 +- .../plantuml/logo/TurtleGraphicsPane.java | 8 +- .../command/CommandCreateEntityObject.java | 3 +- .../CommandCreateEntityObjectMultilines.java | 3 +- .../sourceforge/plantuml/png/PngTitler.java | 5 +- .../sourceforge/plantuml/posimo/Frame.java | 7 +- .../plantuml/posimo/LabelImage.java | 12 +- .../sourceforge/plantuml/postit/PostIt.java | 6 +- .../sourceforge/plantuml/preproc/Defines.java | 4 +- .../plantuml/preproc/FileWithSuffix.java | 81 ++++++++ .../plantuml/preproc/Preprocessor.java | 4 +- .../plantuml/preproc/PreprocessorInclude.java | 19 +- .../plantuml/printskin/PrintSkin.java | 6 +- .../plantuml/project/graphic/ItemHeader.java | 6 +- .../plantuml/project/graphic/TimeScale.java | 12 +- .../plantuml/project2/GanttDiagram2.java | 5 +- .../plantuml/project2/TimeHeaderDay.java | 6 +- .../plantuml/project2/TimeHeaderMonth.java | 8 +- .../sourceforge/plantuml/salt/Dictionary.java | 4 + .../salt/element/AbstractElementText.java | 4 +- .../salt/element/ElementMenuEntry.java | 4 +- .../salt/element/ElementRadioCheckbox.java | 4 +- .../plantuml/salt/element/ElementText.java | 4 +- .../plantuml/sequencediagram/Note.java | 24 ++- .../plantuml/sequencediagram/Notes.java | 4 + .../plantuml/sequencediagram/Participant.java | 25 ++- .../sequencediagram/SequenceDiagram.java | 13 ++ .../command/CommandParticipant.java | 3 +- .../teoz/CommunicationTile.java | 13 +- .../teoz/CommunicationTileSelf.java | 2 +- .../sequencediagram/teoz/DividerTile.java | 1 - .../sequencediagram/teoz/EmptyTile.java | 92 +++++++++ .../sequencediagram/teoz/EventsHistory.java | 5 +- .../sequencediagram/teoz/GroupingTile.java | 9 +- .../sequencediagram/teoz/LiveBoxes.java | 4 +- .../sequencediagram/teoz/LivingSpace.java | 4 +- .../sequencediagram/teoz/LivingSpaces.java | 13 ++ .../sequencediagram/teoz/MainTile.java | 2 + .../sequencediagram/teoz/NotesTile.java | 192 ++++++++++++++++++ .../teoz/SequenceDiagramFileMakerTeoz.java | 8 +- .../sequencediagram/teoz/TileBuilder.java | 60 +++--- .../sequencediagram/teoz/TileUtils.java | 2 +- .../plantuml/skin/GrayComponent.java | 6 +- .../plantuml/skin/bluemodern/BlueModern.java | 45 ++-- .../ComponentBlueModernGroupingHeader.java | 13 +- .../rose/ComponentRoseGroupingHeader.java | 14 +- .../sourceforge/plantuml/skin/rose/Rose.java | 13 +- .../command/CommandCreatePackageState.java | 29 ++- .../command/CommandCreateState.java | 32 ++- .../command/CommandLinkState.java | 7 +- .../plantuml/sudoku/GraphicsSudoku.java | 11 +- .../plantuml/svek/AbstractEntityImage.java | 1 + .../sourceforge/plantuml/svek/Cluster.java | 21 +- .../svek/CucaDiagramFileMakerSvek.java | 18 +- .../svek/CucaDiagramFileMakerSvek2.java | 32 +-- .../plantuml/svek/DotStringFactory.java | 6 +- .../plantuml/svek/GroupPngMakerActivity.java | 5 +- .../plantuml/svek/GroupPngMakerState.java | 15 +- src/net/sourceforge/plantuml/svek/Line.java | 74 ++++--- src/net/sourceforge/plantuml/svek/Shape.java | 24 ++- .../sourceforge/plantuml/svek/ShapeType.java | 2 +- .../svek/image/EntityImageActivity.java | 8 +- .../svek/image/EntityImageArcCircle.java | 11 +- .../plantuml/svek/image/EntityImageClass.java | 21 +- .../svek/image/EntityImageClassHeader2.java | 16 +- .../svek/image/EntityImageDescription.java | 30 ++- .../svek/image/EntityImageEmptyPackage.java | 7 +- .../image/EntityImageLollipopInterface.java | 6 +- .../EntityImageLollipopInterfaceEye1.java | 6 +- .../EntityImageLollipopInterfaceEye2.java | 9 +- .../plantuml/svek/image/EntityImageNote.java | 55 +++-- .../svek/image/EntityImageNoteLink.java | 6 +- .../svek/image/EntityImageObject.java | 21 +- .../svek/image/EntityImagePseudoState.java | 6 +- .../plantuml/svek/image/EntityImageState.java | 17 +- .../svek/image/EntityImageState2.java | 3 +- .../svek/image/EntityImageStateBorder.java | 8 +- .../EntityImageStateEmptyDescription.java | 9 +- .../plantuml/svek/image/EntityImageTips.java | 16 +- .../svek/image/EntityImageUseCase.java | 9 +- .../plantuml/ugraphic/FontChecker.java | 6 +- .../sourceforge/plantuml/ugraphic/UFont.java | 5 +- .../sourceforge/plantuml/version/Version.java | 6 +- 183 files changed, 2292 insertions(+), 1067 deletions(-) create mode 100644 src/net/sourceforge/plantuml/GeneratedImageImpl.java create mode 100644 src/net/sourceforge/plantuml/SkinParamColors.java create mode 100644 src/net/sourceforge/plantuml/graphic/color/ColorType.java create mode 100644 src/net/sourceforge/plantuml/graphic/color/Colors.java create mode 100644 src/net/sourceforge/plantuml/preproc/FileWithSuffix.java create mode 100644 src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java create mode 100644 src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java diff --git a/src/net/sourceforge/plantuml/BlockUml.java b/src/net/sourceforge/plantuml/BlockUml.java index ff44dd8c5..5dfd4ed9d 100644 --- a/src/net/sourceforge/plantuml/BlockUml.java +++ b/src/net/sourceforge/plantuml/BlockUml.java @@ -124,4 +124,8 @@ public class BlockUml { return startLine; } + public final List getData() { + return data; + } + } diff --git a/src/net/sourceforge/plantuml/BlockUmlBuilder.java b/src/net/sourceforge/plantuml/BlockUmlBuilder.java index 6eee62dce..cee82d2ab 100644 --- a/src/net/sourceforge/plantuml/BlockUmlBuilder.java +++ b/src/net/sourceforge/plantuml/BlockUmlBuilder.java @@ -44,6 +44,7 @@ import java.util.List; import java.util.Set; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.Preprocessor; import net.sourceforge.plantuml.preproc.ReadLineReader; import net.sourceforge.plantuml.preproc.UncommentReadLine; @@ -52,7 +53,7 @@ import net.sourceforge.plantuml.utils.StartUtils; final public class BlockUmlBuilder { private final List blocks = new ArrayList(); - private Set usedFiles = new HashSet(); + private Set usedFiles = new HashSet(); private final UncommentReadLine reader2; public BlockUmlBuilder(List config, String charset, Defines defines, Reader reader, File newCurrentDir, @@ -70,8 +71,7 @@ final public class BlockUmlBuilder { } } - public BlockUmlBuilder(List config, String charset, Defines defines, Reader reader) - throws IOException { + public BlockUmlBuilder(List config, String charset, Defines defines, Reader reader) throws IOException { this(config, charset, defines, reader, null, null); } @@ -124,7 +124,7 @@ final public class BlockUmlBuilder { return Collections.unmodifiableList(blocks); } - public final Set getIncludedFiles() { + public final Set getIncludedFiles() { return Collections.unmodifiableSet(usedFiles); } diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java index bd760ba3f..36c1ad867 100644 --- a/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/net/sourceforge/plantuml/ColorParam.java @@ -28,110 +28,111 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16778 $ + * Revision $Revision: 17054 $ * */ package net.sourceforge.plantuml; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; public enum ColorParam { - background(HtmlColorUtils.WHITE), + background(HtmlColorUtils.WHITE, ColorType.BACK), hyperlink(HtmlColorUtils.BLUE), - activityBackground(HtmlColorUtils.MY_YELLOW), - activityBorder(HtmlColorUtils.MY_RED), + activityBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + activityBorder(HtmlColorUtils.MY_RED, ColorType.LINE), activityStart(HtmlColorUtils.BLACK), activityEnd(HtmlColorUtils.BLACK), activityBar(HtmlColorUtils.BLACK), - activityArrow(HtmlColorUtils.MY_RED), + activityArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), - usecaseBorder(HtmlColorUtils.MY_RED), - usecaseBackground(HtmlColorUtils.MY_YELLOW), - usecaseArrow(HtmlColorUtils.MY_RED), + usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + usecaseBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + usecaseArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), - objectBackground(HtmlColorUtils.MY_YELLOW), - objectBorder(HtmlColorUtils.MY_RED), - objectArrow(HtmlColorUtils.MY_RED), + objectBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + objectBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + objectArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), - classHeaderBackground(null), - classBackground(HtmlColorUtils.MY_YELLOW), - classBorder(HtmlColorUtils.MY_RED), + classHeaderBackground(null, ColorType.BACK), + classBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + classBorder(HtmlColorUtils.MY_RED, ColorType.LINE), stereotypeCBackground(HtmlColorUtils.COL_ADD1B2), stereotypeABackground(HtmlColorUtils.COL_A9DCDF), stereotypeIBackground(HtmlColorUtils.COL_B4A7E5), stereotypeEBackground(HtmlColorUtils.COL_EB937F), - classArrow(HtmlColorUtils.MY_RED), + classArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), - packageBackground(HtmlColorUtils.MY_YELLOW), - packageBorder(HtmlColorUtils.BLACK), + packageBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + packageBorder(HtmlColorUtils.BLACK, ColorType.LINE), - partitionBackground(HtmlColorUtils.MY_YELLOW), - partitionBorder(HtmlColorUtils.BLACK), + partitionBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + partitionBorder(HtmlColorUtils.BLACK, ColorType.LINE), - componentBackground(HtmlColorUtils.MY_YELLOW), - componentBorder(HtmlColorUtils.MY_RED), - interfaceBackground(HtmlColorUtils.MY_YELLOW), - interfaceBorder(HtmlColorUtils.MY_RED), - // componentArrow, + componentBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + componentBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + interfaceBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + interfaceBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + componentArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), - stateBackground(HtmlColorUtils.MY_YELLOW), - stateBorder(HtmlColorUtils.MY_RED), - stateArrow(HtmlColorUtils.MY_RED), + stateBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + stateBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + stateArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), stateStart(HtmlColorUtils.BLACK), stateEnd(HtmlColorUtils.BLACK), - noteBackground(HtmlColorUtils.COL_FBFB77, true), - noteBorder(HtmlColorUtils.MY_RED), + noteBackground(HtmlColorUtils.COL_FBFB77, true, ColorType.BACK), + noteBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - legendBackground(HtmlColorUtils.COL_DDDDDD, true), - legendBorder(HtmlColorUtils.BLACK), + legendBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK), + legendBorder(HtmlColorUtils.BLACK, ColorType.LINE), - actorBackground(HtmlColorUtils.MY_YELLOW, true), - actorBorder(HtmlColorUtils.MY_RED), - participantBackground(HtmlColorUtils.MY_YELLOW, true), - participantBorder(HtmlColorUtils.MY_RED), - sequenceGroupBorder(HtmlColorUtils.BLACK), - sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true), - sequenceReferenceBorder(HtmlColorUtils.BLACK), - sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true), - sequenceReferenceBackground(HtmlColorUtils.WHITE, true), - sequenceDividerBackground(HtmlColorUtils.COL_EEEEEE, true), - sequenceDividerBorder(HtmlColorUtils.BLACK), - sequenceLifeLineBackground(HtmlColorUtils.WHITE, true), - sequenceLifeLineBorder(HtmlColorUtils.MY_RED), + actorBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), + actorBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + participantBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), + participantBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + sequenceGroupBorder(HtmlColorUtils.BLACK, ColorType.LINE), + sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceReferenceBorder(HtmlColorUtils.BLACK, ColorType.LINE), + sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceReferenceBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), + sequenceDividerBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceDividerBorder(HtmlColorUtils.BLACK, ColorType.LINE), + sequenceLifeLineBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), + sequenceLifeLineBorder(HtmlColorUtils.MY_RED, ColorType.LINE), sequenceArrow(HtmlColorUtils.MY_RED), - sequenceBoxBorder(HtmlColorUtils.MY_RED), - sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true), + sequenceBoxBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK), - artifactBackground(HtmlColorUtils.MY_YELLOW), - artifactBorder(HtmlColorUtils.BLACK), - cloudBackground(HtmlColorUtils.MY_YELLOW), - cloudBorder(HtmlColorUtils.BLACK), - queueBackground(HtmlColorUtils.MY_YELLOW), - queueBorder(HtmlColorUtils.MY_RED), - databaseBackground(HtmlColorUtils.MY_YELLOW), - databaseBorder(HtmlColorUtils.BLACK), - folderBackground(HtmlColorUtils.MY_YELLOW), - folderBorder(HtmlColorUtils.BLACK), - frameBackground(HtmlColorUtils.MY_YELLOW), - frameBorder(HtmlColorUtils.BLACK), - nodeBackground(HtmlColorUtils.MY_YELLOW), - nodeBorder(HtmlColorUtils.BLACK), - rectangleBackground(HtmlColorUtils.MY_YELLOW), - rectangleBorder(HtmlColorUtils.BLACK), - agentBackground(HtmlColorUtils.MY_YELLOW), - agentBorder(HtmlColorUtils.MY_RED), - storageBackground(HtmlColorUtils.MY_YELLOW), - storageBorder(HtmlColorUtils.BLACK), - boundaryBackground(HtmlColorUtils.MY_YELLOW), - boundaryBorder(HtmlColorUtils.MY_RED), - controlBackground(HtmlColorUtils.MY_YELLOW), - controlBorder(HtmlColorUtils.MY_RED), - entityBackground(HtmlColorUtils.MY_YELLOW), - entityBorder(HtmlColorUtils.MY_RED), + artifactBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + artifactBorder(HtmlColorUtils.BLACK, ColorType.LINE), + cloudBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + cloudBorder(HtmlColorUtils.BLACK, ColorType.LINE), + queueBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + queueBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + databaseBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + databaseBorder(HtmlColorUtils.BLACK, ColorType.LINE), + folderBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + folderBorder(HtmlColorUtils.BLACK, ColorType.LINE), + frameBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + frameBorder(HtmlColorUtils.BLACK, ColorType.LINE), + nodeBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + nodeBorder(HtmlColorUtils.BLACK, ColorType.LINE), + rectangleBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + rectangleBorder(HtmlColorUtils.BLACK, ColorType.LINE), + agentBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + agentBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + storageBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + storageBorder(HtmlColorUtils.BLACK, ColorType.LINE), + boundaryBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + boundaryBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + controlBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + controlBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + entityBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + entityBorder(HtmlColorUtils.MY_RED, ColorType.LINE), iconPrivate(HtmlColorUtils.COL_C82930), @@ -145,22 +146,28 @@ public enum ColorParam { private final boolean isBackground; private final HtmlColor defaultValue; + private final ColorType colorType; + + private ColorParam(HtmlColor defaultValue, ColorType colorType) { + this(defaultValue, false, colorType); + } private ColorParam(HtmlColor defaultValue) { - this(defaultValue, false); + this(defaultValue, false, null); } private ColorParam() { - this(null, false); + this(null, false, null); } private ColorParam(boolean isBackground) { - this(null, isBackground); + this(null, isBackground, null); } - private ColorParam(HtmlColor defaultValue, boolean isBackground) { + private ColorParam(HtmlColor defaultValue, boolean isBackground, ColorType colorType) { this.isBackground = isBackground; this.defaultValue = defaultValue; + this.colorType = colorType; } protected boolean isBackground() { @@ -170,4 +177,8 @@ public enum ColorParam { public final HtmlColor getDefaultValue() { return defaultValue; } + + public ColorType getColorType() { + return colorType; + } } diff --git a/src/net/sourceforge/plantuml/DirWatcher.java b/src/net/sourceforge/plantuml/DirWatcher.java index 4411dc7ee..97188219a 100644 --- a/src/net/sourceforge/plantuml/DirWatcher.java +++ b/src/net/sourceforge/plantuml/DirWatcher.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12866 $ + * Revision $Revision: 17341 $ * */ package net.sourceforge.plantuml; @@ -38,12 +38,12 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; @Deprecated public class DirWatcher { @@ -78,7 +78,7 @@ public class DirWatcher { if (watcher == null || watcher.hasChanged()) { final SourceFileReader sourceFileReader = new SourceFileReader(new Defines(), f, option.getOutputDir(), option.getConfig(), option.getCharset(), option.getFileFormatOption()); - final Set files = new HashSet(sourceFileReader.getIncludedFiles()); + final Set files = FileWithSuffix.convert(sourceFileReader.getIncludedFiles()); files.add(f); for (GeneratedImage g : sourceFileReader.getGeneratedImages()) { result.add(g); diff --git a/src/net/sourceforge/plantuml/DirWatcher2.java b/src/net/sourceforge/plantuml/DirWatcher2.java index 087c5d48c..c13773c4e 100644 --- a/src/net/sourceforge/plantuml/DirWatcher2.java +++ b/src/net/sourceforge/plantuml/DirWatcher2.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml; import java.io.File; import java.io.IOException; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -49,6 +48,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; public class DirWatcher2 { @@ -90,7 +90,7 @@ public class DirWatcher2 { try { final List generatedImages = sourceFileReader .getGeneratedImages(); - final Set files = new HashSet(sourceFileReader.getIncludedFiles()); + final Set files = FileWithSuffix.convert(sourceFileReader.getIncludedFiles()); files.add(f); modifieds.put(f, new FileWatcher(files)); return Collections.unmodifiableList(generatedImages); diff --git a/src/net/sourceforge/plantuml/FileFormatOption.java b/src/net/sourceforge/plantuml/FileFormatOption.java index a645a8903..1f676e1bf 100644 --- a/src/net/sourceforge/plantuml/FileFormatOption.java +++ b/src/net/sourceforge/plantuml/FileFormatOption.java @@ -38,6 +38,7 @@ import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; +import java.io.Serializable; import net.sourceforge.plantuml.eps.EpsStrategy; import net.sourceforge.plantuml.graphic.HtmlColor; @@ -64,7 +65,7 @@ import net.sourceforge.plantuml.StringUtils; * @author Arnaud Roques * */ -public class FileFormatOption { +public class FileFormatOption implements Serializable { private final FileFormat fileFormat; private final AffineTransform affineTransform; @@ -75,7 +76,7 @@ public class FileFormatOption { public FileFormatOption(FileFormat fileFormat) { this(fileFormat, null, true, false, "_top"); } - + public String getSvgLinkTarget() { return svgLinkTarget; } @@ -88,7 +89,8 @@ public class FileFormatOption { this(fileFormat, null, false, false, "_top"); } - private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata, boolean useRedForError, String svgLinkTarget) { + private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata, boolean useRedForError, + String svgLinkTarget) { this.fileFormat = fileFormat; this.affineTransform = at; this.withMetadata = withMetadata; diff --git a/src/net/sourceforge/plantuml/FontParam.java b/src/net/sourceforge/plantuml/FontParam.java index 73d46adea..aafb349ae 100644 --- a/src/net/sourceforge/plantuml/FontParam.java +++ b/src/net/sourceforge/plantuml/FontParam.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16629 $ + * Revision $Revision: 17071 $ * */ package net.sourceforge.plantuml; @@ -36,9 +36,6 @@ package net.sourceforge.plantuml; import java.awt.Font; import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.ugraphic.UFont; interface FontParamConstant { String FAMILY = "SansSerif"; @@ -153,11 +150,7 @@ public enum FontParam { } public FontConfiguration getFontConfiguration(ISkinParam skinParam) { - final UFont font = skinParam.getFont(this, null, false); - final HtmlColor color = new Rose().getFontColor(skinParam, this); - final HtmlColor hyperlinkColor = skinParam.getHyperlinkColor(); - final boolean useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink(); - return new FontConfiguration(font, color, hyperlinkColor, useUnderlineForHyperlink); + return new FontConfiguration(skinParam, this, null); } } diff --git a/src/net/sourceforge/plantuml/GeneratedImage.java b/src/net/sourceforge/plantuml/GeneratedImage.java index 1cff0f091..4c271384e 100644 --- a/src/net/sourceforge/plantuml/GeneratedImage.java +++ b/src/net/sourceforge/plantuml/GeneratedImage.java @@ -28,65 +28,19 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12869 $ + * Revision $Revision: 17137 $ * */ package net.sourceforge.plantuml; import java.io.File; -import net.sourceforge.plantuml.core.Diagram; +public interface GeneratedImage extends Comparable { -public class GeneratedImage implements Comparable { + public File getPngFile(); - private final File pngFile; - private final String description; - private final BlockUml blockUml; + public String getDescription(); - public GeneratedImage(File pngFile, String description, BlockUml blockUml) { - this.blockUml = blockUml; - this.pngFile = pngFile; - this.description = description; - } - - public File getPngFile() { - return pngFile; - } - - public String getDescription() { - return description; - } - - public int lineErrorRaw() { - final Diagram system = blockUml.getDiagram(); - if (system instanceof PSystemError) { - return ((PSystemError) system).getHigherErrorPosition() + blockUml.getStartLine(); - } - return -1; - } - - @Override - public String toString() { - return pngFile.getAbsolutePath() + " " + description; - } - - public int compareTo(GeneratedImage this2) { - final int cmp = this.pngFile.compareTo(this2.pngFile); - if (cmp != 0) { - return cmp; - } - return this.description.compareTo(this2.description); - } - - @Override - public int hashCode() { - return pngFile.hashCode() + description.hashCode(); - } - - @Override - public boolean equals(Object obj) { - final GeneratedImage this2 = (GeneratedImage) obj; - return this2.pngFile.equals(this.pngFile) && this2.description.equals(this.description); - } + public int lineErrorRaw(); } diff --git a/src/net/sourceforge/plantuml/GeneratedImageImpl.java b/src/net/sourceforge/plantuml/GeneratedImageImpl.java new file mode 100644 index 000000000..a4c84ba1c --- /dev/null +++ b/src/net/sourceforge/plantuml/GeneratedImageImpl.java @@ -0,0 +1,92 @@ +/* ======================================================================== + * 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: 12869 $ + * + */ +package net.sourceforge.plantuml; + +import java.io.File; + +import net.sourceforge.plantuml.core.Diagram; + +public class GeneratedImageImpl implements GeneratedImage { + + private final File pngFile; + private final String description; + private final BlockUml blockUml; + + public GeneratedImageImpl(File pngFile, String description, BlockUml blockUml) { + this.blockUml = blockUml; + this.pngFile = pngFile; + this.description = description; + } + + public File getPngFile() { + return pngFile; + } + + public String getDescription() { + return description; + } + + public int lineErrorRaw() { + final Diagram system = blockUml.getDiagram(); + if (system instanceof PSystemError) { + return ((PSystemError) system).getHigherErrorPosition() + blockUml.getStartLine(); + } + return -1; + } + + @Override + public String toString() { + return pngFile.getAbsolutePath() + " " + description; + } + + public int compareTo(GeneratedImage this2) { + final int cmp = this.pngFile.compareTo(this2.getPngFile()); + if (cmp != 0) { + return cmp; + } + return this.description.compareTo(this2.getDescription()); + } + + @Override + public int hashCode() { + return pngFile.hashCode() + description.hashCode(); + } + + @Override + public boolean equals(Object obj) { + final GeneratedImageImpl this2 = (GeneratedImageImpl) obj; + return this2.pngFile.equals(this.pngFile) && this2.description.equals(this.description); + } + +} diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index b0dc15224..a41a556d0 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -41,6 +41,7 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.ColorMapper; @@ -57,6 +58,8 @@ public interface ISkinParam extends ISkinSimple { public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable); + public Colors getColors(ColorParam param, Stereotype stereotype); + public HtmlColor getFontHtmlColor(FontParam param, Stereotype stereotype); public UStroke getThickness(LineParam param, Stereotype stereotype); @@ -116,11 +119,13 @@ public interface ISkinParam extends ISkinSimple { public IHtmlColorSet getIHtmlColorSet(); public int groupInheritance(); - + public boolean useGuillemet(); public boolean handwritten(); public String getSvgLinkTarget(); + + public int getTabSize(); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/ISkinSimple.java b/src/net/sourceforge/plantuml/ISkinSimple.java index eb3b99dce..1ec290c6b 100644 --- a/src/net/sourceforge/plantuml/ISkinSimple.java +++ b/src/net/sourceforge/plantuml/ISkinSimple.java @@ -41,5 +41,6 @@ public interface ISkinSimple extends SpriteContainer { public String getMonospacedFamily(); + public int getTabSize(); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/ISourceFileReader.java b/src/net/sourceforge/plantuml/ISourceFileReader.java index 42d38912d..fce95ae0e 100644 --- a/src/net/sourceforge/plantuml/ISourceFileReader.java +++ b/src/net/sourceforge/plantuml/ISourceFileReader.java @@ -43,5 +43,8 @@ public interface ISourceFileReader { public List getEncodedUrl() throws IOException; public boolean hasError(); + + public void setFileFormatOption(FileFormatOption fileFormatOption); + } diff --git a/src/net/sourceforge/plantuml/LineConfigurable.java b/src/net/sourceforge/plantuml/LineConfigurable.java index b865a8f05..cc656e2be 100644 --- a/src/net/sourceforge/plantuml/LineConfigurable.java +++ b/src/net/sourceforge/plantuml/LineConfigurable.java @@ -34,16 +34,18 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.UStroke; public interface LineConfigurable { - public HtmlColor getSpecificLineColor(); + public Colors getColors(ISkinParam skinParam); + + public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color); - public void setSpecificLineColor(HtmlColor specificLinecolor); +// public void setSpecificLineStroke(UStroke specificLineStroke); - public UStroke getSpecificLineStroke(); - public void setSpecificLineStroke(UStroke specificLineStoke); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index fd7af5b67..ad22e2114 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: 16732 $ + * Revision $Revision: 17125 $ * */ package net.sourceforge.plantuml; @@ -56,6 +56,7 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.ColorMapper; @@ -169,13 +170,28 @@ public class SkinParam implements ISkinParam { } } final String value = getValue(getParamName(param, clickable)); - final boolean acceptTransparent = param == ColorParam.background; if (value == null) { return null; } + final boolean acceptTransparent = param == ColorParam.background; return getIHtmlColorSet().getColorIfValid(value, acceptTransparent); } + public Colors getColors(ColorParam param, Stereotype stereotype) { + if (stereotype != null) { + checkStereotype(stereotype); + final String value2 = getValue(param.name() + "color" + stereotype.getLabel(false)); + if (value2 != null && getIHtmlColorSet().getColorIfValid(value2) != null) { + return new Colors(value2, getIHtmlColorSet(), param.getColorType()); + } + } + final String value = getValue(getParamName(param, false)); + if (value == null) { + return Colors.empty(); + } + return new Colors(value, getIHtmlColorSet(), param.getColorType()); + } + private String getParamName(ColorParam param, boolean clickable) { String n = param.name(); if (clickable && n.endsWith("Background")) { @@ -681,4 +697,12 @@ public class SkinParam implements ISkinParam { return value; } + public int getTabSize() { + final String value = getValue("tabsize"); + if (value != null && value.matches("\\d+")) { + return Integer.parseInt(value); + } + return 8; + } + } diff --git a/src/net/sourceforge/plantuml/SkinParamColors.java b/src/net/sourceforge/plantuml/SkinParamColors.java new file mode 100644 index 000000000..1400a24df --- /dev/null +++ b/src/net/sourceforge/plantuml/SkinParamColors.java @@ -0,0 +1,76 @@ +/* ======================================================================== + * 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: 4246 $ + * + */ +package net.sourceforge.plantuml; + +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; + +public class SkinParamColors extends SkinParamDelegator { + + final private Colors colors; + + public SkinParamColors(ISkinParam skinParam, Colors colors) { + super(skinParam); + this.colors = colors; + } + + @Override + public String toString() { + return super.toString() + colors; + } + + public HtmlColor getFontHtmlColor(FontParam param, Stereotype stereotype) { + final HtmlColor value = colors.getColor(ColorType.TEXT); + if (value == null) { + return super.getFontHtmlColor(param, stereotype); + } + return value; + } + + public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { + final ColorType type = param.getColorType(); + if (type == null) { + return super.getHtmlColor(param, stereotype, clickable); + } + final HtmlColor value = colors.getColor(type); + if (value != null) { + return value; + } + assert value == null; + return super.getHtmlColor(param, stereotype, clickable); + } + +} diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 33a1e957e..283489bd2 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -41,6 +41,7 @@ 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.graphic.color.Colors; import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.ugraphic.ColorMapper; @@ -179,7 +180,7 @@ public class SkinParamDelegator implements ISkinParam { public Rankdir getRankdir() { return skinParam.getRankdir(); } - + public boolean useOctagonForActivity(Stereotype stereotype) { return skinParam.useOctagonForActivity(stereotype); } @@ -220,5 +221,12 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getMonospacedFamily(); } + public Colors getColors(ColorParam param, Stereotype stereotype) { + return skinParam.getColors(param, stereotype); + } + + public int getTabSize() { + return skinParam.getTabSize(); + } } diff --git a/src/net/sourceforge/plantuml/SkinParamForceColor.java b/src/net/sourceforge/plantuml/SkinParamForceColor.java index 37cb89e9e..c7507cdb8 100644 --- a/src/net/sourceforge/plantuml/SkinParamForceColor.java +++ b/src/net/sourceforge/plantuml/SkinParamForceColor.java @@ -48,7 +48,6 @@ public class SkinParamForceColor extends SkinParamDelegator { } public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) { - System.err.println("param=" + param); if (colorParam == param) { return color; } diff --git a/src/net/sourceforge/plantuml/SkinParamUtils.java b/src/net/sourceforge/plantuml/SkinParamUtils.java index 8abfb79a3..e329539af 100644 --- a/src/net/sourceforge/plantuml/SkinParamUtils.java +++ b/src/net/sourceforge/plantuml/SkinParamUtils.java @@ -53,5 +53,5 @@ public class SkinParamUtils { public static HtmlColor getColor(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) { return rose.getHtmlColor(skinParam, colorParam, stereo); } - + } diff --git a/src/net/sourceforge/plantuml/SourceFileReader.java b/src/net/sourceforge/plantuml/SourceFileReader.java index fd867b83b..3a7a16217 100644 --- a/src/net/sourceforge/plantuml/SourceFileReader.java +++ b/src/net/sourceforge/plantuml/SourceFileReader.java @@ -53,6 +53,7 @@ import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; public class SourceFileReader implements ISourceFileReader { @@ -191,7 +192,7 @@ public class SourceFileReader implements ISourceFileReader { try { system = blockUml.getDiagram(); } catch (Throwable t) { - final GeneratedImage image = new GeneratedImage(suggested, "Crash Error", blockUml); + final GeneratedImage image = new GeneratedImageImpl(suggested, "Crash Error", blockUml); OutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream(suggested)); @@ -221,7 +222,7 @@ public class SourceFileReader implements ISourceFileReader { ps.close(); } } - final GeneratedImage generatedImage = new GeneratedImage(f, desc, blockUml); + final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml); result.add(generatedImage); } @@ -260,7 +261,7 @@ public class SourceFileReader implements ISourceFileReader { this.fileFormatOption = fileFormatOption; } - public final Set getIncludedFiles() { + public final Set getIncludedFiles() { return builder.getIncludedFiles(); } diff --git a/src/net/sourceforge/plantuml/SourceFileReader2.java b/src/net/sourceforge/plantuml/SourceFileReader2.java index a48991265..89328f1e2 100644 --- a/src/net/sourceforge/plantuml/SourceFileReader2.java +++ b/src/net/sourceforge/plantuml/SourceFileReader2.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.preproc.Defines; +import net.sourceforge.plantuml.preproc.FileWithSuffix; public class SourceFileReader2 implements ISourceFileReader { @@ -94,7 +95,7 @@ public class SourceFileReader2 implements ISourceFileReader { for (File f : PSystemUtils.exportDiagrams(system, suggested, fileFormatOption)) { final String desc = "[" + file.getName() + "] " + system.getDescription(); - final GeneratedImage generatedImage = new GeneratedImage(f, desc, blockUml); + final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml); result.add(generatedImage); } @@ -129,7 +130,7 @@ public class SourceFileReader2 implements ISourceFileReader { this.fileFormatOption = fileFormatOption; } - public final Set getIncludedFiles() { + public final Set getIncludedFiles2() { return builder.getIncludedFiles(); } diff --git a/src/net/sourceforge/plantuml/SpecificBackcolorable.java b/src/net/sourceforge/plantuml/SpecificBackcolorable.java index edd0b9346..62aaa6f56 100644 --- a/src/net/sourceforge/plantuml/SpecificBackcolorable.java +++ b/src/net/sourceforge/plantuml/SpecificBackcolorable.java @@ -34,11 +34,15 @@ package net.sourceforge.plantuml; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; public interface SpecificBackcolorable { - public HtmlColor getSpecificBackColor(); + public Colors getColors(ISkinParam skinParam); - public void setSpecificBackcolor(HtmlColor specificBackcolor); + public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color); + + public void setColors(Colors colors); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java index 539a9b983..a0c323b5e 100644 --- a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java +++ b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java @@ -58,4 +58,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { return CommandCreoleMonospaced.MONOSPACED; } + public int getTabSize() { + return 8; + } + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java index 530c42808..6724e692f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java @@ -57,8 +57,8 @@ import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotype; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; public class CommandLinkActivity extends SingleLineCommand2 { @@ -118,7 +118,7 @@ public class CommandLinkActivity extends SingleLineCommand2 { entity1.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0))); } if (arg.get("BACKCOLOR", 0) != null) { - entity1.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet() + entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("BACKCOLOR", 0))); } @@ -127,7 +127,7 @@ public class CommandLinkActivity extends SingleLineCommand2 { return CommandExecutionResult.error("No such activity"); } if (arg.get("BACKCOLOR2", 0) != null) { - entity2.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet() + entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(arg.get("BACKCOLOR2", 0))); } if (arg.get("STEREOTYPE2", 0) != null) { diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java index c75eabb65..f82e07b24 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java @@ -61,6 +61,7 @@ import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorType; public class CommandLinkLongActivity extends CommandMultilines2 { @@ -114,7 +115,7 @@ public class CommandLinkLongActivity extends CommandMultilines2 entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0))); } if (line0.get("BACKCOLOR", 0) != null) { - entity1.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet() + entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() .getColorIfValid(line0.get("BACKCOLOR", 0))); } final StringBuilder sb = new StringBuilder(); @@ -175,7 +176,7 @@ public class CommandLinkLongActivity extends CommandMultilines2 entity2.setStereotype(new Stereotype(lineLast.get(2))); } if (lineLast.get(4) != null) { - entity2.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(lineLast.get(4))); + entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(lineLast.get(4))); } if (entity1 == null || entity2 == null) { diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java index b0320223f..a7d557f01 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java @@ -28,13 +28,14 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 14661 $ + * Revision $Revision: 17003 $ * */ package net.sourceforge.plantuml.activitydiagram.command; import java.util.List; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand; @@ -43,8 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; -import net.sourceforge.plantuml.graphic.HtmlColorSet; -import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; public class CommandPartition extends SingleLineCommand { @@ -60,7 +60,7 @@ public class CommandPartition extends SingleLineCommand { currentPackage); final String color = arg.get(1); if (color != null) { - p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); + p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); } return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index 77f83a16a..5d663536c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -62,6 +62,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockCompressed; import net.sourceforge.plantuml.graphic.TextBlockRecentred; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.DecorateEntityImage; @@ -109,10 +110,10 @@ public class ActivityDiagram3 extends UmlDiagram { return swinlanes.nextLinkRenderer(); } - public void addActivity(Display activity, HtmlColor color, BoxStyle style, Url url) { + public void addActivity(Display activity, BoxStyle style, Url url, Colors colors) { manageSwimlaneStrategy(); - final InstructionSimple ins = new InstructionSimple(activity, color, nextLinkRenderer(), - swinlanes.getCurrentSwimlane(), style, url); + final InstructionSimple ins = new InstructionSimple(activity, nextLinkRenderer(), + swinlanes.getCurrentSwimlane(), style, url, colors); current().add(ins); setNextLinkRendererInternal(null); manageHasUrl(activity); @@ -210,10 +211,8 @@ public class ActivityDiagram3 extends UmlDiagram { if (Display.isNull(title)) { return original; } - final TextBlock text = title.create( - new FontConfiguration(getFont(FontParam.TITLE), getFontColor(FontParam.TITLE, null), getSkinParam() - .getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, - getSkinParam()); + final TextBlock text = title.create(new FontConfiguration(getSkinParam(), FontParam.TITLE, null), + HorizontalAlignment.CENTER, getSkinParam()); return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER); } @@ -225,11 +224,9 @@ public class ActivityDiagram3 extends UmlDiagram { return original; } final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration( - getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(), - getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam()); + getSkinParam(), FontParam.FOOTER, null), getFooterAlignment(), getSkinParam()); final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration( - getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(), - getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam()); + getSkinParam(), FontParam.HEADER, null), getHeaderAlignment(), getSkinParam()); return new DecorateTextBlock(original, textHeader, getHeaderAlignment(), textFooter, getFooterAlignment()); } @@ -330,6 +327,7 @@ public class ActivityDiagram3 extends UmlDiagram { } public CommandExecutionResult endif() { + // System.err.println("Activity3::endif"); if (current() instanceof InstructionIf) { ((InstructionIf) current()).endif(nextLinkRenderer()); setNextLinkRendererInternal(null); @@ -407,14 +405,18 @@ public class ActivityDiagram3 extends UmlDiagram { } private void setNextLinkRendererInternal(LinkRendering link) { + // System.err.println("setNextLinkRendererInternal=" + link); swinlanes.setNextLinkRenderer(link); } private void setNextLink(LinkRendering linkRenderer) { + // System.err.println("setNextLink=" + linkRenderer); if (current() instanceof InstructionCollection) { final Instruction last = ((InstructionCollection) current()).getLast(); if (last instanceof InstructionWhile) { ((InstructionWhile) last).afterEndwhile(linkRenderer); + } else if (last instanceof InstructionIf) { + ((InstructionIf) last).afterEndwhile(linkRenderer); } } this.setNextLinkRendererInternal(linkRenderer); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java index c652675fe..fd9516fa4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java @@ -48,7 +48,6 @@ public class Branch { private final Display labelTest; private final Display labelPositive; private final HtmlColor color; - private LinkRendering inlinkRendering; private Ftile ftile; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java index 8d2709287..9c3720392 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java @@ -57,7 +57,8 @@ public class InstructionIf implements Instruction, InstructionCollection { private final Instruction parent; private Branch current; - private final LinkRendering inlinkRendering; + private final LinkRendering topInlinkRendering; + private LinkRendering afterEndwhile; private final Swimlane swimlane; @@ -65,8 +66,7 @@ public class InstructionIf implements Instruction, InstructionCollection { LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam) { this.parent = parent; this.skinParam = skinParam; - - this.inlinkRendering = inlinkRendering; + this.topInlinkRendering = inlinkRendering; this.swimlane = swimlane; this.thens.add(new Branch(swimlane, whenThen, labelTest, color)); this.current = this.thens.get(0); @@ -87,7 +87,7 @@ public class InstructionIf implements Instruction, InstructionCollection { this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null); } elseBranch.updateFtile(factory); - Ftile result = factory.createIf(swimlane, thens, elseBranch); + Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering); if (note != null) { result = new FtileWithNoteOpale(result, note, position, skinParam, false); } @@ -130,7 +130,7 @@ public class InstructionIf implements Instruction, InstructionCollection { } public LinkRendering getInLinkRendering() { - return inlinkRendering; + return topInlinkRendering; } public boolean addNote(Display note, NotePosition position) { @@ -165,9 +165,13 @@ public class InstructionIf implements Instruction, InstructionCollection { public Instruction getLast() { if (elseBranch == null) { - return thens.get(thens.size()-1).getLast(); + return thens.get(thens.size() - 1).getLast(); } return elseBranch.getLast(); } + public void afterEndwhile(LinkRendering linkRenderer) { + this.afterEndwhile = linkRenderer; + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java index 5d97ce0dd..d064b81be 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionSimple.java @@ -41,31 +41,35 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; public class InstructionSimple extends MonoSwimable implements Instruction { private boolean killed = false; private final Display label; - private final HtmlColor color; + private final Colors colors; private final LinkRendering inlinkRendering; private Display note; private NotePosition notePosition; private final BoxStyle style; private final Url url; - public InstructionSimple(Display label, HtmlColor color, LinkRendering inlinkRendering, Swimlane swimlane, - BoxStyle style, Url url) { + public InstructionSimple(Display label, LinkRendering inlinkRendering, Swimlane swimlane, + BoxStyle style, Url url, Colors colors) { super(swimlane); + if (colors == null) { + throw new IllegalArgumentException(); + } this.url = url; this.style = style; this.label = label; - this.color = color; this.inlinkRendering = inlinkRendering; + this.colors = colors; } public Ftile createFtile(FtileFactory factory) { - Ftile result = factory.activity(label, color, getSwimlaneIn(), style); + Ftile result = factory.activity(label, getSwimlaneIn(), style, colors); if (url != null) { result = factory.addUrl(result, url); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java index 70e815770..e75232469 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionWhile.java @@ -93,7 +93,6 @@ public class InstructionWhile implements Instruction, InstructionCollection { if (note != null) { tmp = new FtileWithNoteOpale(tmp, note, position, skinParam, false); } - // tmp = factory.decorateOut(tmp, afterEndwhile); return tmp; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java index 88fe0af66..f71598b91 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java @@ -46,6 +46,8 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; public class CommandActivity3 extends SingleLineCommand2 { @@ -58,13 +60,18 @@ public class CommandActivity3 extends SingleLineCommand2 { static RegexConcat getRegexConcat() { return new RegexConcat(new RegexLeaf("^"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // - ColorParser.exp5(), // + color().getRegex(), // + new RegexLeaf("[%s]*"), // new RegexLeaf(":"), // new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("STYLE", ENDING_GROUP), // new RegexLeaf("$")); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) { @@ -76,9 +83,9 @@ public class CommandActivity3 extends SingleLineCommand2 { url = urlBuilder.getUrl(arg.get("URL", 0)); } - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); + final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0)); - diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), color, style, url); + diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), style, url, colors); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java index b3c3498ca..06c1b88ad 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLegacy1.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.color.Colors; public class CommandActivityLegacy1 extends SingleLineCommand2 { @@ -57,7 +58,7 @@ public class CommandActivityLegacy1 extends SingleLineCommand2 @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) { - diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), null, BoxStyle.PLAIN, null); + diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), BoxStyle.PLAIN, null, Colors.empty()); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java index 2d7bdf8c6..d8515e413 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java @@ -43,8 +43,9 @@ import net.sourceforge.plantuml.command.MultilinesStrategy; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; public class CommandActivityLong3 extends CommandMultilines2 { @@ -57,9 +58,13 @@ public class CommandActivityLong3 extends CommandMultilines2 { return "^(.*)" + CommandActivity3.ENDING_GROUP + "$"; } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + static RegexConcat getRegexConcat() { return new RegexConcat(new RegexLeaf("^"), // - ColorParser.exp5(), // + color().getRegex(), // new RegexLeaf(":"), // new RegexLeaf("DATA", "(.*)"), // new RegexLeaf("$")); @@ -68,10 +73,11 @@ public class CommandActivityLong3 extends CommandMultilines2 { public CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { lines = lines.removeEmptyColumns(); final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499())); - final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); + final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); + // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); final BoxStyle style = BoxStyle.fromChar(lines.getLastChar()); lines = lines.removeStartingAndEnding2(line0.get("DATA", 0)); - diagram.addActivity(lines.toDisplay(), color, style, null); + diagram.addActivity(lines.toDisplay(), style, null, colors); return CommandExecutionResult.ok(); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java index 215039c50..00d640f73 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java @@ -50,7 +50,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -71,13 +70,10 @@ public class EntityImageLegend extends AbstractTextBlock implements TextBlock { final Rose rose = new Rose(); noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.legendBackground); - borderColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder); - final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.LEGEND); - final UFont fontNote = skinParam.getFont(FontParam.LEGEND, null, false); - this.textBlock = note.create(new FontConfiguration(fontNote, fontColor, - skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, skinParam); + this.textBlock = note.create(new FontConfiguration(skinParam, FontParam.LEGEND, null), + HorizontalAlignment.LEFT, skinParam); } public static TextBlock create(Display legend, ISkinParam skinParam) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java index 63975cb9f..0f675bff3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; public interface FtileFactory extends ISkinSimple { @@ -56,7 +57,7 @@ public interface FtileFactory extends ISkinSimple { public Ftile end(Swimlane swimlane); - public Ftile activity(Display label, HtmlColor color, Swimlane swimlane, BoxStyle style); + public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors); public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition); @@ -68,12 +69,14 @@ public interface FtileFactory extends ISkinSimple { public Ftile assembly(Ftile tile1, Ftile tile2); - public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering); + public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, + LinkRendering backRepeatLinkRendering); public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, LinkRendering afterEndwhile, HtmlColor color); - public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch); + public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, + LinkRendering topInlinkRendering); public Ftile createFork(Swimlane swimlane, List all); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java index 5bc6d26d4..56d5a8ceb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java @@ -48,10 +48,10 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.Sprite; -import net.sourceforge.plantuml.ugraphic.UFont; public class FtileFactoryDelegator implements FtileFactory { @@ -69,20 +69,16 @@ public class FtileFactoryDelegator implements FtileFactory { } return color; } - + protected final TextBlock getTextBlock(Display display) { if (Display.isNull(display)) { return null; } final ISkinParam skinParam = getSkinParam(); - final UFont font = skinParam.getFont(FontParam.ACTIVITY_ARROW, null, false); - final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW); - final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); + final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.ACTIVITY_ARROW, null); return display.create(fontConfiguration, HorizontalAlignment.LEFT, this, CreoleMode.SIMPLE_LINE); } - protected Display getInLinkRenderingDisplay(Ftile tile) { final LinkRendering linkRendering = tile.getInLinkRendering(); if (linkRendering == null) { @@ -108,8 +104,8 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.stop(swimlane); } - public Ftile activity(Display label, HtmlColor color, Swimlane swimlane, BoxStyle style) { - return factory.activity(label, color, swimlane, style); + public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) { + return factory.activity(label, swimlane, style, colors); } public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) { @@ -132,7 +128,8 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.assembly(tile1, tile2); } - public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering) { + public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, + LinkRendering backRepeatLinkRendering) { return factory.repeat(swimlane, repeat, test, yes, out, color, backRepeatLinkRendering); } @@ -141,8 +138,8 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color); } - public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch) { - return factory.createIf(swimlane, thens, elseBranch); + public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, LinkRendering topInlinkRendering) { + return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering); } public Ftile createFork(Swimlane swimlane, List all) { @@ -197,4 +194,8 @@ public class FtileFactoryDelegator implements FtileFactory { return skinParam.getMonospacedFamily(); } + public int getTabSize() { + return skinParam.getTabSize(); + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java index fbf828ec2..601b5ea2a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlane.java @@ -33,15 +33,17 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.UTranslate; public class Swimlane implements SpecificBackcolorable { private final String name; - private HtmlColor color; private Display display; private UTranslate translate = new UTranslate(); @@ -79,16 +81,24 @@ public class Swimlane implements SpecificBackcolorable { this.totalWidth = totalWidth; } - public HtmlColor getSpecificBackColor() { - return color; + public Colors getColors(ISkinParam skinParam) { + return colors; } - public void setSpecificBackcolor(HtmlColor specificBackcolor) { - this.color = specificBackcolor; + public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + if (color != null) { + this.colors = colors.add(type, color); + } } + private Colors colors = Colors.empty(); + public final double getTotalWidth() { return totalWidth; } + public void setColors(Colors colors) { + this.colors = colors; + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java index b7f706f89..b9c49f583 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java @@ -64,6 +64,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UGraphicDelegator; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.UGraphicForSnake; import net.sourceforge.plantuml.ugraphic.CompressionTransform; import net.sourceforge.plantuml.ugraphic.LimitFinder; @@ -73,7 +74,6 @@ import net.sourceforge.plantuml.ugraphic.SlotSet; import net.sourceforge.plantuml.ugraphic.UChange; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -98,9 +98,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock { } private FontConfiguration getFontConfiguration() { - final UFont font = skinParam.getFont(FontParam.TITLE, null, false); - return new FontConfiguration(font, HtmlColorUtils.BLACK, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); + return new FontConfiguration(skinParam, FontParam.TITLE, null); } private FtileFactory getFtileFactory() { @@ -120,7 +118,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock { public void swimlane(String name, HtmlColor color, Display label) { currentSwimlane = getOrCreate(name); if (color != null) { - currentSwimlane.setSpecificBackcolor(color); + currentSwimlane.setSpecificColorTOBEREMOVED(ColorType.BACK, color); } if (Display.isNull(label) == false) { currentSwimlane.setDisplay(label); @@ -242,15 +240,17 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock { double x2 = 0; for (Swimlane swimlane : swimlanes) { - if (swimlane.getSpecificBackColor() != null) { - final UGraphic background = ug.apply(new UChangeBackColor(swimlane.getSpecificBackColor())) - .apply(new UChangeColor(swimlane.getSpecificBackColor())).apply(new UTranslate(x2, 0)); + final HtmlColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK); + if (back != null) { + final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back)) + .apply(new UTranslate(x2, 0)); background.draw(new URectangle(swimlane.getTotalWidth(), dimensionFull.getHeight() + titleHeightTranslate.getDy())); } if (OptionFlags.SWI2 == false) { - final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); + final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), + HorizontalAlignment.LEFT, skinParam); final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth(); final double posTitle = x2 + (swimlane.getTotalWidth() - titleWidth) / 2; swTitle.drawU(ug.apply(new UTranslate(posTitle, 0))); @@ -282,7 +282,8 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock { final MinMax minMax = limitFinder.getMinMax(); final double drawingWidth = minMax.getWidth() + 2 * separationMargin; - final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); + final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, + skinParam); final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth(); final double totalWidth = Math.max(drawingWidth, titleWidth + 2 * separationMargin); @@ -297,7 +298,8 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock { private UTranslate getTitleHeightTranslate(final StringBounder stringBounder) { double titlesHeight = 0; for (Swimlane swimlane : swimlanes) { - final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); + final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, + skinParam); titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight()); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java index 7bec4b350..4ff39707f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FloatingNote.java @@ -64,17 +64,17 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc public FloatingNote(Display note, ISkinParam skinParam) { final Rose rose = new Rose(); - final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); - final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); + final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note); - final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1)); - this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false); + final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + .createSheet(note); + final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, + new UStroke(1)); + this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false); // this.text = sheetBlock2; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java index 1450e1ae7..49e614467 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java @@ -40,14 +40,15 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.activitydiagram3.Branch; +import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UFont; public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { @@ -56,13 +57,10 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { } @Override - public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch) { + public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, + LinkRendering topInlinkRendering) { final ConditionStyle conditionStyle = getSkinParam().getConditionStyle(); - final UFont fontArrow = getSkinParam().getFont(FontParam.ACTIVITY_ARROW, null, false); - final UFont fontTest = getSkinParam().getFont( - conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null, - false); final Branch branch0 = thens.get(0); final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder); @@ -70,17 +68,20 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { ColorParam.activityBackground) : branch0.getColor(); final HtmlColor arrowColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityArrow); + final FontConfiguration fcArrow = new FontConfiguration(getSkinParam(), FontParam.ACTIVITY_ARROW, null); if (thens.size() > 1) { - return FtileIfLong2.create(swimlane, borderColor, backColor, fontArrow, arrowColor, getFactory(), - conditionStyle, thens, elseBranch, getSkinParam().getHyperlinkColor(), getSkinParam() - .useUnderlineForHyperlink()); + return FtileIfLong2.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle, + thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile); } + final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND + : FontParam.ACTIVITY_ARROW; + final FontConfiguration fcTest = new FontConfiguration(getSkinParam(), testParam, null); if (OptionFlags.USE_NEW_IF) { - return ConditionalBuilder.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor, - getFactory(), conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder()); + return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), + conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder(), fcArrow, fcTest); } else { - return FtileIfOrigin.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor, - getFactory(), conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder()); + return FtileIfOrigin.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle, + thens.get(0), elseBranch, getSkinParam(), getStringBounder(), fcArrow, fcTest); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java index 1a225d80a..66623ff3f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java @@ -42,9 +42,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UFont; public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { @@ -56,9 +56,6 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering) { final ConditionStyle conditionStyle = getSkinParam().getConditionStyle(); - final UFont font = getSkinParam().getFont( - conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null, - false); final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder); final HtmlColor backColor = color == null ? getRose().getHtmlColor(getSkinParam(), @@ -68,9 +65,11 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering(); final HtmlColor endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getColor(); - return FtileRepeat.create(backRepeatLinkRendering, swimlane, repeat, test, yes, out, borderColor, backColor, font, arrowColor, - endRepeatLinkColor, conditionStyle, this, getSkinParam().getHyperlinkColor(), getSkinParam() - .useUnderlineForHyperlink()); - } + final FontParam fontParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND + : FontParam.ACTIVITY_ARROW; + final FontConfiguration fc = new FontConfiguration(getSkinParam(), fontParam, null); + return FtileRepeat.create(backRepeatLinkRendering, swimlane, repeat, test, yes, out, borderColor, backColor, + arrowColor, endRepeatLinkColor, conditionStyle, this, fc); + } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java index 587fc2c3c..42144b132 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java @@ -42,9 +42,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UFont; public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { @@ -61,14 +61,17 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { final HtmlColor arrowColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityArrow); final ConditionStyle conditionStyle = getSkinParam().getConditionStyle(); - final UFont fontArrow = getSkinParam().getFont(FontParam.ACTIVITY_ARROW, null, false); - final UFont fontTest = getSkinParam().getFont( - conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null, false); + final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND + : FontParam.ACTIVITY_ARROW; + final FontConfiguration fcTest = new FontConfiguration(getSkinParam(), testParam, null); final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering(); final HtmlColor endInlinkColor = endInlinkRendering == null ? arrowColor : endInlinkRendering.getColor(); + + final FontConfiguration fontArrow = new FontConfiguration(getSkinParam(), FontParam.ACTIVITY_ARROW, null); + return FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out, - fontArrow, endInlinkColor, afterEndwhile, getFactory(), conditionStyle, fontTest, getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()); + endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index 70ff90616..26311cca3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -84,7 +84,7 @@ public class FtileGroup extends AbstractFtile { this.titleColor = titleColor; final UFont font = new UFont("Serif", Font.PLAIN, 14); final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); + skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); if (title == null) { this.name = TextBlockUtils.empty(0, 0); } else { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java index fcd911bc4..d6df621b4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java @@ -66,11 +66,9 @@ 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; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -110,21 +108,16 @@ class FtileIfAndStop extends AbstractFtile { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, UFont fontTest, - HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch nonStop, - ISkinParam skinParam, StringBounder stringBounder, Display labelTest) { + static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor, + FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch nonStop, ISkinParam skinParam, + StringBounder stringBounder, Display labelTest) { - backColor = HtmlColorUtils.BLUE; + // backColor = HtmlColorUtils.BLUE; // final Ftile tileNonStop = new FtileMinWidth(nonStop.getFtile(), 30); final Ftile tileNonStop = nonStop.getFtile(); - final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null); - - final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); - final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); + final FontConfiguration fcTest = new FontConfiguration(skinParam, FontParam.ACTIVITY_DIAMOND, null); final Ftile stopFtile = ftileFactory.stop(swimlane); @@ -133,7 +126,8 @@ class FtileIfAndStop extends AbstractFtile { // final TextBlock tb2 = Display.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT, // ftileFactory); - final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(labelTest); + final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + .createSheet(labelTest); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding()); final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java index 5380765a9..b16bba02e 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLong2.java @@ -43,6 +43,7 @@ import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.activitydiagram3.Branch; +import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; @@ -55,16 +56,14 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; +import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileIfWithLinks; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2; -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; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -131,10 +130,9 @@ class FtileIfLong2 extends AbstractFtile { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont font, - HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, - Branch branch2, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { - + static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor, + FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, Branch branch2, + FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) { final List tiles = new ArrayList(); for (Branch branch : thens) { @@ -143,9 +141,6 @@ class FtileIfLong2 extends AbstractFtile { final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor, - useUnderlineForHyperlink); - List diamonds = new ArrayList(); final List conns = new ArrayList(); for (Branch branch : thens) { @@ -169,20 +164,22 @@ class FtileIfLong2 extends AbstractFtile { final Ftile ftile = tiles.get(i); final Ftile diam = diamonds.get(i); - final HtmlColor color = thens.get(i).getInlinkRenderingColor(); + final HtmlColor color = FtileIfWithLinks.getInColor(thens.get(i), arrowColor); conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color)); conns.add(result.new ConnectionVerticalOut(ftile, arrowColor)); } + final HtmlColor topInColor = LinkRendering.getColor(topInlinkRendering, arrowColor); for (int i = 0; i < diamonds.size() - 1; i++) { final Ftile diam1 = diamonds.get(i); final Ftile diam2 = diamonds.get(i + 1); - conns.add(result.new ConnectionHorizontal(diam1, diam2, arrowColor)); + conns.add(result.new ConnectionHorizontal(diam1, diam2, topInColor)); } - conns.add(result.new ConnectionIn(arrowColor)); - conns.add(result.new ConnectionLastElseIn(arrowColor)); + conns.add(result.new ConnectionIn(topInColor)); + conns.add(result.new ConnectionLastElseIn(FtileIfWithLinks.getInColor(branch2, arrowColor))); conns.add(result.new ConnectionLastElseOut(arrowColor)); - conns.add(result.new ConnectionHline(arrowColor)); + final HtmlColor horizontalOutColor = LinkRendering.getColor(afterEndwhile, arrowColor); + conns.add(result.new ConnectionHline(horizontalOutColor)); return FtileUtils.addConnection(result, conns); } @@ -503,5 +500,4 @@ class FtileIfLong2 extends AbstractFtile { } - } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongUnused.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongUnused.java index 70c4c1812..a4ca7bcee 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongUnused.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongUnused.java @@ -55,11 +55,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside; -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; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; @@ -119,8 +117,8 @@ class FtileIfLongUnused extends AbstractFtile { final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor, - useUnderlineForHyperlink); + final FontConfiguration fc = null; + // new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor, useUnderlineForHyperlink); final List diamonds = new ArrayList(); final List conns = new ArrayList(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfOrigin.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfOrigin.java index 309e98df2..89e501cef 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfOrigin.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfOrigin.java @@ -120,9 +120,9 @@ class FtileIfOrigin extends AbstractFtile { return getSwimlaneIn(); } - static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, UFont fontTest, - HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, - Branch branch2, ISkinParam skinParam, StringBounder stringBounder) { + static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor, + FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2, + ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) { final Display labelTest = branch1.getLabelTest(); // if (branch1.isOnlySingleStop() || branch2.isOnlySingleStop()) { @@ -134,17 +134,18 @@ class FtileIfOrigin extends AbstractFtile { final Ftile tile1 = new FtileMinWidth(branch1.getFtile(), 30); final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30); - final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null); + // final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(), + // skinParam.useUnderlineForHyperlink()); + // final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(), + // skinParam.useUnderlineForHyperlink()); - final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); - final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); + final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, + CreoleMode.SIMPLE_LINE); + final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, + CreoleMode.SIMPLE_LINE); - final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE); - final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE); - - final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(labelTest); + final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + .createSheet(labelTest); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding()); final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5)); @@ -163,9 +164,11 @@ class FtileIfOrigin extends AbstractFtile { if (tile1.calculateDimension(stringBounder).hasPointOut() && tile2.calculateDimension(stringBounder).hasPointOut()) { final Display out1 = LinkRendering.getDisplay(branch1.getFtile().getOutLinkRendering()); - final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE); + final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, + CreoleMode.SIMPLE_LINE); final Display out2 = LinkRendering.getDisplay(branch2.getFtile().getOutLinkRendering()); - final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE); + final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, + CreoleMode.SIMPLE_LINE); diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast( tbout2); } else { @@ -216,7 +219,7 @@ class FtileIfOrigin extends AbstractFtile { color = getInColor(branch); usingArrow = branch.isEmpty() ? null : Arrows.asToDown(); } - + public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Point2D p1 = getP1(stringBounder); @@ -299,7 +302,7 @@ class FtileIfOrigin extends AbstractFtile { this.myArrowColor = myArrowColor == null ? arrowColor : myArrowColor; this.branchEmpty = branchEmpty; } - + public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java index 11f8b5f4f..3fd6a73cb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java @@ -62,12 +62,10 @@ 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; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -99,16 +97,16 @@ class FtileRepeat extends AbstractFtile { } public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Ftile repeat, Display test, - Display yes, Display out, HtmlColor borderColor, HtmlColor backColor, UFont fontTest, HtmlColor arrowColor, + Display yes, Display out, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor, HtmlColor endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer, - HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { + FontConfiguration fontConfiguration) { - final FontConfiguration fc = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor, - useUnderlineForHyperlink); + // final FontConfiguration fc = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor, + // useUnderlineForHyperlink); final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0) : test.create( - fc, HorizontalAlignment.LEFT, spriteContainer); - final TextBlock yesTb = yes.create(fc, HorizontalAlignment.LEFT, spriteContainer); - final TextBlock outTb = out.create(fc, HorizontalAlignment.LEFT, spriteContainer); + fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); + final TextBlock yesTb = yes.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); + final TextBlock outTb = out.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); final Ftile diamond1 = new FtileDiamond(repeat.shadowing(), backColor, borderColor, swimlane); final FtileRepeat result; @@ -129,17 +127,17 @@ class FtileRepeat extends AbstractFtile { final List conns = new ArrayList(); final Display in1 = LinkRendering.getDisplay(repeat.getInLinkRendering()); - final TextBlock tbin1 = in1 == null ? null : in1.create(fc, HorizontalAlignment.LEFT, spriteContainer, + final TextBlock tbin1 = in1 == null ? null : in1.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE); conns.add(result.new ConnectionIn(LinkRendering.getColor(repeat.getInLinkRendering(), arrowColor), tbin1)); final Display backLink1 = LinkRendering.getDisplay(backRepeatLinkRendering); - final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fc, HorizontalAlignment.LEFT, + final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE); conns.add(result.new ConnectionBack(LinkRendering.getColor(backRepeatLinkRendering, arrowColor), tbbackLink1)); final Display out1 = LinkRendering.getDisplay(repeat.getOutLinkRendering()); - final TextBlock tbout1 = out1 == null ? null : out1.create(fc, HorizontalAlignment.LEFT, spriteContainer, + final TextBlock tbout1 = out1 == null ? null : out1.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE); conns.add(result.new ConnectionOut(LinkRendering.getColor(endRepeatLinkColor, arrowColor), tbout1)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 14006c458..6aac43a11 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -41,7 +41,6 @@ import java.util.List; import java.util.Set; import net.sourceforge.plantuml.Direction; -import net.sourceforge.plantuml.FileGroup; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; @@ -63,7 +62,6 @@ 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; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -71,7 +69,6 @@ import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UEmpty; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -102,10 +99,7 @@ class FtileWhile extends AbstractFtile { this.supplementarySouthText = supplementarySouthText; } - private static TextBlock createLabel1(Display test, Display yes, UFont font, ISkinSimple spriteContainer, - HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor, - useUnderlineForHyperlink); + private static TextBlock createLabel1(Display test, Display yes, ISkinSimple spriteContainer, FontConfiguration fc) { final TextBlock tmpb = yes.create(fc, HorizontalAlignment.LEFT, spriteContainer); if (test == null) { return tmpb; @@ -115,17 +109,13 @@ class FtileWhile extends AbstractFtile { } public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HtmlColor borderColor, - HtmlColor backColor, HtmlColor arrowColor, Display yes, Display out2, UFont fontArrow, - HtmlColor endInlinkColor, LinkRendering afterEndwhile, FtileFactory ftileFactory, - ConditionStyle conditionStyle, UFont fontTest, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { + HtmlColor backColor, HtmlColor arrowColor, Display yes, Display out2, HtmlColor endInlinkColor, + LinkRendering afterEndwhile, FontConfiguration fontArrow, FtileFactory ftileFactory, + ConditionStyle conditionStyle, FontConfiguration fcTest) { - final FontConfiguration fcArrow = new FontConfiguration(fontArrow, HtmlColorUtils.BLACK, hyperlinkColor, - useUnderlineForHyperlink); - final FontConfiguration fcTest = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor, - useUnderlineForHyperlink); - final TextBlock yesTb = yes.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory); + final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory); final TextBlock testTb = test.create(fcTest, HorizontalAlignment.LEFT, ftileFactory); - final TextBlock out = out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory); + final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory); final Ftile diamond1; final TextBlock supplementarySouthText; @@ -138,8 +128,7 @@ class FtileWhile extends AbstractFtile { diamond1 = new FtileDiamondFoo1(whileBlock.shadowing(), backColor, borderColor, swimlane, testTb) .withNorth(yesTb).withWest(out); } else if (conditionStyle == ConditionStyle.DIAMOND) { - supplementarySouthText = createLabel1(test, yes, fontArrow, ftileFactory, hyperlinkColor, - useUnderlineForHyperlink); + supplementarySouthText = createLabel1(test, yes, ftileFactory, fontArrow); diamond1 = new FtileDiamond(whileBlock.shadowing(), backColor, borderColor, swimlane).withWest(out) .withSouth(supplementarySouthText); } else { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java index ea7be8a4b..4bcdb050d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java @@ -95,15 +95,18 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil { // this.arrowColor = arrowColor; final Rose rose = new Rose(); - final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); - final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); + // final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); + // final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); + // final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), + // skinParam.useUnderlineForHyperlink()); + final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note); + final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + .createSheet(note); final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1)); opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index e8da0f855..cbf363114 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -56,6 +56,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOut import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.Sprite; @@ -91,12 +92,13 @@ public class VCompactFactory implements FtileFactory { return new FtileCircleEnd(shadowing(), color, swimlane); } - public Ftile activity(Display label, final HtmlColor color, Swimlane swimlane, BoxStyle style) { - final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder); - final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : color; + public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) { + // final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder); + // final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : + // color; final UFont font = skinParam.getFont(FontParam.ACTIVITY, null, false); final HtmlColor arrowColor = rose.getHtmlColor(skinParam, ColorParam.activityArrow); - return new FtileBox(shadowing(), label, borderColor, backColor, font, arrowColor, swimlane, style, skinParam); + return new FtileBox(shadowing(), label, font, arrowColor, swimlane, style, colors.mute(skinParam)); } public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) { @@ -121,7 +123,8 @@ public class VCompactFactory implements FtileFactory { return whileBlock; } - public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch) { + public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, + LinkRendering topInlinkRendering) { final List ftiles = new ArrayList(); for (Branch branch : thens) { ftiles.add(branch.getFtile()); @@ -180,4 +183,8 @@ public class VCompactFactory implements FtileFactory { return skinParam.getMonospacedFamily(); } + public int getTabSize() { + return skinParam.getTabSize(); + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java index 08d4f121e..a3c4b010b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java @@ -60,7 +60,6 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; public class ConditionalBuilder { @@ -68,8 +67,6 @@ public class ConditionalBuilder { private final Swimlane swimlane; private final HtmlColor borderColor; private final HtmlColor backColor; - private final UFont fontArrow; - private final UFont fontTest; private final HtmlColor arrowColor; private final FtileFactory ftileFactory; private final ConditionStyle conditionStyle; @@ -77,18 +74,18 @@ public class ConditionalBuilder { private final Branch branch2; private final ISkinParam skinParam; private final StringBounder stringBounder; + private final FontConfiguration fontArrow; + private final FontConfiguration fontTest; private final Ftile tile1; private final Ftile tile2; - public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, - UFont fontTest, HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, - Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder) { + public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor, + FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2, + ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest) { this.swimlane = swimlane; this.borderColor = borderColor; this.backColor = backColor; - this.fontArrow = fontArrow; - this.fontTest = fontTest; this.arrowColor = arrowColor; this.ftileFactory = ftileFactory; this.conditionStyle = conditionStyle; @@ -96,17 +93,19 @@ public class ConditionalBuilder { this.branch2 = branch2; this.skinParam = skinParam; this.stringBounder = stringBounder; + this.fontArrow = fontArrow.changeColor(fontColor()); + this.fontTest = fontTest.changeColor(fontColor()); this.tile1 = new FtileMinWidth(branch1.getFtile(), 30); this.tile2 = new FtileMinWidth(branch2.getFtile(), 30); } - static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, - UFont fontTest, HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, - Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder) { - final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, fontArrow, - fontTest, arrowColor, ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder); + static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor, + FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2, + ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) { + final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor, + ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder, fcArrow, fcTest); return builder.createWithLinks(); // return builder.createWithDiamonds(); // return builder.createNude(); @@ -156,9 +155,7 @@ public class ConditionalBuilder { final TextBlock tb1 = getLabelBranch1(); final TextBlock tb2 = getLabelBranch2(); - final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor(), skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); - final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + final Sheet sheet = new CreoleParser(fontTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) .createSheet(labelTest); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding()); final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5)); @@ -177,28 +174,26 @@ public class ConditionalBuilder { } private TextBlock getLabelBranch2() { - final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow(), HorizontalAlignment.LEFT, ftileFactory, + final TextBlock tb2 = branch2.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE); return tb2; } private TextBlock getLabelBranch1() { - final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow(), HorizontalAlignment.LEFT, ftileFactory, + final TextBlock tb1 = branch1.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE); return tb1; } private Ftile getDiamond2() { - final FontConfiguration fcArrow = fcArrow(); - final Ftile diamond2; if (hasTwoBranches()) { final Display out1 = LinkRendering.getDisplay(branch1.getFtile().getOutLinkRendering()); - final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, - CreoleMode.SIMPLE_LINE); + final TextBlock tbout1 = out1 == null ? null : out1.create(fontArrow, HorizontalAlignment.LEFT, + ftileFactory, CreoleMode.SIMPLE_LINE); final Display out2 = LinkRendering.getDisplay(branch2.getFtile().getOutLinkRendering()); - final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, - CreoleMode.SIMPLE_LINE); + final TextBlock tbout2 = out2 == null ? null : out2.create(fontArrow, HorizontalAlignment.LEFT, + ftileFactory, CreoleMode.SIMPLE_LINE); diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast( tbout2); } else { @@ -214,11 +209,6 @@ public class ConditionalBuilder { && tile2.calculateDimension(stringBounder).hasPointOut(); } - private FontConfiguration fcArrow() { - return new FontConfiguration(fontArrow, fontColor(), skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); - } - private HtmlColor fontColor() { return skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java index e0a682d91..60faddf2a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfWithLinks.java @@ -67,7 +67,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { this.arrowColor = arrowColor; } - private HtmlColor getInColor(Branch branch) { + public static HtmlColor getInColor(Branch branch, HtmlColor arrowColor) { if (branch.isEmpty()) { return LinkRendering.getColor(branch.getFtile().getOutLinkRendering(), arrowColor); } @@ -84,7 +84,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds { public ConnectionHorizontalThenVertical(Ftile tile, Branch branch) { super(diamond1, tile); - color = getInColor(branch); + color = getInColor(branch, arrowColor); usingArrow = branch.isEmpty() ? null : Arrows.asToDown(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java index 9967f2093..e5bf249ed 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java @@ -37,14 +37,14 @@ import java.awt.geom.Dimension2D; import java.util.Collections; import java.util.Set; +import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; -import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; -import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.creole.CreoleMode; @@ -73,11 +73,10 @@ public class FtileBox extends AbstractFtile { private final TextBlock tb; - private final HtmlColor borderColor; - private final HtmlColor backColor; private final LinkRendering inRenreding; private final Swimlane swimlane; private final BoxStyle style; + private final ISkinParam skinParam; final public LinkRendering getInLinkRendering() { return inRenreding; @@ -111,19 +110,16 @@ public class FtileBox extends AbstractFtile { } - public FtileBox(boolean shadowing, Display label, HtmlColor color, HtmlColor backColor, UFont font, - HtmlColor arrowColor, Swimlane swimlane, BoxStyle style, ISkinParam skinParam) { + public FtileBox(boolean shadowing, Display label, UFont font, HtmlColor arrowColor, Swimlane swimlane, + BoxStyle style, ISkinParam skinParam) { super(shadowing); this.style = style; - this.borderColor = color; + this.skinParam = skinParam; this.swimlane = swimlane; - this.backColor = backColor; this.inRenreding = new LinkRendering(arrowColor); - final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY, null); - final FontConfiguration fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink()); - - final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(label); + final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null); + final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + .createSheet(label); this.tb = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), new MyStencil(), new UStroke(1)); this.print = label.toString(); } @@ -141,6 +137,9 @@ public class FtileBox extends AbstractFtile { final double heightTotal = dimTotal.getHeight(); final UDrawable rect = style.getUDrawable(widthTotal, heightTotal, shadowing()); + final HtmlColor borderColor = SkinParamUtils.getColor(skinParam, ColorParam.activityBorder, null); + final HtmlColor backColor = SkinParamUtils.getColor(skinParam, ColorParam.activityBackground, null); + ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(new UStroke(1.5)); rect.drawU(ug); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index 2eba0b27a..1a5582ba2 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -49,8 +49,12 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.graphic.color.ColorType; public class CommandCreateClass extends SingleLineCommand2 { @@ -94,8 +98,8 @@ public class CommandCreateClass extends SingleLineCommand2 { new RegexLeaf("$")); } - public static ColorParser color() { - return ColorParser.simpleColor(); + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); } @Override @@ -129,9 +133,27 @@ public class CommandCreateClass extends SingleLineCommand2 { entity.addUrl(url); } - entity.setSpecificBackcolor(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet())); - entity.setSpecificLineColor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1))); - CommandCreateClassMultilines.applyStroke(entity, arg.get("LINECOLOR", 0)); + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + + final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + if (lineColor != null) { + colors = colors.add(ColorType.LINE, lineColor); + } + if (arg.get("LINECOLOR", 0) != null) { + colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0)); + } + entity.setColors(colors); + + // entity.setSpecificColorTOBEREMOVED(ColorType.LINE, lineColor); + // entity.setSpecificColorTOBEREMOVED(ColorType.HEADER, colors.getColor(ColorType.HEADER)); + // + // if (colors.getLineStyle() != null) { + // entity.setSpecificLineStroke(LinkStyle.getStroke(colors.getLineStyle())); + // } + // + // if (arg.get("LINECOLOR", 0) != null) { + // entity.applyStroke(arg.get("LINECOLOR", 0)); + // } // manageExtends(diagram, arg, entity); CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity); @@ -139,7 +161,6 @@ public class CommandCreateClass extends SingleLineCommand2 { return CommandExecutionResult.ok(); } - // public static void manageExtends(ClassDiagram system, RegexResult arg, final IEntity entity) { // if (arg.get("EXTENDS", 1) != null) { // final Mode mode = arg.get("EXTENDS", 1).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS; diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index 367e1d5c3..6f5e3a2b6 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -54,12 +54,13 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; -import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.VisibilityModifier; -import net.sourceforge.plantuml.ugraphic.UStroke; public class CommandCreateClassMultilines extends CommandMultilines2 { @@ -99,7 +100,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2 { @@ -213,7 +214,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2 entity.addUrl(url); } - entity.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + entity.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java index db47924a8..06c6bc32d 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java @@ -58,6 +58,10 @@ import net.sourceforge.plantuml.cucadiagram.LinkArrow; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.HtmlColorSet; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; final public class CommandLinkClass extends SingleLineCommand2 { @@ -100,13 +104,18 @@ final public class CommandLinkClass extends SingleLineCommand2\\>)?"; + return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator() + "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])"; } private static String getSeparator() { @@ -158,16 +167,18 @@ final public class CommandLinkClass extends SingleLineCommand2 { @@ -73,7 +74,7 @@ public class CommandNamespace extends SingleLineCommand2 { } final String color = arg.get("COLOR", 0); if (color != null) { - p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); + p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); } return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/net/sourceforge/plantuml/command/CommandPackage.java index 0e7ff6bc6..275c917f5 100644 --- a/src/net/sourceforge/plantuml/command/CommandPackage.java +++ b/src/net/sourceforge/plantuml/command/CommandPackage.java @@ -49,6 +49,8 @@ import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.utils.UniqueSequence; public class CommandPackage extends SingleLineCommand2 { @@ -66,9 +68,13 @@ public class CommandPackage extends SingleLineCommand2 { new RegexLeaf("[%s]*"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("[%s]*\\{$")); } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } @Override protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, RegexResult arg) { @@ -107,10 +113,13 @@ public class CommandPackage extends SingleLineCommand2 { p.addUrl(url); } - final String color = arg.get("COLOR", 0); - if (color != null) { - p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); - } + final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + p.setColors(colors); + +// final String color = arg.get("COLOR", 0); +// if (color != null) { +// p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); +// } return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java index dba91b341..6e1d67f33 100644 --- a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java +++ b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java @@ -35,13 +35,14 @@ package net.sourceforge.plantuml.command; import java.util.List; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; -import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.utils.UniqueSequence; public class CommandPackageEmpty extends SingleLineCommand { @@ -72,7 +73,7 @@ public class CommandPackageEmpty extends SingleLineCommand { @@ -128,7 +129,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma private CommandExecutionResult executeInternal(ActivityDiagram diagram, RegexResult arg, IEntity note) { - note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); IEntity activity = diagram.getLastEntityConsulted(); if (activity == null) { diff --git a/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java b/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java index c4dc88fb7..f38ecd96a 100644 --- a/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java +++ b/src/net/sourceforge/plantuml/command/note/FactoryNoteCommand.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; public final class FactoryNoteCommand implements SingleMultiFactoryCommand { @@ -108,7 +109,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand { @@ -78,13 +80,17 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), // new RegexLeaf("")), // new RegexLeaf("[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("[%s]*:[%s]*"), // new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("$") // ); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + private RegexConcat getRegexConcatMultiLine(IRegex partialPattern, final boolean withBracket) { return new RegexConcat(new RegexLeaf("^note[%s]+"), // new RegexLeaf("POSITION", "(right|left|top|bottom)"), // @@ -92,7 +98,7 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), // new RegexLeaf("")), // new RegexLeaf("[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf(withBracket ? "[%s]*\\{" : "[%s]*"), // new RegexLeaf("$") // ); @@ -160,7 +166,12 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma final IEntity note = diagram .createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null); - note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); + + Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); + // System.err.println("colors=" + colors); + // note.setSpecificColorTOBEREMOVED(ColorType.BACK, + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); + note.setColors(colors); if (url != null) { note.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java b/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java index 2633b30ad..cb1645611 100644 --- a/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java +++ b/src/net/sourceforge/plantuml/command/note/FactoryNoteOnLinkCommand.java @@ -50,6 +50,8 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand { @@ -57,7 +59,7 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand return new RegexConcat(new RegexLeaf("^note[%s]+"), // new RegexLeaf("POSITION", "(right|left|top|bottom)?[%s]*on[%s]+link"), // new RegexLeaf("[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("[%s]*:[%s]*"), // new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("$")); @@ -67,10 +69,14 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand return new RegexConcat(new RegexLeaf("^note[%s]+"), // new RegexLeaf("POSITION", "(right|left|top|bottom)?[%s]*on[%s]+link"), // new RegexLeaf("[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("$")); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + public Command createMultiLine(boolean withBracket) { return new CommandMultilines2(getRegexConcatMultiLine(), MultilinesStrategy.KEEP_STARTING_QUOTE) { @@ -121,8 +127,8 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand if (url != null) { note = note.subExtract(1, 0); } - link.addNote(note.toDisplay(), position, - diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + link.addNote(note.toDisplay(), position, colors); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java index 3d64a231c..eb2c6a2a3 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.sequencediagram.Note; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteStyle; @@ -115,7 +116,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma if (strings.size() > 0) { final boolean tryMerge = arg.get("VMERGE", 0) != null; final Note note = new Note(p, position, strings.toDisplay()); - note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); note.setStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0))); diagram.addNote(note, tryMerge); } diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java index 05c5e0db8..f7d8edc13 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.sequencediagram.Note; import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.Participant; @@ -118,7 +119,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF if (lines.size() > 0) { final boolean tryMerge = line0.get("VMERGE", 0) != null; final Note note = new Note(p1, p2, lines.toDisplay()); - note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); + note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0))); diagram.addNote(note, tryMerge); } diff --git a/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java b/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java index c5354d1e1..12747d1c0 100644 --- a/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java +++ b/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java @@ -54,6 +54,11 @@ public class RegexLeaf implements IRegex { this.name = name; } + @Override + public String toString() { + return super.toString() + " " + name + " " + pattern; + } + public String getName() { return name; } diff --git a/src/net/sourceforge/plantuml/creole/AtomImg.java b/src/net/sourceforge/plantuml/creole/AtomImg.java index 32dd81686..1d0925aa7 100644 --- a/src/net/sourceforge/plantuml/creole/AtomImg.java +++ b/src/net/sourceforge/plantuml/creole/AtomImg.java @@ -48,6 +48,7 @@ import javax.imageio.ImageIO; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileSystem; +import net.sourceforge.plantuml.code.Base64Coder; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.ImgValign; @@ -58,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.UImage; public class AtomImg implements Atom { + private static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,"; private final BufferedImage image; private AtomImg(BufferedImage image) { @@ -66,18 +68,25 @@ public class AtomImg implements Atom { public static Atom create(String src, final ImgValign valign, final int vspace) { final UFont font = new UFont("Monospaced", Font.PLAIN, 14); - final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + final FontConfiguration fc = FontConfiguration.blackBlueTrue(font); + + if (src.startsWith(DATA_IMAGE_PNG_BASE64)) { + final String data = src.substring(DATA_IMAGE_PNG_BASE64.length(), src.length()); + try { + final byte bytes[] = Base64Coder.decode(data); + return build(src, fc, bytes); + } catch (Exception e) { + return AtomText.create("ERROR " + e.toString(), fc); + } + + } try { final File f = FileSystem.getInstance().getFile(src); if (f.exists() == false) { // Check if valid URL if (src.startsWith("http:") || src.startsWith("https:")) { final byte image[] = getFile(src); - final BufferedImage read = ImageIO.read(new ByteArrayInputStream(image)); - if (read == null) { - return AtomText.create("(Cannot decode: " + src + ")", fc); - } - return new AtomImg(read); + return build(src, fc, image); } return AtomText.create("(File not found: " + f + ")", fc); } @@ -95,6 +104,14 @@ public class AtomImg implements Atom { } } + private static Atom build(String source, final FontConfiguration fc, final byte[] data) throws IOException { + final BufferedImage read = ImageIO.read(new ByteArrayInputStream(data)); + if (read == null) { + return AtomText.create("(Cannot decode: " + source + ")", fc); + } + return new AtomImg(read); + } + // Added by Alain Corbiere static byte[] getFile(String host) throws IOException { final ByteArrayOutputStream image = new ByteArrayOutputStream(); diff --git a/src/net/sourceforge/plantuml/creole/AtomText.java b/src/net/sourceforge/plantuml/creole/AtomText.java index e3eef09d7..0c18bf0f2 100644 --- a/src/net/sourceforge/plantuml/creole/AtomText.java +++ b/src/net/sourceforge/plantuml/creole/AtomText.java @@ -158,7 +158,15 @@ public class AtomText implements Atom { } private double getTabSize(StringBounder stringBounder) { - return stringBounder.calculateDimension(fontConfiguration.getFont(), " ").getWidth(); + return stringBounder.calculateDimension(fontConfiguration.getFont(), tabString()).getWidth(); + } + + private String tabString() { + final int nb = fontConfiguration.getTabSize(); + if (nb >= 1 && nb < 7) { + return " ".substring(0, nb); + } + return " "; } public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/creole/PSystemCreole.java b/src/net/sourceforge/plantuml/creole/PSystemCreole.java index 5a0b054b0..fc3a3af98 100644 --- a/src/net/sourceforge/plantuml/creole/PSystemCreole.java +++ b/src/net/sourceforge/plantuml/creole/PSystemCreole.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; @@ -70,13 +69,13 @@ public class PSystemCreole extends AbstractPSystem { public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final Display display = Display.create(lines); final UFont font = new UFont("Serif", Font.PLAIN, 14); - final FontConfiguration fontConfiguration = new FontConfiguration(font, HtmlColorUtils.BLACK, - HtmlColorUtils.BLUE, true); + final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font); final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.FULL) .createSheet(display); final SheetBlock1 sheetBlock = new SheetBlock1(sheet, 0, 0); - final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null, false); + final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null, + false); builder.addUDrawable(sheetBlock); return builder.writeImageTOBEMOVED(fileFormat, os); diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java index 542706a54..01c3a3099 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java @@ -77,8 +77,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock { this.skinParam = skinParam; this.manageUrl = true; - this.titleConfig = new FontConfiguration(skinParam.getFont(fontParam, null, false), new Rose().getFontColor( - skinParam, fontParam), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); + this.titleConfig = new FontConfiguration(skinParam, fontParam, null); this.lineFirst = true; this.align = HorizontalAlignment.LEFT; this.manageHorizontalLine = true; @@ -145,7 +144,8 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock { } members = new ArrayList(); final List allTree = buildAllTree(s, it); - final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam), align, skinParam, CreoleMode.FULL); + final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam), align, + skinParam, CreoleMode.FULL); blocks.add(bloc); } else { final Member m = new MemberImpl(s, MemberImpl.isMethod(s), manageModifier, manageUrl); diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java index d9ab5a8c3..be8600f6f 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java +++ b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java @@ -46,6 +46,8 @@ import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.SingleStrategy; @@ -126,16 +128,6 @@ public class GroupRoot implements IGroup { } - public HtmlColor getSpecificBackColor() { - throw new UnsupportedOperationException(); - - } - - public void setSpecificBackcolor(HtmlColor specificBackcolor) { - throw new UnsupportedOperationException(); - - } - public IGroup getParentContainer() { return null; } @@ -212,22 +204,6 @@ public class GroupRoot implements IGroup { return false; } - public HtmlColor getSpecificLineColor() { - return null; - } - - public void setSpecificLineColor(HtmlColor specificLinecolor) { - throw new UnsupportedOperationException(); - } - - public UStroke getSpecificLineStroke() { - return null; - } - - public void setSpecificLineStroke(UStroke specificLineStoke) { - throw new UnsupportedOperationException(); - } - public boolean hasUrl() { return false; } @@ -268,4 +244,28 @@ public class GroupRoot implements IGroup { throw new UnsupportedOperationException(); } + public Colors getColors(ISkinParam skinParam) { + return Colors.empty(); + } + + public void setColors(Colors colors) { + throw new UnsupportedOperationException(); + } + + public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + throw new UnsupportedOperationException(); + } + + public void setSpecificLineStroke(UStroke specificLineStroke) { + throw new UnsupportedOperationException(); + } + + public void applyStroke(String s) { + throw new UnsupportedOperationException(); + } + + public void applyStroke(Colors colors) { + throw new UnsupportedOperationException(); + } + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/IEntity.java b/src/net/sourceforge/plantuml/cucadiagram/IEntity.java index 54a5232eb..02dd83ae5 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/IEntity.java +++ b/src/net/sourceforge/plantuml/cucadiagram/IEntity.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.Removeable; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.Colors; public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, LineConfigurable { @@ -86,4 +87,7 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li public Map getTips(); + @Deprecated + public void applyStroke(String s); + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Link.java b/src/net/sourceforge/plantuml/cucadiagram/Link.java index bb192c84c..4492e6aa9 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Link.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Link.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16541 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.cucadiagram; @@ -45,11 +45,10 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; 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.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbolInterface; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.utils.UniqueSequence; @@ -67,7 +66,7 @@ public class Link implements Hideable, Removeable { private Display note; private Position notePosition; - private HtmlColor noteColor; + private Colors noteColors; private boolean invis = false; private double weight = 1.0; @@ -298,25 +297,25 @@ public class Link implements Hideable, Removeable { return note; } - public final HtmlColor getNoteColor() { - return noteColor; + public final Colors getNoteColors() { + return noteColors; } public final Position getNotePosition() { return notePosition; } - public final void addNote(Display note, Position position, HtmlColor noteColor) { + public final void addNote(Display note, Position position, Colors colors) { this.note = note; this.notePosition = position; - this.noteColor = noteColor; + this.noteColors = colors; } - public final void addNote(String n, Position position, HtmlColor noteColor) { - this.note = Display.getWithNewlines(n); - this.notePosition = position; - this.noteColor = noteColor; - } + // public final void addNote(String n, Position position, Colors colors) { + // this.note = Display.getWithNewlines(n); + // this.notePosition = position; + // this.noteColors = colors; + // } public boolean isAutoLinkOfAGroup() { if (getEntity1().isGroup() == false) { @@ -370,8 +369,7 @@ public class Link implements Hideable, Removeable { private double getQualifierMargin(StringBounder stringBounder, UFont fontQualif, String qualif, ISkinSimple spriteContainer) { if (qualif != null) { - final TextBlock b = Display.create(qualif).create( - new FontConfiguration(fontQualif, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), + final TextBlock b = Display.create(qualif).create(FontConfiguration.blackBlueTrue(fontQualif), HorizontalAlignment.LEFT, spriteContainer); final Dimension2D dim = b.calculateDimension(stringBounder); return Math.max(dim.getWidth(), dim.getHeight()); @@ -495,4 +493,14 @@ public class Link implements Hideable, Removeable { this.sametail = sametail; } + private Colors colors; + + public void setColors(Colors colors) { + this.colors = colors; + } + + public final Colors getColors() { + return colors; + } + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java b/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java index b9308be68..44fcbe69e 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkStyle.java @@ -33,10 +33,27 @@ */ package net.sourceforge.plantuml.cucadiagram; +import net.sourceforge.plantuml.ugraphic.UStroke; + public enum LinkStyle { NORMAL, DASHED, DOTTED, BOLD, INVISIBLE, DOUBLE_tobedone, __toremove_INTERFACE_PROVIDER, __toremove_INTERFACE_USER; + + public static UStroke getStroke(LinkStyle style) { + if (style == LinkStyle.DASHED) { + return new UStroke(6, 6, 1); + } + if (style == LinkStyle.DOTTED) { + return new UStroke(1, 3, 1); + } + if (style == LinkStyle.BOLD) { + return new UStroke(2.5); + } + return new UStroke(); + } + + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index 7baf38b66..392ef88c7 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -69,7 +69,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW return new TextBlockLineBefore(TextBlockUtils.withMargin(this, 6, 4)); } - private final UFont font; + private final FontParam fontParam; private final ISkinParam skinParam; private final HtmlColor color; private final HtmlColor hyperlinkColor; @@ -86,7 +86,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW HorizontalAlignment align) { this.align = align; this.skinParam = skinParam; - this.font = skinParam.getFont(fontParam, null, false); + this.fontParam = fontParam; this.color = rose.getFontColor(skinParam, fontParam); this.hyperlinkColor = skinParam.getHyperlinkColor(); this.useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink(); @@ -128,7 +128,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW if (withVisibilityChar && s.startsWith("#")) { s = CharHidder.addTileAtBegin(s); } - FontConfiguration config = new FontConfiguration(font, color, hyperlinkColor, useUnderlineForHyperlink); + FontConfiguration config = new FontConfiguration(skinParam, fontParam, null); if (m.isAbstract()) { config = config.italic(); } @@ -164,7 +164,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW final Dimension2D dim = bloc.calculateDimension(stringBounder); return dim; } - + @Override public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) { return bloc.getInnerPosition(member, stringBounder); diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java index c32790629..1ccb63ce1 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java +++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java @@ -41,6 +41,7 @@ import java.util.List; import java.util.Map; import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Bodier; @@ -59,10 +60,11 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.SingleStrategy; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.utils.UniqueSequence; final class EntityImpl implements ILeaf, IGroup { @@ -94,15 +96,11 @@ final class EntityImpl implements ILeaf, IGroup { private boolean autonom = true; // Other - - private HtmlColor specificBackcolor; private boolean nearDecoration = false; private int xposition; private IEntityImage svekImage; private boolean removed = false; - private HtmlColor specificLineColor; - private UStroke specificStroke; private USymbol symbol; private final int rawLayout; private char concurrentSeparator; @@ -211,14 +209,6 @@ final class EntityImpl implements ILeaf, IGroup { return code + " " + display + "(" + leafType + ") " + xposition + " " + getUid(); } - public HtmlColor getSpecificBackColor() { - return specificBackcolor; - } - - public void setSpecificBackcolor(HtmlColor color) { - this.specificBackcolor = color; - } - public final Url getUrl99() { return url; } @@ -512,22 +502,6 @@ final class EntityImpl implements ILeaf, IGroup { this.removed = removed; } - public HtmlColor getSpecificLineColor() { - return specificLineColor; - } - - public void setSpecificLineColor(HtmlColor specificLinecolor) { - this.specificLineColor = specificLinecolor; - } - - public UStroke getSpecificLineStroke() { - return specificStroke; - } - - public void setSpecificLineStroke(UStroke specificLineStroke) { - this.specificStroke = specificLineStroke; - } - private int layer; public int getHectorLayer() { @@ -584,4 +558,35 @@ final class EntityImpl implements ILeaf, IGroup { return Collections.unmodifiableMap(tips); } + private Colors colors = Colors.empty(); + + public Colors getColors(ISkinParam skinParam) { + return colors; + } + + public void setColors(Colors colors) { + this.colors = colors; + } + + public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + if (color != null) { + this.colors = colors.add(type, color); + } + } + +// public void setSpecificLineStroke(UStroke specificLineStroke) { +// colors = colors.addSpecificLineStroke(specificLineStroke); +// } + + @Deprecated + public void applyStroke(String s) { + throw new UnsupportedOperationException(); +// if (s == null) { +// return; +// } +// final LinkStyle style = LinkStyle.valueOf(StringUtils.goUpperCase(s)); +// colors = colors.addSpecificLineStroke(style); +// // setSpecificLineStroke(LinkStyle.getStroke(style)); + } + } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index bddf2f758..4937be997 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -50,8 +50,11 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.descdiagram.DescriptionDiagram; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; public class CommandCreateElementFull extends SingleLineCommand2 { @@ -87,9 +90,14 @@ public class CommandCreateElementFull extends SingleLineCommand2 { @@ -151,7 +152,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2 { @@ -83,9 +87,17 @@ public class CommandLinkElement extends SingleLineCommand2 { new RegexLeaf("[%s]*"), // getGroup("ENT2"), // new RegexLeaf("[%s]*"), // + color().getRegex(), // + new RegexLeaf("[%s]*"), // + new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), // + new RegexLeaf("[%s]*"), // new RegexLeaf("LABEL_LINK", "(?::[%s]*(.+))?$")); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.LINE); + } + private LinkType getLinkType(RegexResult arg) { final String head1 = trimAndLowerCase(arg.get("HEAD1", 0)); final String head2 = trimAndLowerCase(arg.get("HEAD2", 0)); @@ -186,7 +198,7 @@ public class CommandLinkElement extends SingleLineCommand2 { private static RegexLeaf getGroup(String name) { return new RegexLeaf( name, - "([\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|(?!\\[\\*\\])\\[[^\\[\\]]+\\]|\\((?!\\*\\))[^)]+\\))(?:[%s]*(\\<\\<.*\\>\\>))?"); + "([\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|(?!\\[\\*\\])\\[[^\\[\\]]+\\]|\\((?!\\*\\))[^)]+\\))"); } static class Labels { @@ -213,7 +225,8 @@ public class CommandLinkElement extends SingleLineCommand2 { final Matcher m1 = p1.matcher(labelLink); if (m1.matches()) { firstLabel = m1.group(1); - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m1.group(2)))); + labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils + .trin(m1.group(2)))); secondLabel = m1.group(3); return; } @@ -221,7 +234,8 @@ public class CommandLinkElement extends SingleLineCommand2 { final Matcher m2 = p2.matcher(labelLink); if (m2.matches()) { firstLabel = m2.group(1); - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m2.group(2)))); + labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils + .trin(m2.group(2)))); secondLabel = null; return; } @@ -229,7 +243,8 @@ public class CommandLinkElement extends SingleLineCommand2 { final Matcher m3 = p3.matcher(labelLink); if (m3.matches()) { firstLabel = null; - labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m3.group(1)))); + labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils + .trin(m3.group(1)))); secondLabel = m3.group(2); } } @@ -244,21 +259,18 @@ public class CommandLinkElement extends SingleLineCommand2 { if (diagram.isGroup(ent1) && diagram.isGroup(ent2)) { return executePackageLink(diagram, arg); } - // if (diagram.isGroup(ent1) || diagram.isGroup(ent2)) { - // return CommandExecutionResult.error("Package can be only linked to other package"); - // } final IEntity cl1 = diagram.isGroup(ent1) ? diagram.getGroup(Code.of(arg.get("ENT1", 0))) : getOrCreateLeaf( diagram, ent1); final IEntity cl2 = diagram.isGroup(ent2) ? diagram.getGroup(Code.of(arg.get("ENT2", 0))) : getOrCreateLeaf( diagram, ent2); - if (arg.get("ENT1", 1) != null) { - cl1.setStereotype(new Stereotype(arg.get("ENT1", 1))); - } - if (arg.get("ENT2", 1) != null) { - cl2.setStereotype(new Stereotype(arg.get("ENT2", 1))); - } + // if (arg.get("ENT1", 1) != null) { + // cl1.setStereotype(new Stereotype(arg.get("ENT1", 1))); + // } + // if (arg.get("ENT2", 1) != null) { + // cl2.setStereotype(new Stereotype(arg.get("ENT2", 1))); + // } final LinkType linkType = getLinkType(arg); final Direction dir = getDirection(arg); @@ -277,7 +289,14 @@ public class CommandLinkElement extends SingleLineCommand2 { if (dir == Direction.LEFT || dir == Direction.UP) { link = link.getInv(); } - CommandLinkClass.applyStyle(arg.getLazzy("ARROW_STYLE", 0), link); + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + colors = CommandLinkClass.applyStyle(arg.getLazzy("ARROW_STYLE", 0), link, colors); + if (arg.get("STEREOTYPE", 0) != null) { + final Stereotype stereotype = new Stereotype(arg.get("STEREOTYPE", 0)); + colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.componentArrow); + } + + link.setColors(colors); diagram.addLink(link); return CommandExecutionResult.ok(); } @@ -285,9 +304,8 @@ public class CommandLinkElement extends SingleLineCommand2 { private ILeaf getOrCreateLeaf(DescriptionDiagram diagram, final Code code2) { final String code = code2.getFullName(); if (code.startsWith("()")) { - return diagram.getOrCreateLeaf( - Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(code.substring(2)))), - LeafType.DESCRIPTION, USymbol.INTERFACE); + return diagram.getOrCreateLeaf(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils + .trin(code.substring(2)))), LeafType.DESCRIPTION, USymbol.INTERFACE); } final char codeChar = code.length() > 2 ? code.charAt(0) : 0; if (codeChar == '(') { diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java index 0afb41665..42fcceaa0 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.utils.UniqueSequence; public class CommandPackageWithUSymbol extends SingleLineCommand2 { @@ -99,7 +100,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2 geometries; Tile(int num) { diff --git a/src/net/sourceforge/plantuml/graph/Elastane.java b/src/net/sourceforge/plantuml/graph/Elastane.java index 8830bff48..bbca52278 100644 --- a/src/net/sourceforge/plantuml/graph/Elastane.java +++ b/src/net/sourceforge/plantuml/graph/Elastane.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.graph; @@ -269,7 +269,9 @@ public class Elastane { final String label = l.getLabel().get(0).toString(); if (label != null) { // polyline.getFirst().getCenter(); - final TextBlock textBlock = Display.create(label).create(new FontConfiguration(UFont.getCurrentFont(g2d), HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock textBlock = Display.create(label).create( + FontConfiguration.blackBlueTrue(UFont.getCurrentFont(g2d)), HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); textBlock.calculateDimension(StringBounderUtils.asStringBounder(g2d)); // textBlock.drawTOBEREMOVED(new ColorMapperIdentity(), g2d, center.getXint() - dim.getWidth() / 2, // center.getYint() - dim.getHeight() / 2); diff --git a/src/net/sourceforge/plantuml/graph/EntityImageActivity.java b/src/net/sourceforge/plantuml/graph/EntityImageActivity.java index 623e31306..1fbe1f78f 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageActivity.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageActivity.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.graph; @@ -59,8 +59,8 @@ class EntityImageActivity extends AbstractEntityImage { public EntityImageActivity(IEntity entity) { super(entity); - this.text = entity.getDisplay().create(new FontConfiguration(getFont14(), - HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty()); + this.text = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()), + HorizontalAlignment.CENTER, new SpriteContainerEmpty()); } @Override @@ -97,7 +97,7 @@ class EntityImageActivity extends AbstractEntityImage { g2d.draw(p); // g2d.drawRect(0, 0, width - 1, height - 1); g2d.setColor(Color.BLACK); -// text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin); + // text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin); } } diff --git a/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java b/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java index 7d1eedc91..324510a2d 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageCircleInterface.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.graph; @@ -38,11 +38,9 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.skin.CircleInterface; @@ -55,8 +53,8 @@ class EntityImageCircleInterface extends AbstractEntityImage { public EntityImageCircleInterface(IEntity entity) { super(entity); - this.name = entity.getDisplay().create(new FontConfiguration(getFont14(), - HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty()); + this.name = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()), + HorizontalAlignment.CENTER, new SpriteContainerEmpty()); this.circleInterface = new CircleInterface(getYellow(), getRed()); } diff --git a/src/net/sourceforge/plantuml/graph/EntityImageDefault.java b/src/net/sourceforge/plantuml/graph/EntityImageDefault.java index fa2b8b678..c8fcc36cd 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageDefault.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageDefault.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.graph; @@ -39,11 +39,9 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounderUtils; import net.sourceforge.plantuml.graphic.TextBlock; @@ -55,8 +53,8 @@ class EntityImageDefault extends AbstractEntityImage { public EntityImageDefault(IEntity entity) { super(entity); - this.textBlock = entity.getDisplay().create(new FontConfiguration(getFont14(), HtmlColorUtils.BLACK, - HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty()); + this.textBlock = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()), + HorizontalAlignment.CENTER, new SpriteContainerEmpty()); } @Override @@ -72,6 +70,6 @@ class EntityImageDefault extends AbstractEntityImage { final int height = (int) dim.getHeight(); g2d.setColor(Color.BLACK); g2d.drawRect(0, 0, width, height); -// textBlock.drawTOBEREMOVED(colorMapper, g2d, 0, 0); + // textBlock.drawTOBEREMOVED(colorMapper, g2d, 0, 0); } } diff --git a/src/net/sourceforge/plantuml/graph/EntityImageNote.java b/src/net/sourceforge/plantuml/graph/EntityImageNote.java index 76db85b0e..8850e25b9 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageNote.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17128 $ * */ package net.sourceforge.plantuml.graph; @@ -40,11 +40,9 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounderUtils; import net.sourceforge.plantuml.graphic.TextBlock; @@ -59,8 +57,8 @@ class EntityImageNote extends AbstractEntityImage { public EntityImageNote(IEntity entity) { super(entity); - this.text = entity.getDisplay().create(new FontConfiguration(getFont14(), - HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty()); + this.text = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()), + HorizontalAlignment.CENTER, new SpriteContainerEmpty()); } @Override @@ -92,7 +90,7 @@ class EntityImageNote extends AbstractEntityImage { g2d.drawLine(width - xMargin, yMargin, width, yMargin); g2d.setColor(Color.BLACK); -// text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin); + // text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin); } } diff --git a/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java b/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java index c3c89e850..3ce880d6e 100644 --- a/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java +++ b/src/net/sourceforge/plantuml/graph/EntityImageUsecase.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.graph; @@ -57,8 +57,8 @@ class EntityImageUsecase extends AbstractEntityImage { public EntityImageUsecase(IEntity entity) { super(entity); - this.name = entity.getDisplay().create(new FontConfiguration(getFont14(), - HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty()); + this.name = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()), + HorizontalAlignment.CENTER, new SpriteContainerEmpty()); } @Override @@ -93,9 +93,9 @@ class EntityImageUsecase extends AbstractEntityImage { g2d.setColor(colorMapper.getMappedColor(getRed())); g2d.draw(ellipse); -// final Dimension2D nameDim = name.calculateDimension(StringBounderUtils.asStringBounder(g2d)); -// final double posx = (w - nameDim.getWidth()) / 2; -// final double posy = (h - nameDim.getHeight()) / 2; + // final Dimension2D nameDim = name.calculateDimension(StringBounderUtils.asStringBounder(g2d)); + // final double posx = (w - nameDim.getWidth()) / 2; + // final double posy = (h - nameDim.getHeight()) / 2; // final Shape rect = new Rectangle2D.Double(posx, posy, nameDim.getWidth(), nameDim.getHeight()); // g2d.draw(rect); diff --git a/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java index b92324281..6e9576e39 100644 --- a/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/graph/MethodsOrFieldsArea.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.graph; @@ -81,7 +81,8 @@ public class MethodsOrFieldsArea { } private TextBlock createTextBlock(String s) { - return Display.create(s).create(new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + return Display.create(s).create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); } public void draw(UGraphic ug, double x, double y) { diff --git a/src/net/sourceforge/plantuml/graphic/DateEventUtils.java b/src/net/sourceforge/plantuml/graphic/DateEventUtils.java index e28656769..9d567f88e 100644 --- a/src/net/sourceforge/plantuml/graphic/DateEventUtils.java +++ b/src/net/sourceforge/plantuml/graphic/DateEventUtils.java @@ -96,8 +96,9 @@ public class DateEventUtils { private static TextBlock getComment(final List asList, HtmlColor color) { final UFont font = new UFont("SansSerif", Font.BOLD, 14); - TextBlock comment = Display.create(asList).create(new FontConfiguration(font, color, - HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + TextBlock comment = Display.create(asList).create( + new FontConfiguration(font, color, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); comment = TextBlockUtils.withMargin(comment, 4, 4); comment = new TextBlockBordered(comment, color); comment = TextBlockUtils.withMargin(comment, 10, 10); diff --git a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java index 9ad78ea29..0270d5423 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: 15932 $ + * Revision $Revision: 17124 $ * */ package net.sourceforge.plantuml.graphic; @@ -40,6 +40,8 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.UFont; public class FontConfiguration { @@ -55,19 +57,29 @@ public class FontConfiguration { private final SvgAttributes svgAttributes; private final boolean hyperlink; private final boolean useUnderlineForHyperlink; + private final int tabSize; public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { + this(font, color, hyperlinkColor, useUnderlineForHyperlink, 8); + } + + public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, + int tabSize) { this(getStyles(font), font, color, font, color, null, FontPosition.NORMAL, new SvgAttributes(), false, - hyperlinkColor, useUnderlineForHyperlink); + hyperlinkColor, useUnderlineForHyperlink, tabSize); + } + + public static FontConfiguration blackBlueTrue(UFont font) { + return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true, 8); } public FontConfiguration(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { this(SkinParamUtils.getFont(skinParam, fontParam, stereo), SkinParamUtils.getFontColor(skinParam, fontParam, - stereo), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); + stereo), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); } - - //--- - + + // --- + public final boolean useUnderlineForHyperlink() { return useUnderlineForHyperlink; } @@ -76,7 +88,7 @@ public class FontConfiguration { return hyperlinkColor; } - //--- + // --- private static EnumSet getStyles(UFont font) { final boolean bold = font.isBold(); @@ -100,7 +112,7 @@ public class FontConfiguration { private FontConfiguration(EnumSet styles, UFont motherFont, HtmlColor motherColor, UFont currentFont, HtmlColor currentColor, HtmlColor extendedColor, FontPosition fontPosition, SvgAttributes svgAttributes, - boolean hyperlink, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) { + boolean hyperlink, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) { this.styles = styles; this.currentFont = currentFont; this.motherFont = motherFont; @@ -112,6 +124,7 @@ public class FontConfiguration { this.hyperlink = hyperlink; this.hyperlinkColor = hyperlinkColor; this.useUnderlineForHyperlink = useUnderlineForHyperlink; + this.tabSize = tabSize; } public FontConfiguration forceFont(UFont newFont, HtmlColor htmlColorForStereotype) { @@ -119,7 +132,8 @@ public class FontConfiguration { return add(FontStyle.ITALIC); } FontConfiguration result = new FontConfiguration(styles, newFont, motherColor, newFont, currentColor, - extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink); + extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, + tabSize); if (htmlColorForStereotype != null) { result = result.changeColor(htmlColorForStereotype); } @@ -128,27 +142,40 @@ public class FontConfiguration { public FontConfiguration changeAttributes(SvgAttributes toBeAdded) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, extendedColor, - fontPosition, svgAttributes.add(toBeAdded), hyperlink, hyperlinkColor, useUnderlineForHyperlink); + fontPosition, svgAttributes.add(toBeAdded), hyperlink, hyperlinkColor, useUnderlineForHyperlink, + tabSize); } private FontConfiguration withHyperlink() { return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, extendedColor, - fontPosition, svgAttributes, true, hyperlinkColor, useUnderlineForHyperlink); + fontPosition, svgAttributes, true, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public FontConfiguration changeColor(HtmlColor htmlColor) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, htmlColor, extendedColor, - fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink); + fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); + } + + public FontConfiguration mute(Colors colors) { + if (colors == null) { + throw new IllegalArgumentException(); + } + final HtmlColor color = colors.getColor(ColorType.TEXT); + if (color == null) { + return this; + } + return changeColor(color); } FontConfiguration changeExtendedColor(HtmlColor newExtendedColor) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, newExtendedColor, - fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink); + fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public FontConfiguration changeSize(float size) { return new FontConfiguration(styles, motherFont, motherColor, currentFont.deriveSize(size), currentColor, - extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink); + extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, + tabSize); } public FontConfiguration bigger(double delta) { @@ -157,25 +184,25 @@ public class FontConfiguration { public FontConfiguration changeFontPosition(FontPosition fontPosition) { return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, extendedColor, - fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink); + fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public FontConfiguration changeFamily(String family) { return new FontConfiguration(styles, motherFont, motherColor, new UFont(family, currentFont.getStyle(), currentFont.getSize()), currentColor, extendedColor, fontPosition, svgAttributes, hyperlink, - hyperlinkColor, useUnderlineForHyperlink); + hyperlinkColor, useUnderlineForHyperlink, tabSize); } public FontConfiguration resetFont() { return new FontConfiguration(styles, motherFont, motherColor, motherFont, motherColor, null, - FontPosition.NORMAL, new SvgAttributes(), hyperlink, hyperlinkColor, useUnderlineForHyperlink); + FontPosition.NORMAL, new SvgAttributes(), hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } FontConfiguration add(FontStyle style) { final EnumSet r = styles.clone(); r.add(style); return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor, - fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink); + fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public FontConfiguration italic() { @@ -201,7 +228,7 @@ public class FontConfiguration { final EnumSet r = styles.clone(); r.remove(style); return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor, - fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink); + fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public UFont getFont() { @@ -239,4 +266,8 @@ public class FontConfiguration { return currentFont.getSize2D(); } + public int getTabSize() { + return tabSize; + } + } diff --git a/src/net/sourceforge/plantuml/graphic/GraphicStrings.java b/src/net/sourceforge/plantuml/graphic/GraphicStrings.java index 395ff5dff..a05965484 100644 --- a/src/net/sourceforge/plantuml/graphic/GraphicStrings.java +++ b/src/net/sourceforge/plantuml/graphic/GraphicStrings.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17072 $ * */ package net.sourceforge.plantuml.graphic; @@ -61,7 +61,7 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage { private final HtmlColor green; private final HtmlColor hyperlinkColor = HtmlColorUtils.BLUE; - + private final boolean useUnderlineForHyperlink = true; private final List strings; @@ -110,11 +110,15 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage { private TextBlock getTextBlock() { TextBlock result = null; if (maxLine == 0) { - result = Display.create(strings).create(new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + result = Display.create(strings).create( + new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); } else { for (int i = 0; i < strings.size(); i += maxLine) { final int n = Math.min(i + maxLine, strings.size()); - final TextBlock textBlock1 = Display.create(strings.subList(i, n)).create(new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock textBlock1 = Display.create(strings.subList(i, n)).create( + new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); if (result == null) { result = textBlock1; } else { diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java b/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java index c2c99c603..510a48e7b 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java +++ b/src/net/sourceforge/plantuml/graphic/HtmlColorSetSimple.java @@ -245,6 +245,9 @@ public class HtmlColorSetSimple implements IHtmlColorSet { final Color color; if (s.equalsIgnoreCase("transparent")) { return new HtmlColorTransparent(); + } else if (s.matches("[0-9A-Fa-f]{3}")) { + s = "" + s.charAt(0) + s.charAt(0) + s.charAt(1) + s.charAt(1) + s.charAt(2) + s.charAt(2); + color = new Color(Integer.parseInt(s, 16)); } else if (s.matches("[0-9A-Fa-f]{6}")) { color = new Color(Integer.parseInt(s, 16)); } else { @@ -259,6 +262,9 @@ public class HtmlColorSetSimple implements IHtmlColorSet { private boolean isValid(String s, boolean acceptTransparent) { s = removeFirstDieseAndgoLowerCase(s); + if (s.matches("[0-9A-Fa-f]{3}")) { + return true; + } if (s.matches("[0-9A-Fa-f]{6}")) { return true; } diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java index e67f07082..c6f833abf 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.graphic.USymbol.Margin; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UShape; @@ -48,7 +49,6 @@ class USymbolComponent2 extends USymbol { return SkinParameter.COMPONENT2; } - private void drawNode(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing) { final URectangle form = new URectangle(widthTotal, heightTotal); @@ -72,7 +72,8 @@ class USymbolComponent2 extends USymbol { return new Margin(10 + 5, 20 + 5, 15 + 5, 5 + 5); } - public TextBlock asSmall(TextBlock name, final TextBlock label, TextBlock stereotype, final SymbolContext symbolContext) { + public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, + final SymbolContext symbolContext) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { @@ -80,12 +81,16 @@ class USymbolComponent2 extends USymbol { ug = symbolContext.apply(ug); drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); final Margin margin = getMargin(); - label.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); + + final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); + tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); + // label.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); } public Dimension2D calculateDimension(StringBounder stringBounder) { - final Dimension2D dim = label.calculateDimension(stringBounder); - return getMargin().addDimension(dim); + final Dimension2D dimLabel = label.calculateDimension(stringBounder); + final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); + return getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel)); } }; } diff --git a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java index 231218a45..b36236ec7 100644 --- a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java +++ b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java @@ -42,24 +42,57 @@ public class ColorParser { private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+"; + private static final String PART2 = "#(?:\\w+[-\\\\|/]?\\w+;)?(?:(?:text|back|header|line|line\\.dashed|line\\.dotted|line\\.bold)(?::\\w+[-\\\\|/]?\\w+)?(?:;|(?![\\w;:.])))+"; + private static final String COLORS_REGEXP = "(?:" + COLOR_REGEXP + ")|(?:" + PART2 + ")"; + private final RegexLeaf regex; private final String name; + private final ColorType mainType; - private ColorParser(String name, RegexLeaf regex) { + private ColorParser(String name, RegexLeaf regex, ColorType mainType) { this.regex = regex; this.name = name; + this.mainType = mainType; } - public HtmlColor getColor(RegexResult arg, IHtmlColorSet set) { - return set.getColorIfValid(arg.get("COLOR", 0)); + public HtmlColor getLegacyColoe(RegexResult arg, IHtmlColorSet set) { + if (mainType != null) { + throw new IllegalStateException(); + } + final String data = arg.get("COLOR", 0); + if (data != null && data.matches(PART2)) { + throw new IllegalStateException(); + } + final HtmlColor result = set.getColorIfValid(data); + return result; } + public Colors getColor(RegexResult arg, IHtmlColorSet set) { + if (mainType == null) { + throw new IllegalStateException(); + } + final String data = arg.get(name, 0); + if (data == null) { + return Colors.empty(); + } + return new Colors(data, set, mainType); + // return result.getColor(type); + } + + // New Parsers + public static ColorParser simpleColor(ColorType mainType) { + return new ColorParser("COLOR", new RegexLeaf("COLOR", "(" + COLORS_REGEXP + ")?"), mainType); + } + + public static ColorParser simpleColor(String optPrefix, ColorType mainType) { + return new ColorParser("COLOR", new RegexLeaf("COLOR", "(?:" + optPrefix + " (" + COLORS_REGEXP + "))?"), + mainType); + } + + // Old Parsers + public static RegexLeaf exp1() { - return simpleColor().regex; - } - - public static ColorParser simpleColor() { - return new ColorParser("COLOR", new RegexLeaf("COLOR", "(" + COLOR_REGEXP + ")?")); + return simpleColor(null).regex; } public static RegexLeaf exp2() { diff --git a/src/net/sourceforge/plantuml/graphic/color/ColorType.java b/src/net/sourceforge/plantuml/graphic/color/ColorType.java new file mode 100644 index 000000000..e6474102b --- /dev/null +++ b/src/net/sourceforge/plantuml/graphic/color/ColorType.java @@ -0,0 +1,47 @@ +/* ======================================================================== + * 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: 7946 $ + * + */ +package net.sourceforge.plantuml.graphic.color; + +public enum ColorType { + TEXT, LINE, BACK, HEADER, ARROW; + + public static ColorType getType(String s) { + final int x = s.indexOf('.'); + if (x != -1) { + s = s.substring(0, x); + } + final ColorType key = ColorType.valueOf(s.toUpperCase()); + return key; + } +} diff --git a/src/net/sourceforge/plantuml/graphic/color/Colors.java b/src/net/sourceforge/plantuml/graphic/color/Colors.java new file mode 100644 index 000000000..c1c3a8ad5 --- /dev/null +++ b/src/net/sourceforge/plantuml/graphic/color/Colors.java @@ -0,0 +1,189 @@ +/* ======================================================================== + * 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: 7946 $ + * + */ +package net.sourceforge.plantuml.graphic.color; + +import java.util.EnumMap; +import java.util.Map; +import java.util.StringTokenizer; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParamColors; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.cucadiagram.LinkStyle; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.IHtmlColorSet; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UStroke; + +public class Colors { + + private final Map map = new EnumMap(ColorType.class); + private LinkStyle lineStyle = null; + + @Override + public String toString() { + return map.toString() + " " + lineStyle; + } + + public static Colors empty() { + return new Colors(); + } + + private Colors copy() { + final Colors result = new Colors(); + result.map.putAll(this.map); + result.lineStyle = this.lineStyle; + return result; + } + + private Colors() { + } + + public Colors(String data, IHtmlColorSet set, ColorType mainType) { + data = StringUtils.goLowerCase(data); + + for (final StringTokenizer st = new StringTokenizer(data, "#;"); st.hasMoreTokens();) { + final String s = st.nextToken(); + final int x = s.indexOf(':'); + if (x == -1) { + if (s.contains(".") == false) { + map.put(mainType, set.getColorIfValid(s)); + } + } else { + final ColorType key = ColorType.getType(s.substring(0, x)); + final HtmlColor color = set.getColorIfValid(s.substring(x + 1)); + map.put(key, color); + } + } + if (data.contains("line.dashed")) { + lineStyle = LinkStyle.DASHED; + } else if (data.contains("line.dotted")) { + lineStyle = LinkStyle.DOTTED; + } else if (data.contains("line.bold")) { + lineStyle = LinkStyle.BOLD; + } + } + + public HtmlColor getColor(ColorType key) { + if (key == null) { + throw new IllegalArgumentException(); + } + return map.get(key); + } + + public HtmlColor getColor(ColorType key1, ColorType key2) { + final HtmlColor result = getColor(key1); + if (result != null) { + return result; + } + return getColor(key2); + } + + public UStroke getSpecificLineStroke() { + if (lineStyle == null) { + return null; + } + return LinkStyle.getStroke(lineStyle); + } + + // public Colors addSpecificLineStroke(UStroke specificStroke) { + // final Colors result = copy(); + // result.specificStroke = specificStroke; + // return result; + // } + + public Colors add(ColorType type, HtmlColor color) { + final Colors result = copy(); + result.map.put(type, color); + return result; + } + + private Colors add(ColorType colorType, Colors other) { + final Colors result = copy(); + result.map.putAll(other.map); + if (other.lineStyle != null) { + result.lineStyle = other.lineStyle; + } + return result; + } + + public final LinkStyle getLineStyle() { + return lineStyle; + } + + public ISkinParam mute(ISkinParam skinParam) { + return new SkinParamColors(skinParam, this); + } + + public Colors addLegacyStroke(String s) { + if (s == null) { + throw new IllegalArgumentException(); + } + final Colors result = copy(); + result.lineStyle = LinkStyle.valueOf(StringUtils.goUpperCase(s)); + return result; + + } + + public static UGraphic applyStroke(UGraphic ug, Colors colors) { + if (colors == null) { + return ug; + } + if (colors.lineStyle == null) { + return ug; + } + return ug.apply(LinkStyle.getStroke(colors.lineStyle)); + } + + public Colors applyStereotype(Stereotype stereotype, ISkinParam skinParam, ColorParam param) { + if (stereotype == null) { + throw new IllegalArgumentException(); + } + if (param == null) { + throw new IllegalArgumentException(); + } + final ColorType colorType = param.getColorType(); + if (colorType == null) { + throw new IllegalArgumentException(); + } + if (getColor(colorType) != null) { + return this; + } + final Colors colors = skinParam.getColors(param, stereotype); + return add(colorType, colors); + } + +} diff --git a/src/net/sourceforge/plantuml/jungle/GTileNode.java b/src/net/sourceforge/plantuml/jungle/GTileNode.java index 721c73251..c4c3ca43a 100644 --- a/src/net/sourceforge/plantuml/jungle/GTileNode.java +++ b/src/net/sourceforge/plantuml/jungle/GTileNode.java @@ -38,7 +38,6 @@ import java.util.Arrays; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.SkinParam; -import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleParser; import net.sourceforge.plantuml.creole.Sheet; @@ -76,9 +75,10 @@ public class GTileNode extends AbstractTextBlock implements GTile { final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); - final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); + final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Sheet sheet9 = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(display); + final Sheet sheet9 = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) + .createSheet(display); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet9, 0, 0); return sheetBlock1; } diff --git a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java index b9723a7fe..6e59a5ac6 100644 --- a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java +++ b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java @@ -124,7 +124,8 @@ class TurtleGraphicsPane { final HtmlColor turtleColor1 = htmlColorSet.getColorIfValid("OliveDrab"); final HtmlColor turtleColor2 = htmlColorSet.getColorIfValid("MediumSpringGreen"); - ug.apply(new UChangeColor(turtleColor1)).apply(new UChangeBackColor(turtleColor2)).apply(new UTranslate(x, -y)).draw(poly); + ug.apply(new UChangeColor(turtleColor1)).apply(new UChangeBackColor(turtleColor2)).apply(new UTranslate(x, -y)) + .draw(poly); // ug.setAntiAliasing(true); } @@ -197,8 +198,9 @@ class TurtleGraphicsPane { } drawTurtle(ug); if (message != null) { - final FontConfiguration font = new FontConfiguration(new UFont("", Font.PLAIN, 14), HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); - final TextBlock text = Display.create(message).create(font, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final FontConfiguration font = FontConfiguration.blackBlueTrue(new UFont("", Font.PLAIN, 14)); + final TextBlock text = Display.create(message).create(font, HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); final Dimension2D dim = text.calculateDimension(ug.getStringBounder()); final double textHeight = dim.getHeight(); text.drawU(ug.apply(new UTranslate(0, (height - textHeight)))); diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java index 6693b2dc4..b0fb46150 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.objectdiagram.ObjectDiagram; public class CommandCreateEntityObject extends SingleLineCommand2 { @@ -89,7 +90,7 @@ public class CommandCreateEntityObject extends SingleLineCommand2 final Url url = urlBuilder.getUrl(urlString); entity.addUrl(url); } - entity.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + entity.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java index bc1be6521..b81af2817 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.objectdiagram.ObjectDiagram; import net.sourceforge.plantuml.skin.VisibilityModifier; @@ -107,7 +108,7 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2 convert(Set all) { + final Set result = new HashSet(); + for (FileWithSuffix f : all) { + result.add(f.file); + } + return result; + } + +} diff --git a/src/net/sourceforge/plantuml/preproc/Preprocessor.java b/src/net/sourceforge/plantuml/preproc/Preprocessor.java index 66f88665b..c7c714758 100644 --- a/src/net/sourceforge/plantuml/preproc/Preprocessor.java +++ b/src/net/sourceforge/plantuml/preproc/Preprocessor.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16353 $ + * Revision $Revision: 17341 $ * */ package net.sourceforge.plantuml.preproc; @@ -160,7 +160,7 @@ public class Preprocessor implements ReadLine { rawSource.close(); } - public Set getFilesUsed() { + public Set getFilesUsed() { return Collections.unmodifiableSet(rawSource.getFilesUsedGlobal()); } diff --git a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java index c8bf20df0..7123e623a 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: 16359 $ + * Revision $Revision: 17341 $ * */ package net.sourceforge.plantuml.preproc; @@ -72,19 +72,19 @@ class PreprocessorInclude implements ReadLine { private PreprocessorInclude included = null; private final File oldCurrentDir; - private final Set filesUsedCurrent; - private final Set filesUsedGlobal; + private final Set filesUsedCurrent; + private final Set filesUsedGlobal; public PreprocessorInclude(ReadLine reader, Defines defines, String charset, File newCurrentDir) { - this(reader, defines, charset, newCurrentDir, new HashSet(), new HashSet()); + this(reader, defines, charset, newCurrentDir, new HashSet(), new HashSet()); } - public Set getFilesUsedGlobal() { + public Set getFilesUsedGlobal() { return Collections.unmodifiableSet(filesUsedGlobal); } private PreprocessorInclude(ReadLine reader, Defines defines, String charset, File newCurrentDir, - Set filesUsedCurrent, Set filesUsedGlobal) { + Set filesUsedCurrent, Set filesUsedGlobal) { this.defines = defines; this.charset = charset; this.reader2 = reader; @@ -172,13 +172,14 @@ class PreprocessorInclude implements ReadLine { fileName = fileName.substring(0, idx); } final File f = FileSystem.getInstance().getFile(withEnvironmentVariable(fileName)); + final FileWithSuffix f2 = new FileWithSuffix(f, suf); if (f.exists() == false) { return CharSequence2Impl.errorPreprocessor("Cannot include " + f.getAbsolutePath(), lineLocation); - } else if (filesUsedCurrent.contains(f)) { + } else if (filesUsedCurrent.contains(f2)) { return CharSequence2Impl.errorPreprocessor("File already included " + f.getAbsolutePath(), lineLocation); } else { - filesUsedCurrent.add(f); - filesUsedGlobal.add(f); + filesUsedCurrent.add(f2); + filesUsedGlobal.add(f2); included = new PreprocessorInclude(getReaderInclude(f, suf, lineLocation), defines, charset, f.getParentFile(), filesUsedCurrent, filesUsedGlobal); } diff --git a/src/net/sourceforge/plantuml/printskin/PrintSkin.java b/src/net/sourceforge/plantuml/printskin/PrintSkin.java index 6891ac80e..247f97cee 100644 --- a/src/net/sourceforge/plantuml/printskin/PrintSkin.java +++ b/src/net/sourceforge/plantuml/printskin/PrintSkin.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.printskin; @@ -153,8 +153,8 @@ class PrintSkin extends AbstractPSystem { } private void println(String s) { - final TextBlock textBlock = Display.create(s).create(new FontConfiguration(FONT1, - HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock textBlock = Display.create(s).create(FontConfiguration.blackBlueTrue(FONT1), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); textBlock.drawU(ug.apply(new UTranslate(xpos, ypos))); ypos += textBlock.calculateDimension(ug.getStringBounder()).getHeight(); } diff --git a/src/net/sourceforge/plantuml/project/graphic/ItemHeader.java b/src/net/sourceforge/plantuml/project/graphic/ItemHeader.java index 36b94286e..bbb8e1bd4 100644 --- a/src/net/sourceforge/plantuml/project/graphic/ItemHeader.java +++ b/src/net/sourceforge/plantuml/project/graphic/ItemHeader.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.project.Item; import net.sourceforge.plantuml.project.Project; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -57,7 +56,7 @@ class ItemHeader { private final UFont font = new UFont("Serif", Font.PLAIN, 9); private final Project project; - private final FontConfiguration fontConfig = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + private final FontConfiguration fontConfig = FontConfiguration.blackBlueTrue(font); public ItemHeader(Project project) { this.project = project; @@ -71,7 +70,8 @@ class ItemHeader { ug.apply(new UTranslate(x, y)).draw(new URectangle(getWidth(stringBounder), getHeight(stringBounder))); for (Item it : project.getValidItems()) { - final TextBlock b = Display.create("" + it.getCode()).create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock b = Display.create("" + it.getCode()).create(fontConfig, HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); final Dimension2D dim = b.calculateDimension(stringBounder); b.drawU(ug.apply(new UTranslate(x, y))); y += dim.getHeight(); diff --git a/src/net/sourceforge/plantuml/project/graphic/TimeScale.java b/src/net/sourceforge/plantuml/project/graphic/TimeScale.java index 1d7ba4d12..a90074bed 100644 --- a/src/net/sourceforge/plantuml/project/graphic/TimeScale.java +++ b/src/net/sourceforge/plantuml/project/graphic/TimeScale.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.project.Day; import net.sourceforge.plantuml.project.Instant; import net.sourceforge.plantuml.project.Month; @@ -62,7 +61,7 @@ class TimeScale { private final UFont font = new UFont("Serif", Font.PLAIN, 9); private final Project project; - private final FontConfiguration fontConfig = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + private final FontConfiguration fontConfig = FontConfiguration.blackBlueTrue(font); public TimeScale(Project project) { this.project = project; @@ -87,7 +86,8 @@ class TimeScale { if (printed == null || d.getMonth() != printed) { ug.apply(new UTranslate(curx, y)).draw(new ULine(0, monthHeight)); printed = d.getMonth(); - final TextBlock b = Display.create(printed.name()).create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock b = Display.create(printed.name()).create(fontConfig, HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); final Dimension2D dim = b.calculateDimension(stringBounder); b.drawU(ug.apply(new UTranslate(curx, (y + (monthHeight - dim.getHeight()) / 2)))); } @@ -100,9 +100,11 @@ class TimeScale { for (Instant cur = project.getStart(); cur.compareTo(end) <= 0; cur = cur.next(project.getDayClose())) { final Day d = cur.getDay(); - final TextBlock b = Display.create("" + d.getNumDay()).create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock b = Display.create("" + d.getNumDay()).create(fontConfig, HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); final Dimension2D dim = b.calculateDimension(stringBounder); - b.drawU(ug.apply(new UTranslate((curx + (caseWidth - dim.getWidth()) / 2), (y + (caseHeight - dim.getHeight()) / 2)))); + b.drawU(ug.apply(new UTranslate((curx + (caseWidth - dim.getWidth()) / 2), (y + (caseHeight - dim + .getHeight()) / 2)))); curx += caseWidth; ug.apply(new UTranslate(curx, y)).draw(new ULine(0, caseHeight)); } diff --git a/src/net/sourceforge/plantuml/project2/GanttDiagram2.java b/src/net/sourceforge/plantuml/project2/GanttDiagram2.java index 39b729d7b..3b957ad4f 100644 --- a/src/net/sourceforge/plantuml/project2/GanttDiagram2.java +++ b/src/net/sourceforge/plantuml/project2/GanttDiagram2.java @@ -59,7 +59,7 @@ public class GanttDiagram2 { } private final UFont font = new UFont("Serif", Font.PLAIN, 9); - private final FontConfiguration fontConfig = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + private final FontConfiguration fontConfig = FontConfiguration.blackBlueTrue(font); public void draw(UGraphic ug, double x, double y) { @@ -82,7 +82,8 @@ public class GanttDiagram2 { final List rows = new ArrayList(); for (Task t : tasks) { final String text = t.getCode(); - final TextBlock label = Display.create(text).create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock label = Display.create(text).create(fontConfig, HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); rows.add(new RowSimple((Day) t.getStart(), (Day) t.getEnd(), HtmlColorUtils.BLACK, TextBlockUtils .withMargin(label, 3, 3))); } diff --git a/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java b/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java index 4a7720830..c4944251e 100644 --- a/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java +++ b/src/net/sourceforge/plantuml/project2/TimeHeaderDay.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; @@ -61,7 +60,7 @@ public class TimeHeaderDay extends AbstractTextBlock implements TextBlock { private final double dayWidth; private final UFont font = new UFont("Serif", Font.PLAIN, 9); - private final FontConfiguration fontConfig = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + private final FontConfiguration fontConfig = FontConfiguration.blackBlueTrue(font); public TimeHeaderDay(Day start, Day end, TimeLine timeline, double dayWidth) { this.start = start; @@ -74,7 +73,8 @@ public class TimeHeaderDay extends AbstractTextBlock implements TextBlock { int n = 0; for (Day d = start; d.compareTo(end) <= 0; d = (Day) timeline.next(d)) { final String text = "" + d.getNumDay(); - final TextBlock b = Display.create(text).create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock b = Display.create(text).create(fontConfig, HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); final Dimension2D dimText = b.calculateDimension(ug.getStringBounder()); final double diffX = dayWidth - dimText.getWidth(); final double diffY = getHeight() - dimText.getHeight(); diff --git a/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java b/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java index e871fd7e2..554514e4d 100644 --- a/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java +++ b/src/net/sourceforge/plantuml/project2/TimeHeaderMonth.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UFont; @@ -61,7 +60,7 @@ public class TimeHeaderMonth extends AbstractTextBlock implements TextBlock { private final double dayWidth; private final UFont font = new UFont("Serif", Font.PLAIN, 9); - private final FontConfiguration fontConfig = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + private final FontConfiguration fontConfig = FontConfiguration.blackBlueTrue(font); public TimeHeaderMonth(Day start, Day end, TimeLine timeline, double dayWidth) { this.start = start; @@ -73,7 +72,7 @@ public class TimeHeaderMonth extends AbstractTextBlock implements TextBlock { public void drawU(UGraphic ug) { int n = 0; String last = null; - + double pendingX = -1; for (Day d = start; d.compareTo(end) <= 0; d = (Day) timeline.next(d)) { final String text = "" + d.getMonth().name(); @@ -96,7 +95,8 @@ public class TimeHeaderMonth extends AbstractTextBlock implements TextBlock { private void manage(UGraphic ug, double x, double y, int n, String last, double pendingX) { final double width = n * dayWidth - pendingX; ug.apply(new UTranslate(x + pendingX, y)).draw(new URectangle(width, getHeight())); - final TextBlock b = Display.create(last).create(fontConfig, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock b = Display.create(last).create(fontConfig, HorizontalAlignment.LEFT, + new SpriteContainerEmpty()); final Dimension2D dimText = b.calculateDimension(ug.getStringBounder()); final double diffX = width - dimText.getWidth(); final double diffY = getHeight() - dimText.getHeight(); diff --git a/src/net/sourceforge/plantuml/salt/Dictionary.java b/src/net/sourceforge/plantuml/salt/Dictionary.java index 7dccbfd07..9d9807e29 100644 --- a/src/net/sourceforge/plantuml/salt/Dictionary.java +++ b/src/net/sourceforge/plantuml/salt/Dictionary.java @@ -79,4 +79,8 @@ public class Dictionary implements SpriteContainer, ISkinSimple { return CommandCreoleMonospaced.MONOSPACED; } + public int getTabSize() { + return 8; + } + } diff --git a/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java b/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java index 93052de38..aabb15a69 100644 --- a/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java +++ b/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java @@ -41,10 +41,8 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -56,7 +54,7 @@ abstract class AbstractElementText extends AbstractElement { private final int charLength; public AbstractElementText(String text, UFont font, boolean manageLength, ISkinSimple spriteContainer) { - config = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + config = FontConfiguration.blackBlueTrue(font); if (manageLength) { this.charLength = getCharNumber(text); text = StringUtils.trin(text); diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java index 3beb4ab00..6aaf7c58d 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java @@ -41,10 +41,8 @@ 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; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -58,7 +56,7 @@ public class ElementMenuEntry extends AbstractElement { private double xxx; public ElementMenuEntry(String text, UFont font, ISkinSimple spriteContainer) { - final FontConfiguration config = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + final FontConfiguration config = FontConfiguration.blackBlueTrue(font); this.block = Display.create(text).create(config, HorizontalAlignment.LEFT, spriteContainer); this.text = text; } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java b/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java index ca3086185..d395002dc 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java @@ -41,10 +41,8 @@ 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.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UFont; @@ -67,7 +65,7 @@ public class ElementRadioCheckbox extends AbstractElement { public ElementRadioCheckbox(List text, UFont font, boolean radio, boolean checked, ISkinSimple spriteContainer) { - final FontConfiguration config = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + final FontConfiguration config = FontConfiguration.blackBlueTrue(font); this.block = Display.create(text).create(config, HorizontalAlignment.LEFT, spriteContainer); this.radio = radio; this.checked = checked; diff --git a/src/net/sourceforge/plantuml/salt/element/ElementText.java b/src/net/sourceforge/plantuml/salt/element/ElementText.java index 40092e790..fb419b2d6 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementText.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementText.java @@ -40,10 +40,8 @@ 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.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -54,7 +52,7 @@ public class ElementText extends AbstractElement { private final String text; public ElementText(List text, UFont font, ISkinSimple spriteContainer) { - final FontConfiguration config = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true); + final FontConfiguration config = FontConfiguration.blackBlueTrue(font); this.block = Display.create(text).create(config, HorizontalAlignment.LEFT, spriteContainer); this.show = text.get(0).equals(".") == false; this.text = text.get(0); diff --git a/src/net/sourceforge/plantuml/sequencediagram/Note.java b/src/net/sourceforge/plantuml/sequencediagram/Note.java index f0e67e9d3..c8a434895 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Note.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Note.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16005 $ + * Revision $Revision: 17004 $ * */ package net.sourceforge.plantuml.sequencediagram; @@ -41,6 +41,8 @@ import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; public class Note extends AbstractEvent implements Event, SpecificBackcolorable { @@ -96,14 +98,20 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable return position; } - private HtmlColor specificBackcolor; - - public HtmlColor getSpecificBackColor() { - return specificBackcolor; + public Colors getColors(ISkinParam skinParam) { + return colors; } - public void setSpecificBackcolor(HtmlColor color) { - this.specificBackcolor = color; + public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + if (color != null) { + this.colors = colors.add(type, color); + } + } + + private Colors colors = Colors.empty(); + + public void setColors(Colors colors) { + this.colors = colors; } public boolean dealWith(Participant someone) { @@ -127,7 +135,7 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable } public SkinParamBackcolored getSkinParamBackcolored(ISkinParam skinParam) { - return new SkinParamBackcolored(skinParam, getSpecificBackColor()); + return new SkinParamBackcolored(skinParam, getColors(skinParam).getColor(ColorType.BACK)); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Notes.java b/src/net/sourceforge/plantuml/sequencediagram/Notes.java index 153671af3..82cf78ebc 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Notes.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Notes.java @@ -62,4 +62,8 @@ public class Notes extends AbstractEvent implements Event, Iterable { public Iterator iterator() { return notes.iterator(); } + + public Note get(int i) { + return notes.get(i); + } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Participant.java b/src/net/sourceforge/plantuml/sequencediagram/Participant.java index dd76c9171..11674492e 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Participant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Participant.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16937 $ + * Revision $Revision: 17004 $ * */ package net.sourceforge.plantuml.sequencediagram; @@ -42,6 +42,8 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.SymbolContext; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; public class Participant implements SpecificBackcolorable { @@ -121,14 +123,21 @@ public class Participant implements SpecificBackcolorable { return liveBackcolors; } - private HtmlColor specificBackcolor; - - public HtmlColor getSpecificBackColor() { - return specificBackcolor; + public Colors getColors(ISkinParam skinParam) { + return colors; } - public void setSpecificBackcolor(HtmlColor color) { - this.specificBackcolor = color; + public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + if (color != null) { + this.colors = colors.add(type, color); + } + } + + private Colors colors = Colors.empty(); + + + public void setColors(Colors colors) { + this.colors = colors; } private Url url; @@ -150,7 +159,7 @@ public class Participant implements SpecificBackcolorable { } public SkinParamBackcolored getSkinParamBackcolored(ISkinParam skinParam) { - HtmlColor specificBackColor = getSpecificBackColor(); + HtmlColor specificBackColor = getColors(skinParam).getColor(ColorType.BACK); final boolean clickable = getUrl() != null; final HtmlColor stereoBackColor = skinParam.getHtmlColor(getBackgroundColorParam(), getStereotype(), clickable); if (stereoBackColor != null && specificBackColor == null) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index 7971f06c2..d31cfc3fd 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -31,6 +31,7 @@ */ package net.sourceforge.plantuml.sequencediagram; +import java.awt.geom.Dimension2D; import java.io.IOException; import java.io.OutputStream; import java.text.DecimalFormat; @@ -45,6 +46,7 @@ import java.util.Stack; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.OptionFlags; +import net.sourceforge.plantuml.Scale; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.core.DiagramDescription; @@ -484,4 +486,15 @@ public class SequenceDiagram extends UmlDiagram { return true; } + public double getDpiFactor(FileFormatOption fileFormatOption, Dimension2D dim) { + final double dpiFactor; + final Scale scale = getScale(); + if (scale == null) { + dpiFactor = getDpiFactor(fileFormatOption); + } else { + dpiFactor = scale.getScale(dim.getWidth(), dim.getHeight()); + } + return dpiFactor; + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java index 912f9b3a7..626b5129f 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.sequencediagram.LifeEventType; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.ParticipantType; @@ -104,7 +105,7 @@ public abstract class CommandParticipant extends SingleLineCommand2 { @@ -72,11 +74,16 @@ public class CommandCreatePackageState extends SingleLineCommand2 new RegexLeaf("[%s]*"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("[%s]*"), // new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), // new RegexLeaf("(?:[%s]*\\{|[%s]+begin)$")); } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + private String getNotNull(RegexResult arg, String v1, String v2) { if (arg.get(v1, 0) == null) { @@ -105,9 +112,21 @@ public class CommandCreatePackageState extends SingleLineCommand2 final Url url = urlBuilder.getUrl(urlString); p.addUrl(url); } - p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); - p.setSpecificLineColor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1))); - CommandCreateClassMultilines.applyStroke(p, arg.get("LINECOLOR", 0)); + + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + + final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + if (lineColor != null) { + colors = colors.add(ColorType.LINE, lineColor); + } + if (arg.get("LINECOLOR", 0) != null) { + colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0)); + } + p.setColors(colors); + +// p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); +// p.setSpecificColorTOBEREMOVED(ColorType.LINE, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1))); +// p.applyStroke(arg.get("LINECOLOR", 0)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java index be8aa8ae9..da8959efe 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16943 $ + * Revision $Revision: 17015 $ * */ package net.sourceforge.plantuml.statediagram.command; @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.statediagram.command; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; -import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -48,7 +47,10 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.statediagram.StateDiagram; public class CommandCreateState extends SingleLineCommand2 { @@ -77,7 +79,7 @@ public class CommandCreateState extends SingleLineCommand2 { new RegexLeaf("[%s]*"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("[%s]*"), // new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), // new RegexLeaf("[%s]*"), // @@ -85,6 +87,10 @@ public class CommandCreateState extends SingleLineCommand2 { new RegexLeaf("$")); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + @Override protected CommandExecutionResult executeArg(StateDiagram diagram, RegexResult arg) { final Code code = Code.of(arg.getLazzy("CODE", 0)); @@ -110,9 +116,23 @@ public class CommandCreateState extends SingleLineCommand2 { final Url url = urlBuilder.getUrl(urlString); ent.addUrl(url); } - ent.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); - ent.setSpecificLineColor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1))); - CommandCreateClassMultilines.applyStroke(ent, arg.get("LINECOLOR", 0)); + + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + + final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); + if (lineColor != null) { + colors = colors.add(ColorType.LINE, lineColor); + } + if (arg.get("LINECOLOR", 0) != null) { + colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0)); + } + ent.setColors(colors); + + // ent.setSpecificColorTOBEREMOVED(ColorType.BACK, + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + // ent.setSpecificColorTOBEREMOVED(ColorType.LINE, + // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1))); + // ent.applyStroke(arg.get("LINECOLOR", 0)); final String addFields = arg.get("ADDFIELD", 0); if (addFields != null) { diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java index b00c83acc..d00e4d35b 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.statediagram.command; import net.sourceforge.plantuml.Direction; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -48,8 +49,8 @@ import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.statediagram.StateDiagram; -import net.sourceforge.plantuml.StringUtils; public class CommandLinkState extends SingleLineCommand2 { @@ -106,13 +107,13 @@ public class CommandLinkState extends SingleLineCommand2 { cl1.setStereotype(new Stereotype(arg.get("ENT1", 1))); } if (arg.get("ENT1", 2) != null) { - cl1.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("ENT1", 2))); + cl1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("ENT1", 2))); } if (arg.get("ENT2", 1) != null) { cl2.setStereotype(new Stereotype(arg.get("ENT2", 1))); } if (arg.get("ENT2", 2) != null) { - cl2.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("ENT2", 2))); + cl2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("ENT2", 2))); } String queue = arg.get("ARROW_BODY1", 0) + arg.get("ARROW_BODY2", 0); diff --git a/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java b/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java index bff3b078f..d3d4be7d0 100644 --- a/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java +++ b/src/net/sourceforge/plantuml/sudoku/GraphicsSudoku.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16528 $ + * Revision $Revision: 17068 $ * */ package net.sourceforge.plantuml.sudoku; @@ -51,7 +51,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.png.PngIO; import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -106,8 +105,8 @@ public class GraphicsSudoku { for (int y = 0; y < 9; y++) { final int num = sudoku.getGiven(x, y); if (num > 0) { - final TextBlock text = Display.create("" + num).create(new FontConfiguration( - numberFont, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty()); + final TextBlock text = Display.create("" + num).create(FontConfiguration.blackBlueTrue(numberFont), + HorizontalAlignment.CENTER, new SpriteContainerEmpty()); text.drawU(ug.apply(new UTranslate((numberxOffset + x * cellWidth), (numberyOffset + y * cellHeight)))); } @@ -131,8 +130,8 @@ public class GraphicsSudoku { texts.add("http://plantuml.sourceforge.net"); texts.add("Seed " + Long.toString(sudoku.getSeed(), 36)); texts.add("Difficulty " + sudoku.getRatting()); - final TextBlock textBlock = Display.create(texts).create(new FontConfiguration( - font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty()); + final TextBlock textBlock = Display.create(texts).create(FontConfiguration.blackBlueTrue(font), + HorizontalAlignment.LEFT, new SpriteContainerEmpty()); textBlock.drawU(ug); g3d.dispose(); return im; diff --git a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java index 8918c1f5f..4474e86ed 100644 --- a/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java +++ b/src/net/sourceforge/plantuml/svek/AbstractEntityImage.java @@ -45,6 +45,7 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I private final ISkinParam skinParam; public AbstractEntityImage(IEntity entity, ISkinParam skinParam) { + // System.err.println("Creating abstractEntityImage "+getClass()); if (entity == null) { throw new IllegalArgumentException("entity null"); } diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index 0ad1042e2..0a70973f0 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -50,6 +50,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.EntityPosition; @@ -68,6 +69,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.graphic.TextBlockWidth; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.posimo.Moveable; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.EntityImageState; @@ -140,7 +142,7 @@ public class Cluster implements Moveable { } this.color = colorSequence.getValue(); this.colorTitle = colorSequence.getValue(); - this.skinParam = skinParam; + this.skinParam = group.getColors(skinParam).mute(skinParam); } @Override @@ -291,18 +293,17 @@ public class Cluster implements Moveable { } private static HtmlColor getColor(ColorParam colorParam, ISkinParam skinParam, Stereotype stereotype) { - return new Rose().getHtmlColor(skinParam, colorParam, stereotype); + return SkinParamUtils.getColor(skinParam, colorParam, stereotype); } public void drawU(UGraphic ug, DotData dotData, UStroke stroke) { final Stereotype stereotype = group.getStereotype(); - HtmlColor borderColor; if (dotData.getUmlDiagramType() == UmlDiagramType.STATE) { - borderColor = getColor(ColorParam.stateBorder, dotData.getSkinParam(), stereotype); + borderColor = getColor(ColorParam.stateBorder, skinParam, stereotype); } else { - borderColor = getColor(ColorParam.packageBorder, dotData.getSkinParam(), stereotype); + borderColor = getColor(ColorParam.packageBorder, skinParam, stereotype); } final Url url = group.getUrl99(); @@ -319,11 +320,11 @@ public class Cluster implements Moveable { } final boolean isState = dotData.getUmlDiagramType() == UmlDiagramType.STATE; if (isState) { - if (group.getSpecificLineStroke() != null) { - stroke = group.getSpecificLineStroke(); + if (group.getColors(skinParam).getSpecificLineStroke() != null) { + stroke = group.getColors(skinParam).getSpecificLineStroke(); } - if (group.getSpecificLineColor() != null) { - borderColor = group.getSpecificLineColor(); + if (group.getColors(skinParam).getColor(ColorType.LINE) != null) { + borderColor = group.getColors(skinParam).getColor(ColorType.LINE); } drawUState(ug, borderColor, dotData, stroke); return; @@ -793,7 +794,7 @@ public class Cluster implements Moveable { if (EntityUtils.groupRoot(group)) { return null; } - final HtmlColor result = group.getSpecificBackColor(); + final HtmlColor result = group.getColors(skinParam).getColor(ColorType.BACK); if (result != null) { return result; } diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java index 194bd3233..63e62163f 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java @@ -175,14 +175,12 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { if (Display.isNull(footer) && Display.isNull(header)) { return original; } - final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration( - getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), diagram.getSkinParam() - .getHyperlinkColor(), diagram.getSkinParam().useUnderlineForHyperlink()), diagram - .getFooterAlignment(), diagram.getSkinParam()); - final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration( - getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), diagram.getSkinParam() - .getHyperlinkColor(), diagram.getSkinParam().useUnderlineForHyperlink()), diagram - .getHeaderAlignment(), diagram.getSkinParam()); + final TextBlock textFooter = Display.isNull(footer) ? null : footer.create( + new FontConfiguration(diagram.getSkinParam(), FontParam.FOOTER, null), diagram.getFooterAlignment(), + diagram.getSkinParam()); + final TextBlock textHeader = Display.isNull(header) ? null : header.create( + new FontConfiguration(diagram.getSkinParam(), FontParam.HEADER, null), diagram.getHeaderAlignment(), + diagram.getSkinParam()); return new DecorateEntityImage(original, textHeader, diagram.getHeaderAlignment(), textFooter, diagram.getFooterAlignment()); @@ -193,9 +191,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { if (Display.isNull(title)) { return original; } - final TextBlock text = title.create( - new FontConfiguration(getFont(FontParam.TITLE), getFontColor(FontParam.TITLE, null), diagram - .getSkinParam().getHyperlinkColor(), diagram.getSkinParam().useUnderlineForHyperlink()), + final TextBlock text = title.create(new FontConfiguration(diagram.getSkinParam(), FontParam.TITLE, null), HorizontalAlignment.CENTER, diagram.getSkinParam()); return DecorateEntityImage.addTop(original, text, HorizontalAlignment.CENTER); diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java index 0f26a6d96..bbaaca382 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java @@ -86,6 +86,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockWidth; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbolInterface; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.image.EntityImageActivity; import net.sourceforge.plantuml.svek.image.EntityImageArcCircle; import net.sourceforge.plantuml.svek.image.EntityImageAssociation; @@ -175,9 +176,7 @@ public final class CucaDiagramFileMakerSvek2 { lhead = getCluster2((IEntity) link.getEntity2()).getClusterId(); } final ISkinParam skinParam = dotData.getSkinParam(); - final FontConfiguration labelFont = new FontConfiguration(skinParam.getFont(FontParam.GENERIC_ARROW, - null, false), skinParam.getFontHtmlColor(FontParam.GENERIC_ARROW, null), - skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()); + final FontConfiguration labelFont = new FontConfiguration(skinParam, FontParam.GENERIC_ARROW, null); final Line line = new Line(shapeUid1, shapeUid2, link, colorSequence, ltail, lhead, skinParam, stringBounder, labelFont, getBibliotekon(), dotStringFactory.getGraphvizVersion(), @@ -188,12 +187,14 @@ public final class CucaDiagramFileMakerSvek2 { if (link.getEntity1().isGroup() == false && link.getEntity1().getEntityType() == LeafType.NOTE && onlyOneLink(link.getEntity1())) { final Shape shape = getBibliotekon().getShape(link.getEntity1()); - ((EntityImageNote) shape.getImage()).setOpaleLine(line, shape); + final Shape other = getBibliotekon().getShape(link.getEntity2()); + ((EntityImageNote) shape.getImage()).setOpaleLine(line, shape, other); line.setOpale(true); } else if (link.getEntity2().isGroup() == false && link.getEntity2().getEntityType() == LeafType.NOTE && onlyOneLink(link.getEntity2())) { final Shape shape = getBibliotekon().getShape(link.getEntity2()); - ((EntityImageNote) shape.getImage()).setOpaleLine(line, shape); + final Shape other = getBibliotekon().getShape(link.getEntity1()); + ((EntityImageNote) shape.getImage()).setOpaleLine(line, shape, other); line.setOpale(true); } } catch (IllegalStateException e) { @@ -487,12 +488,14 @@ public final class CucaDiagramFileMakerSvek2 { g.getParentContainer(), null, dotData.getNamespaceSeparator()); final USymbol symbol = g.getUSymbol(); folder.setUSymbol(symbol); - if (g.getSpecificBackColor() == null) { + if (g.getColors(dotData.getSkinParam()).getColor(ColorType.BACK) == null) { final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack(); final HtmlColor c1 = dotData.getSkinParam().getHtmlColor(param, g.getStereotype(), false); - folder.setSpecificBackcolor(c1 == null ? dotData.getSkinParam().getBackgroundColor() : c1); + folder.setSpecificColorTOBEREMOVED(ColorType.BACK, c1 == null ? dotData.getSkinParam() + .getBackgroundColor() : c1); } else { - folder.setSpecificBackcolor(g.getSpecificBackColor()); + folder.setSpecificColorTOBEREMOVED(ColorType.BACK, + g.getColors(dotData.getSkinParam()).getColor(ColorType.BACK)); } printEntity(folder); } else { @@ -550,9 +553,10 @@ public final class CucaDiagramFileMakerSvek2 { final FontParam fontParam = g.getTitleFontParam(); final HtmlColor fontHtmlColor = dotData.getSkinParam().getFontHtmlColor(fontParam, stereotype); - return label.create(new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype, true), - fontHtmlColor, dotData.getSkinParam().getHyperlinkColor(), dotData.getSkinParam() - .useUnderlineForHyperlink()), HorizontalAlignment.CENTER, dotData.getSkinParam()); + final FontConfiguration fontConfiguration = new FontConfiguration(dotData.getSkinParam().getFont(fontParam, + stereotype, true), fontHtmlColor, dotData.getSkinParam().getHyperlinkColor(), dotData.getSkinParam() + .useUnderlineForHyperlink(), dotData.getSkinParam().getTabSize()); + return label.create(fontConfiguration, HorizontalAlignment.CENTER, dotData.getSkinParam()); } private TextBlock getStereoBlock(IGroup g) { @@ -570,11 +574,7 @@ public final class CucaDiagramFileMakerSvek2 { } final FontParam fontParam = FontParam.PACKAGE_STEREOTYPE; - final HtmlColor fontHtmlColor = dotData.getSkinParam().getFontHtmlColor(fontParam, stereotype); - return Display.create(stereos).create( - new FontConfiguration(dotData.getSkinParam().getFont(fontParam, stereotype, false), fontHtmlColor, - dotData.getSkinParam().getHyperlinkColor(), dotData.getSkinParam().useUnderlineForHyperlink()), + return Display.create(stereos).create(new FontConfiguration(dotData.getSkinParam(), fontParam, stereotype), HorizontalAlignment.CENTER, dotData.getSkinParam()); } - } diff --git a/src/net/sourceforge/plantuml/svek/DotStringFactory.java b/src/net/sourceforge/plantuml/svek/DotStringFactory.java index 6d979b18f..fc15b4f7d 100644 --- a/src/net/sourceforge/plantuml/svek/DotStringFactory.java +++ b/src/net/sourceforge/plantuml/svek/DotStringFactory.java @@ -175,7 +175,8 @@ public class DotStringFactory implements Moveable { line.appendLine(sb); } root.fillRankMin(rankMin); - root.printCluster2(sb, bibliotekon.allLines(), stringBounder, dotData.getDotMode(), getGraphvizVersion(), dotData.getUmlDiagramType()); + root.printCluster2(sb, bibliotekon.allLines(), stringBounder, dotData.getDotMode(), getGraphvizVersion(), + dotData.getUmlDiagramType()); printMinRanking(sb); for (Line line : bibliotekon.lines1()) { @@ -298,7 +299,8 @@ public class DotStringFactory implements Moveable { for (Shape sh : bibliotekon.allShapes()) { int idx = svg.indexOf("" + sh.getUid() + ""); - if (sh.getType() == ShapeType.RECTANGLE || sh.getType() == ShapeType.DIAMOND) { + if (sh.getType() == ShapeType.RECTANGLE || sh.getType() == ShapeType.FOLDER + || sh.getType() == ShapeType.DIAMOND) { final List points = SvekUtils.extractPointsList(svg, idx, fullHeight); final double minX = SvekUtils.getMinX(points); final double minY = SvekUtils.getMinY(points); diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java index f6a98c5b7..0be2ccd1a 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.EntityImageState; import net.sourceforge.plantuml.ugraphic.UFont; @@ -116,8 +117,8 @@ public final class GroupPngMakerActivity { if (group.getGroupType() == GroupType.INNER_ACTIVITY) { final Stereotype stereo = group.getStereotype(); final HtmlColor borderColor = getColor(ColorParam.activityBorder, stereo); - final HtmlColor backColor = group.getSpecificBackColor() == null ? getColor(ColorParam.background, stereo) - : group.getSpecificBackColor(); + final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor( + ColorParam.background, stereo) : group.getColors(skinParam).getColor(ColorType.BACK); return new InnerActivity(svek2.createFile(), borderColor, backColor, skinParam.shadowing()); } diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java index 307be7fc3..870c41cdd 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java @@ -63,6 +63,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockWidth; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.image.EntityImageState; import net.sourceforge.plantuml.ugraphic.UFont; @@ -109,9 +110,9 @@ public final class GroupPngMakerState { public IEntityImage getImage() { final Display display = group.getDisplay(); final ISkinParam skinParam = diagram.getSkinParam(); - final HtmlColor textColor = SkinParamUtils.getFontColor(skinParam, FontParam.STATE, group.getStereotype()); - final TextBlock title = display.create(new FontConfiguration(getFont(FontParam.STATE), - textColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()), HorizontalAlignment.CENTER, diagram.getSkinParam()); + final TextBlock title = display.create( + new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()), HorizontalAlignment.CENTER, + diagram.getSkinParam()); if (group.size() == 0) { return new EntityImageState(group, diagram.getSkinParam()); @@ -132,7 +133,7 @@ public final class GroupPngMakerState { final CucaDiagramFileMakerSvek2 svek2 = new CucaDiagramFileMakerSvek2(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma()); - UStroke stroke = group.getSpecificLineStroke(); + UStroke stroke = group.getColors(skinParam).getSpecificLineStroke(); if (stroke == null) { stroke = new UStroke(1.5); } @@ -141,13 +142,13 @@ public final class GroupPngMakerState { // return new InnerStateConcurrent(svek2.createFile()); return svek2.createFile(); } else if (group.getGroupType() == GroupType.STATE) { - HtmlColor borderColor = group.getSpecificLineColor(); + HtmlColor borderColor = group.getColors(skinParam).getColor(ColorType.LINE); if (borderColor == null) { borderColor = getColor(ColorParam.stateBorder, group.getStereotype()); } final Stereotype stereo = group.getStereotype(); - final HtmlColor backColor = group.getSpecificBackColor() == null ? getColor(ColorParam.stateBackground, - stereo) : group.getSpecificBackColor(); + final HtmlColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null ? getColor( + ColorParam.stateBackground, stereo) : group.getColors(skinParam).getColor(ColorType.BACK); final List members = ((IEntity) group).getBodier().getFieldsToDisplay(); final TextBlockWidth attribute; if (members.size() == 0) { diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index f21a5847c..fd109f10e 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -67,6 +67,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.USymbolFolder; import net.sourceforge.plantuml.graphic.VerticalAlignment; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.posimo.BezierUtils; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.posimo.Moveable; @@ -94,7 +95,7 @@ public class Line implements Moveable, Hideable { private final TextBlock startTailText; private final TextBlock endHeadText; - private final TextBlock noteLabelText; + private final TextBlock labelText; private final int lineColor; private final int noteLabelColor; @@ -108,7 +109,7 @@ public class Line implements Moveable, Hideable { private Positionable startTailLabelXY; private Positionable endHeadLabelXY; - private Positionable noteLabelXY; + private Positionable labelXY; private UDrawable extremity2; private UDrawable extremity1; @@ -208,6 +209,10 @@ public class Line implements Moveable, Hideable { if (startUid == null || endUid == null || link == null) { throw new IllegalArgumentException(); } + if (link.getColors() != null) { + skinParam = link.getColors().mute(skinParam); + labelFont = labelFont.mute(link.getColors()); + } this.graphvizVersion = graphvizVersion; this.pragma = pragma; this.bibliotekon = bibliotekon; @@ -237,8 +242,8 @@ public class Line implements Moveable, Hideable { } else { final double marginLabel = startUid.equals(endUid) ? 6 : 1; final TextBlock label = TextBlockUtils.withMargin( - link.getLabel().create(labelFont, skinParam.getDefaultTextAlignment(), skinParam), - marginLabel, marginLabel); + link.getLabel().create(labelFont, skinParam.getDefaultTextAlignment(), skinParam), marginLabel, + marginLabel); if (getLinkArrow() == LinkArrow.NONE) { labelOnly = label; } else { @@ -258,43 +263,45 @@ public class Line implements Moveable, Hideable { if (link.getNote() == null) { noteOnly = null; } else { - noteOnly = new EntityImageNoteLink(link.getNote(), link.getNoteColor(), skinParam); + noteOnly = new EntityImageNoteLink(link.getNote(), link.getNoteColors(), skinParam); } if (labelOnly != null && noteOnly != null) { if (link.getNotePosition() == Position.LEFT) { - noteLabelText = TextBlockUtils.mergeLR(noteOnly, labelOnly, VerticalAlignment.CENTER); + labelText = TextBlockUtils.mergeLR(noteOnly, labelOnly, VerticalAlignment.CENTER); } else if (link.getNotePosition() == Position.RIGHT) { - noteLabelText = TextBlockUtils.mergeLR(labelOnly, noteOnly, VerticalAlignment.CENTER); + labelText = TextBlockUtils.mergeLR(labelOnly, noteOnly, VerticalAlignment.CENTER); } else if (link.getNotePosition() == Position.TOP) { - noteLabelText = TextBlockUtils.mergeTB(noteOnly, labelOnly, HorizontalAlignment.CENTER); + labelText = TextBlockUtils.mergeTB(noteOnly, labelOnly, HorizontalAlignment.CENTER); } else { - noteLabelText = TextBlockUtils.mergeTB(labelOnly, noteOnly, HorizontalAlignment.CENTER); + labelText = TextBlockUtils.mergeTB(labelOnly, noteOnly, HorizontalAlignment.CENTER); } } else if (labelOnly != null) { - noteLabelText = labelOnly; + labelText = labelOnly; } else if (noteOnly != null) { - noteLabelText = noteOnly; + labelText = noteOnly; } else { - noteLabelText = null; + labelText = null; } if (link.getQualifier1() == null) { startTailText = null; } else { - startTailText = Display.getWithNewlines(link.getQualifier1()).create(labelFont, HorizontalAlignment.CENTER, skinParam); + startTailText = Display.getWithNewlines(link.getQualifier1()).create(labelFont, HorizontalAlignment.CENTER, + skinParam); } if (link.getQualifier2() == null) { endHeadText = null; } else { - endHeadText = Display.getWithNewlines(link.getQualifier2()).create(labelFont, HorizontalAlignment.CENTER, skinParam); + endHeadText = Display.getWithNewlines(link.getQualifier2()).create(labelFont, HorizontalAlignment.CENTER, + skinParam); } } public boolean hasNoteLabelText() { - return noteLabelText != null; + return labelText != null; } private LinkArrow getLinkArrow() { @@ -329,10 +336,10 @@ public class Line implements Moveable, Hideable { sb.append(","); } sb.append("color=\"" + StringUtils.getAsHtml(lineColor) + "\""); - if (noteLabelText != null) { + if (labelText != null) { sb.append(","); sb.append("label=<"); - appendTable(sb, noteLabelText.calculateDimension(stringBounder), noteLabelColor); + appendTable(sb, labelText.calculateDimension(stringBounder), noteLabelColor); sb.append(">"); // sb.append(",labelfloat=true"); } @@ -469,11 +476,11 @@ public class Line implements Moveable, Hideable { this.extremity2 = getExtremity(linkType.getHat2(), linkType.getDecor2(), pointListIterator); this.extremity1 = getExtremity(linkType.getHat1(), linkType.getDecor1(), pointListIterator); - if (this.noteLabelText != null) { + if (this.labelText != null) { final Point2D pos = getXY(svg, this.noteLabelColor, fullHeight); if (pos != null) { corner1.manage(pos); - this.noteLabelXY = TextBlockUtils.asPositionable(noteLabelText, stringBounder, pos); + this.labelXY = TextBlockUtils.asPositionable(labelText, stringBounder, pos); } } @@ -556,13 +563,24 @@ public class Line implements Moveable, Hideable { if (link.isInvis()) { return; } - if (this.link.getSpecificColor() != null) { + + if (this.link.getColors() != null) { + final HtmlColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); + if (newColor != null) { + color = newColor; + } + + } else if (this.link.getSpecificColor() != null) { color = this.link.getSpecificColor(); } ug = ug.apply(new UChangeBackColor(null)).apply(new UChangeColor(color)); final LinkType linkType = link.getType(); - ug = ug.apply(linkType.getStroke()); + UStroke stroke = linkType.getStroke(); + if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) { + stroke = link.getColors().getSpecificLineStroke(); + } + ug = ug.apply(stroke); double moveStartX = 0; double moveStartY = 0; double moveEndX = 0; @@ -621,9 +639,9 @@ public class Line implements Moveable, Hideable { } this.extremity2.drawU(ug.apply(new UTranslate(x + moveStartX, y + moveStartY))); } - if (this.noteLabelText != null && this.noteLabelXY != null) { - this.noteLabelText.drawU(ug.apply(new UTranslate(x + this.noteLabelXY.getPosition().getX(), y - + this.noteLabelXY.getPosition().getY()))); + if (this.labelText != null && this.labelXY != null) { + this.labelText.drawU(ug.apply(new UTranslate(x + this.labelXY.getPosition().getX(), y + + this.labelXY.getPosition().getY()))); } if (this.startTailText != null) { this.startTailText.drawU(ug.apply(new UTranslate(x + this.startTailLabelXY.getPosition().getX(), y @@ -668,8 +686,8 @@ public class Line implements Moveable, Hideable { } else { return 0; } - if (noteLabelText != null) { - strategy.eat(noteLabelText.calculateDimension(stringBounder).getWidth()); + if (labelText != null) { + strategy.eat(labelText.calculateDimension(stringBounder).getWidth()); } if (startTailText != null) { strategy.eat(startTailText.calculateDimension(stringBounder).getWidth()); @@ -692,8 +710,8 @@ public class Line implements Moveable, Hideable { return 0; } final ArithmeticStrategy strategy = new ArithmeticStrategySum(); - if (noteLabelText != null) { - strategy.eat(noteLabelText.calculateDimension(stringBounder).getHeight()); + if (labelText != null) { + strategy.eat(labelText.calculateDimension(stringBounder).getHeight()); } if (startTailText != null) { strategy.eat(startTailText.calculateDimension(stringBounder).getHeight()); diff --git a/src/net/sourceforge/plantuml/svek/Shape.java b/src/net/sourceforge/plantuml/svek/Shape.java index 6bbf6eddc..9e17351ee 100644 --- a/src/net/sourceforge/plantuml/svek/Shape.java +++ b/src/net/sourceforge/plantuml/svek/Shape.java @@ -39,13 +39,14 @@ import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Hideable; +import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.cucadiagram.EntityPosition; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.posimo.Positionable; +import net.sourceforge.plantuml.svek.image.EntityImageDescription; import net.sourceforge.plantuml.svek.image.EntityImageStateBorder; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UPolygon; -import net.sourceforge.plantuml.StringUtils; public class Shape implements Positionable, IShapePseudo, Hideable { @@ -79,6 +80,11 @@ public class Shape implements Positionable, IShapePseudo, Hideable { this.cluster = cluster; } + @Override + public String toString() { + return super.toString() + " " + image + " " + type; + } + public Shape(IEntityImage image, ShapeType type, double width, double height, ColorSequence colorSequence, boolean top, int shield, EntityPosition entityPosition) { this.entityPosition = entityPosition; @@ -178,7 +184,7 @@ public class Shape implements Positionable, IShapePseudo, Hideable { private void appendShapeInternal(StringBuilder sb) { if (type == ShapeType.RECTANGLE && shield > 0) { throw new UnsupportedOperationException(); - } else if (type == ShapeType.RECTANGLE) { + } else if (type == ShapeType.RECTANGLE || type == ShapeType.FOLDER) { sb.append("shape=rect"); } else if (type == ShapeType.OCTAGON) { sb.append("shape=octagon"); @@ -264,4 +270,18 @@ public class Shape implements Positionable, IShapePseudo, Hideable { return new Point2D.Double(minX + x, minY + y); } + public Point2D projection(Point2D pt, StringBounder stringBounder) { + if (getType() != ShapeType.FOLDER) { + return pt; + } + final ClusterPosition clusterPosition = new ClusterPosition(minX, minY, minX + width, minY + height); + if (clusterPosition.isPointJustUpper(pt)) { + final Dimension2D dimName = ((EntityImageDescription) image).getNameDimension(stringBounder); + if (pt.getX() < minX + dimName.getWidth()) { + return pt; + } + return new Point2D.Double(pt.getX(), pt.getY() + dimName.getHeight() + 4); + } + return pt; + } } diff --git a/src/net/sourceforge/plantuml/svek/ShapeType.java b/src/net/sourceforge/plantuml/svek/ShapeType.java index 8373a6dd9..0711111d5 100644 --- a/src/net/sourceforge/plantuml/svek/ShapeType.java +++ b/src/net/sourceforge/plantuml/svek/ShapeType.java @@ -35,6 +35,6 @@ package net.sourceforge.plantuml.svek; public enum ShapeType { - RECTANGLE, ROUND_RECTANGLE, CIRCLE, CIRCLE_IN_RECT, OVAL, DIAMOND, OCTAGON + RECTANGLE, ROUND_RECTANGLE, CIRCLE, CIRCLE_IN_RECT, OVAL, DIAMOND, OCTAGON, FOLDER } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java b/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java index 6bad097ee..bd629dfe0 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageActivity.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -49,6 +48,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Shape; @@ -74,8 +74,8 @@ public class EntityImageActivity extends AbstractEntityImage { this.bibliotekon = bibliotekon; final Stereotype stereotype = entity.getStereotype(); - this.desc = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.ACTIVITY, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.ACTIVITY, stereotype), - getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.ACTIVITY, stereotype), + HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); } @@ -133,7 +133,7 @@ public class EntityImageActivity extends AbstractEntityImage { private UGraphic applyColors(UGraphic ug) { ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBorder, getStereo()))); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.activityBackground, getStereo()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java index 736600056..b1e1c40bd 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageArcCircle.java @@ -64,16 +64,15 @@ public class EntityImageArcCircle extends AbstractEntityImage { final Stereotype stereotype = entity.getStereotype(); - this.name = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.COMPONENT, stereotype), SkinParamUtils.getFontColor(getSkinParam(), - FontParam.COMPONENT, stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.name = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.COMPONENT, stereotype), + HorizontalAlignment.CENTER, skinParam); if (stereotype == null || stereotype.getLabel(false) == null) { this.stereo = null; } else { - this.stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.COMPONENT_STEREOTYPE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), - FontParam.COMPONENT_STEREOTYPE, null), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create( + new FontConfiguration(getSkinParam(), FontParam.COMPONENT_STEREOTYPE, stereotype), + HorizontalAlignment.CENTER, skinParam); } } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java index ad66931f5..84aaaef48 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java @@ -52,6 +52,7 @@ import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.Shadowable; @@ -74,15 +75,15 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { final private LineConfigurable lineConfig; public EntityImageClass(GraphvizVersion version, ILeaf entity, ISkinParam skinParam, PortionShower portionShower) { - super(entity, skinParam); + super(entity, entity.getColors(skinParam).mute(skinParam)); this.lineConfig = entity; - this.roundCorner = skinParam.getRoundCorner(); + this.roundCorner = getSkinParam().getRoundCorner(); this.shield = version != null && version.useShield() && entity.hasNearDecoration() ? 16 : 0; final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity); final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity); - this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, skinParam, showMethods, showFields); + this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, getSkinParam(), showMethods, showFields); - header = new EntityImageClassHeader2(entity, skinParam, portionShower); + header = new EntityImageClassHeader2(entity, getSkinParam(), portionShower); this.url = entity.getUrl99(); } @@ -133,12 +134,12 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { rect.setDeltaShadow(4); } - HtmlColor classBorder = lineConfig.getSpecificLineColor(); + HtmlColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); if (classBorder == null) { classBorder = SkinParamUtils.getColor(getSkinParam(), ColorParam.classBorder, getStereo()); } ug = ug.apply(new UChangeColor(classBorder)); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.classBackground, getStereo()); } @@ -147,8 +148,10 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { final UStroke stroke = getStroke(); ug.apply(stroke).draw(rect); - final HtmlColor headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), - false); + HtmlColor headerBackcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.HEADER); + if (headerBackcolor == null) { + headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false); + } if (headerBackcolor != null) { final Shadowable rect2 = new URectangle(widthTotal, dimHeader.getHeight()); ug.apply(new UChangeBackColor(headerBackcolor)).apply(stroke).draw(rect2); @@ -163,7 +166,7 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil { } private UStroke getStroke() { - UStroke stroke = lineConfig.getSpecificLineStroke(); + UStroke stroke = lineConfig.getColors(getSkinParam()).getSpecificLineStroke(); if (stroke == null) { stroke = getSkinParam().getThickness(LineParam.classBorder, getStereo()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java index 2870195e7..dcdd931e1 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader2.java @@ -73,9 +73,7 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { final HtmlColor color = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS, getStereo()); final Stereotype stereotype = entity.getStereotype(); final String generic = entity.getGeneric(); - FontConfiguration fontConfigurationName = new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.CLASS, stereotype), color, getSkinParam().getHyperlinkColor(), getSkinParam() - .useUnderlineForHyperlink()); + FontConfiguration fontConfigurationName = new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype); if (italic) { fontConfigurationName = fontConfigurationName.italic(); } @@ -90,11 +88,8 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { } else { stereo = TextBlockUtils.withMargin( Display.create(stereotype.getLabels(skinParam.useGuillemet())).create( - new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.CLASS_STEREOTYPE, - stereotype), SkinParamUtils.getFontColor(getSkinParam(), - FontParam.CLASS_STEREOTYPE, stereotype), getSkinParam().getHyperlinkColor(), - getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam), - 1, 0); + new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), + HorizontalAlignment.CENTER, skinParam), 1, 0); } TextBlock genericBlock; @@ -102,10 +97,7 @@ public class EntityImageClassHeader2 extends AbstractEntityImage { genericBlock = null; } else { genericBlock = Display.getWithNewlines(generic).create( - new FontConfiguration( - SkinParamUtils.getFont(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), - SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), - skinParam.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), + new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam); genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1); final HtmlColor classBackground = SkinParamUtils diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index 0b4727f68..2f58b0543 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -54,6 +54,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbolFolder; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -61,28 +62,33 @@ import net.sourceforge.plantuml.ugraphic.UStroke; public class EntityImageDescription extends AbstractEntityImage { + private final ShapeType shapeType; + final private Url url; private final TextBlock asSmall; + private final TextBlock name; + public EntityImageDescription(ILeaf entity, ISkinParam skinParam, PortionShower portionShower) { - super(entity, skinParam); + super(entity, entity.getColors(skinParam).mute(skinParam)); final Stereotype stereotype = entity.getStereotype(); - final USymbol symbol = entity.getUSymbol() == null ? (skinParam.useUml2ForComponent() ? USymbol.COMPONENT2 + final USymbol symbol = entity.getUSymbol() == null ? (getSkinParam().useUml2ForComponent() ? USymbol.COMPONENT2 : USymbol.COMPONENT1) : entity.getUSymbol(); if (symbol == null) { throw new IllegalArgumentException(); } + shapeType = symbol == USymbol.FOLDER ? ShapeType.FOLDER : ShapeType.RECTANGLE; final Display codeDisplay = Display.getWithNewlines(entity.getCode()); final TextBlock desc = (entity.getDisplay().equals(codeDisplay) && symbol instanceof USymbolFolder) || entity.getDisplay().isWhite() ? TextBlockUtils.empty(0, 0) : new BodyEnhanced(entity.getDisplay(), - symbol.getFontParam(), skinParam, HorizontalAlignment.CENTER, stereotype, + symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, false); this.url = entity.getUrl99(); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBack(), getStereo()); } @@ -96,18 +102,20 @@ public class EntityImageDescription extends AbstractEntityImage { if (stereotype != null && stereotype.getLabel(false) != null && portionShower.showPortion(EntityPortion.STEREOTYPE, entity)) { stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create( - new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), symbol.getFontParamStereotype(), - stereotype), SkinParamUtils.getFontColor(getSkinParam(), symbol.getFontParamStereotype(), - null), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), - HorizontalAlignment.CENTER, skinParam); + new FontConfiguration(getSkinParam(), symbol.getFontParamStereotype(), stereotype), + HorizontalAlignment.CENTER, getSkinParam()); } - final TextBlock name = new BodyEnhanced(codeDisplay, symbol.getFontParam(), skinParam, - HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, false); + name = new BodyEnhanced(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER, + stereotype, symbol.manageHorizontalLine(), false, false); asSmall = symbol.asSmall(name, desc, stereo, ctx); } + public Dimension2D getNameDimension(StringBounder stringBounder) { + return name.calculateDimension(stringBounder); + } + public Dimension2D calculateDimension(StringBounder stringBounder) { return asSmall.calculateDimension(stringBounder); } @@ -124,7 +132,7 @@ public class EntityImageDescription extends AbstractEntityImage { } public ShapeType getShapeType() { - return ShapeType.RECTANGLE; + return shapeType; } public int getShield() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java index e1356f30c..bd0b5bd2b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Cluster; import net.sourceforge.plantuml.svek.ClusterDecoration; @@ -67,12 +68,10 @@ public class EntityImageEmptyPackage extends AbstractEntityImage { public EntityImageEmptyPackage(ILeaf entity, ISkinParam skinParam) { super(entity, skinParam); this.skinParam = skinParam; - this.specificBackColor = entity.getSpecificBackColor(); + this.specificBackColor = entity.getColors(skinParam).getColor(ColorType.BACK); this.stereotype = entity.getStereotype(); this.desc = entity.getDisplay().create( - new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.PACKAGE, stereotype), - SkinParamUtils.getFontColor(getSkinParam(), FontParam.PACKAGE, stereotype), getSkinParam() - .getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), + new FontConfiguration(getSkinParam(), FontParam.PACKAGE, stereotype), HorizontalAlignment.CENTER, skinParam); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java index 337347824..520bd2482 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -66,9 +65,8 @@ public class EntityImageLollipopInterface extends AbstractEntityImage { public EntityImageLollipopInterface(ILeaf entity, ISkinParam skinParam) { super(entity, skinParam); final Stereotype stereotype = entity.getStereotype(); - this.desc = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.CLASS, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS, - stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype), + HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java index ace70378b..64530efc5 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye1.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -72,9 +71,8 @@ public class EntityImageLollipopInterfaceEye1 extends AbstractEntityImage { super(entity, skinParam); this.bibliotekon = bibliotekon; final Stereotype stereotype = entity.getStereotype(); - this.desc = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.CLASS, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS, - stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype), + HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java index 60b4e676b..4cbdd7cd6 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java @@ -53,6 +53,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UEllipse; @@ -83,7 +84,7 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage { this.url = entity.getUrl99(); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBack(), getStereo()); } @@ -94,9 +95,9 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage { if (stereotype != null && stereotype.getLabel(false) != null && portionShower.showPortion(EntityPortion.STEREOTYPE, entity)) { - stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - symbol.getFontParamStereotype(), stereotype), SkinParamUtils.getFontColor(getSkinParam(), - symbol.getFontParamStereotype(), null), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create( + new FontConfiguration(getSkinParam(), symbol.getFontParamStereotype(), stereotype), + HorizontalAlignment.CENTER, skinParam); } else { 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 018322519..212a9960e 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamBackcolored; +import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; @@ -57,6 +58,8 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.posimo.DotPath; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.AbstractEntityImage; @@ -65,7 +68,6 @@ import net.sourceforge.plantuml.svek.Shape; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.ULine; @@ -87,35 +89,42 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { private final TextBlock textBlock; public EntityImageNote(ILeaf entity, ISkinParam skinParam) { - super(entity, getSkin(skinParam, entity)); - this.skinParam = skinParam; + super(entity, getSkin(getISkinParam(skinParam, entity), entity)); + this.skinParam = getISkinParam(skinParam, entity); - this.withShadow = skinParam.shadowing(); + this.withShadow = getSkinParam().shadowing(); final Display strings = entity.getDisplay(); final Rose rose = new Rose(); - if (entity.getSpecificBackColor() == null) { - noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + if (entity.getColors(getSkinParam()).getColor(ColorType.BACK) == null) { + noteBackgroundColor = rose.getHtmlColor(getSkinParam(), ColorParam.noteBackground); } else { - noteBackgroundColor = entity.getSpecificBackColor(); + noteBackgroundColor = entity.getColors(getSkinParam()).getColor(ColorType.BACK); } - this.borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); - final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); + // this.borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + this.borderColor = SkinParamUtils.getColor(getSkinParam(), ColorParam.noteBorder, null); + // final HtmlColor fontColor = rose.getFontColor(getSkinParam(), FontParam.NOTE); + // final UFont fontNote = getSkinParam().getFont(FontParam.NOTE, null, false); if (strings.size() == 1 && strings.get(0).length() == 0) { textBlock = new TextBlockEmpty(); } else { - textBlock = new BodyEnhanced2(strings, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, - new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink())); + textBlock = new BodyEnhanced2(strings, FontParam.NOTE, getSkinParam(), HorizontalAlignment.LEFT, + new FontConfiguration(getSkinParam(), FontParam.NOTE, null)); } } + private static ISkinParam getISkinParam(ISkinParam skinParam, IEntity entity) { + if (entity.getColors(skinParam) != null) { + return entity.getColors(skinParam).mute(skinParam); + } + return skinParam; + } + static ISkinParam getSkin(ISkinParam skinParam, IEntity entity) { final Stereotype stereotype = entity.getStereotype(); - HtmlColor back = entity.getSpecificBackColor(); + HtmlColor back = entity.getColors(skinParam).getColor(ColorType.BACK); if (back != null) { return new SkinParamBackcolored(skinParam, back); } @@ -190,20 +199,27 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { if (p1.distance(center) > p2.distance(center)) { path = path.reverse(); p1 = path.getStartPoint(); - p2 = path.getEndPoint(); + // p2 = path.getEndPoint(); } final Direction strategy = getOpaleStrategy(textWidth, textHeight, p1); final Point2D pp1 = path.getStartPoint(); final Point2D pp2 = path.getEndPoint(); + final Point2D newRefpp2 = move(pp2, shape.getMinX(), shape.getMinY()); + final Point2D projection = move(other.projection(newRefpp2, stringBounder), -shape.getMinX(), + -shape.getMinY()); final Opale opale = new Opale(borderColor, noteBackgroundColor, textBlock, skinParam.shadowing(), true); - opale.setOpale(strategy, pp1, pp2); - opale.drawU(ug2); + opale.setOpale(strategy, pp1, projection); + opale.drawU(Colors.applyStroke(ug2, getEntity().getColors(skinParam))); } if (url != null) { ug.closeAction(); } } + private static Point2D move(Point2D pt, double dx, double dy) { + return new Point2D.Double(pt.getX() + dx, pt.getY() + dy); + } + private void drawNormal(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final UPolygon polygon = getPolygonNormal(stringBounder); @@ -260,11 +276,12 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { private Line opaleLine; private Shape shape; + private Shape other; - public void setOpaleLine(Line line, Shape shape) { + public void setOpaleLine(Line line, Shape shape, Shape other) { this.opaleLine = line; this.shape = shape; - + this.other = other; } public double getStartingX(StringBounder stringBounder, double y) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java index 96818b252..181df4aaa 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNoteLink.java @@ -37,11 +37,11 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; @@ -55,9 +55,9 @@ public class EntityImageNoteLink extends AbstractTextBlock implements IEntityIma private final Component comp; - public EntityImageNoteLink(Display note, HtmlColor htmlColor, ISkinParam skinParam) { + public EntityImageNoteLink(Display note, Colors colors, ISkinParam skinParam) { final Rose skin = new Rose(); - comp = skin.createComponent(ComponentType.NOTE, null, new SkinParamBackcolored(skinParam, htmlColor), note); + comp = skin.createComponent(ComponentType.NOTE, null, colors.mute(skinParam), note); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java index 792b13c67..a72ed1c83 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java @@ -45,10 +45,7 @@ import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.cucadiagram.EntityPortion; -import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.cucadiagram.PortionShower; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -58,6 +55,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2; @@ -86,16 +84,15 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { this.lineConfig = entity; final Stereotype stereotype = entity.getStereotype(); this.roundCorner = skinParam.getRoundCorner(); - this.name = TextBlockUtils.withMargin(entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.OBJECT, stereotype), - SkinParamUtils.getFontColor(getSkinParam(), FontParam.OBJECT, stereotype), getSkinParam() - .getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam), 2, 2); + this.name = TextBlockUtils.withMargin( + entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype), + HorizontalAlignment.CENTER, skinParam), 2, 2); if (stereotype == null || stereotype.getLabel(false) == null) { this.stereo = null; } else { - this.stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.OBJECT_STEREOTYPE, - stereotype), SkinParamUtils.getFontColor(getSkinParam(), - FontParam.OBJECT_STEREOTYPE, stereotype), getSkinParam().getHyperlinkColor(), - getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create( + new FontConfiguration(getSkinParam(), FontParam.OBJECT_STEREOTYPE, stereotype), + HorizontalAlignment.CENTER, skinParam); } if (entity.getBodier().getFieldsToDisplay().size() == 0) { @@ -131,7 +128,7 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { } ug = ug.apply(new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.objectBorder, getStereo()))); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.objectBackground, getStereo()); } @@ -159,7 +156,7 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { } private UStroke getStroke() { - UStroke stroke = lineConfig.getSpecificLineStroke(); + UStroke stroke = lineConfig.getColors(getSkinParam()).getSpecificLineStroke(); if (stroke == null) { stroke = getSkinParam().getThickness(LineParam.objectBorder, getStereo()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java b/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java index a4571cb52..6752e9756 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImagePseudoState.java @@ -47,7 +47,6 @@ 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.graphic.TextBlockUtils; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -65,9 +64,8 @@ public class EntityImagePseudoState extends AbstractEntityImage { public EntityImagePseudoState(ILeaf entity, ISkinParam skinParam) { super(entity, skinParam); final Stereotype stereotype = entity.getStereotype(); - this.desc = Display.create("H").create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.STATE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.STATE, - stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.desc = Display.create("H").create(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype), + HorizontalAlignment.CENTER, skinParam); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java index 0c57806fb..d513efd8f 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java @@ -52,6 +52,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.Shadowable; @@ -88,9 +89,8 @@ public class EntityImageState extends AbstractEntityImage { final Stereotype stereotype = entity.getStereotype(); this.withSymbol = stereotype != null && stereotype.isWithOOSymbol(); - this.desc = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.STATE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.STATE, - stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype), + HorizontalAlignment.CENTER, skinParam); Display list = Display.empty(); for (Member att : entity.getBodier().getFieldsToDisplay()) { @@ -99,9 +99,8 @@ public class EntityImageState extends AbstractEntityImage { this.url = entity.getUrl99(); - this.fields = list.create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.STATE_ATTRIBUTE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), - FontParam.STATE_ATTRIBUTE, stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.LEFT, skinParam); + this.fields = list.create(new FontConfiguration(getSkinParam(), FontParam.STATE_ATTRIBUTE, stereotype), + HorizontalAlignment.LEFT, skinParam); } @@ -131,12 +130,12 @@ public class EntityImageState extends AbstractEntityImage { rect.setDeltaShadow(4); } - HtmlColor classBorder = lineConfig.getSpecificLineColor(); + HtmlColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); if (classBorder == null) { classBorder = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBorder, getStereo()); } ug = ug.apply(getStroke()).apply(new UChangeColor(classBorder)); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBackground, getStereo()); } @@ -169,7 +168,7 @@ public class EntityImageState extends AbstractEntityImage { } private UStroke getStroke() { - UStroke stroke = lineConfig.getSpecificLineStroke(); + UStroke stroke = lineConfig.getColors(getSkinParam()).getSpecificLineStroke(); if (stroke == null) { stroke = new UStroke(1.5); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java index 0d19ac25f..e6a12de2a 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -76,7 +77,7 @@ public class EntityImageState2 extends AbstractEntityImage { final USymbol symbol = USymbol.FRAME; - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), symbol.getColorParamBack(), getStereo()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java index c476ec1d7..b68cc6827 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java @@ -41,7 +41,6 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; -import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPosition; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -50,6 +49,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Cluster; @@ -83,8 +83,8 @@ public class EntityImageStateBorder extends AbstractEntityImage { this.stateParent = stateParent; final Stereotype stereotype = leaf.getStereotype(); - this.desc = leaf.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), FontParam.STATE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.STATE, stereotype), - getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.desc = leaf.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype), + HorizontalAlignment.CENTER, skinParam); } private boolean upPosition() { @@ -120,7 +120,7 @@ public class EntityImageStateBorder extends AbstractEntityImage { ug = ug.apply(new UStroke(1.5)).apply( new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBorder, getStereo()))); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBackground, getStereo()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java index 79df883cf..88984a348 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateEmptyDescription.java @@ -50,7 +50,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.Shadowable; @@ -73,9 +73,8 @@ public class EntityImageStateEmptyDescription extends AbstractEntityImage { super(entity, skinParam); final Stereotype stereotype = entity.getStereotype(); - this.desc = entity.getDisplay().create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.STATE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), FontParam.STATE, - stereotype), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype), + HorizontalAlignment.CENTER, skinParam); Display list = Display.empty(); for (Member att : entity.getBodier().getFieldsToDisplay()) { @@ -109,7 +108,7 @@ public class EntityImageStateEmptyDescription extends AbstractEntityImage { ug = ug.apply(new UStroke(1.5)).apply( new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBorder, getStereo()))); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.stateBackground, getStereo()); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java index aafc88e5b..52d45dda9 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java @@ -40,7 +40,6 @@ import java.util.Map; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.command.Position; @@ -48,18 +47,17 @@ import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; -import net.sourceforge.plantuml.cucadiagram.PortionShower; 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.TextBlock; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Shape; import net.sourceforge.plantuml.svek.ShapeType; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -80,10 +78,10 @@ public class EntityImageTips extends AbstractEntityImage { this.skinParam = skinParam; this.bibliotekon = bibliotekon; - if (entity.getSpecificBackColor() == null) { + if (entity.getColors(skinParam).getColor(ColorType.BACK) == null) { noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); } else { - noteBackgroundColor = entity.getSpecificBackColor(); + noteBackgroundColor = entity.getColors(skinParam).getColor(ColorType.BACK); } this.borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); } @@ -152,12 +150,10 @@ public class EntityImageTips extends AbstractEntityImage { } private Opale getOpale(final Display display) { - final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); - final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); - + // final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); + // final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); final TextBlock textBlock = new BodyEnhanced2(display, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, - new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), - skinParam.useUnderlineForHyperlink())); + new FontConfiguration(skinParam, FontParam.NOTE, null)); final Opale opale = new Opale(borderColor, noteBackgroundColor, textBlock, skinParam.shadowing(), true); return opale; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java index 4f30b10e2..03622f34c 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; @@ -81,9 +82,9 @@ public class EntityImageUseCase extends AbstractEntityImage { if (stereotype == null || stereotype.getLabel(false) == null) { this.desc = tmp; } else { - final TextBlock stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())).create(new FontConfiguration(SkinParamUtils.getFont(getSkinParam(), - FontParam.ACTOR_STEREOTYPE, stereotype), SkinParamUtils.getFontColor(getSkinParam(), - FontParam.ACTOR_STEREOTYPE, null), getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER, skinParam); + final TextBlock stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().useGuillemet())) + .create(new FontConfiguration(getSkinParam(), FontParam.ACTOR_STEREOTYPE, stereotype), + HorizontalAlignment.CENTER, skinParam); this.desc = TextBlockUtils.mergeTB(stereo, tmp, HorizontalAlignment.CENTER); } this.url = entity.getUrl99(); @@ -107,7 +108,7 @@ public class EntityImageUseCase extends AbstractEntityImage { ug = ug.apply(stroke).apply( new UChangeColor(SkinParamUtils.getColor(getSkinParam(), ColorParam.usecaseBorder, getStereo()))); - HtmlColor backcolor = getEntity().getSpecificBackColor(); + HtmlColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { backcolor = SkinParamUtils.getColor(getSkinParam(), ColorParam.usecaseBackground, getStereo()); } diff --git a/src/net/sourceforge/plantuml/ugraphic/FontChecker.java b/src/net/sourceforge/plantuml/ugraphic/FontChecker.java index bcaa26030..4f140f8d2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/FontChecker.java +++ b/src/net/sourceforge/plantuml/ugraphic/FontChecker.java @@ -165,7 +165,8 @@ public class FontChecker { public BufferedImage getBufferedImage(final char c) throws IOException { assert c != '\t'; - final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1, null, null, null, 0, 0, null, false); + final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1, null, null, null, 0, 0, null, + false); final double dim = 20; imageBuilder.addUDrawable(new UDrawable() { public void drawU(UGraphic ug) { @@ -173,8 +174,7 @@ public class FontChecker { ug.draw(new URectangle(dim - 1, dim - 1)); if (ug instanceof UGraphic2) { ug = (UGraphic2) ug.apply(new UTranslate(dim / 3, 2 * dim / 3)); - final UText text = new UText("" + c, new FontConfiguration(font, HtmlColorUtils.BLACK, - HtmlColorUtils.BLUE, true)); + final UText text = new UText("" + c, FontConfiguration.blackBlueTrue(font)); ug.draw(text); } } diff --git a/src/net/sourceforge/plantuml/ugraphic/UFont.java b/src/net/sourceforge/plantuml/ugraphic/UFont.java index 44db6ace2..149fef975 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UFont.java +++ b/src/net/sourceforge/plantuml/ugraphic/UFont.java @@ -61,8 +61,9 @@ public class UFont { return font; } - public FontConfiguration toFont2(HtmlColor color, boolean useUnderlineForHyperlink, HtmlColor hyperlinkColor) { - return new FontConfiguration(this, color, hyperlinkColor, useUnderlineForHyperlink); + public FontConfiguration toFont2(HtmlColor color, boolean useUnderlineForHyperlink, HtmlColor hyperlinkColor, + int tabSize) { + return new FontConfiguration(this, color, hyperlinkColor, useUnderlineForHyperlink, tabSize); } public UFont scaled(double scale) { diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 54f181bc8..b87273024 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: 16959 $ + * Revision $Revision: 17343 $ * */ package net.sourceforge.plantuml.version; @@ -39,7 +39,7 @@ import java.util.Date; public class Version { public static int version() { - return 8030; + return 8031; } public static String versionString() { @@ -63,7 +63,7 @@ public class Version { } private static long compileTime() { - return 1441532192208L; + return 1443460759164L; } public static String compileTimeString() {