From 4534dc4ee2414d61faa2d3cea856ebb912628e13 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Thu, 10 Feb 2022 19:16:18 +0100 Subject: [PATCH] Change default theme --- skin/plantuml.skin | 424 ++++++++++---- skin/{plantuml2.skin => rose.skin} | 257 +++++--- src/jcckit/util/ConfigParameters.java | 4 +- .../sourceforge/plantuml/AnnotatedWorker.java | 52 +- src/net/sourceforge/plantuml/BlockUml.java | 60 +- .../sourceforge/plantuml/BlockUmlBuilder.java | 56 +- .../sourceforge/plantuml/EmbeddedDiagram.java | 3 +- .../plantuml/FileFormatOption.java | 51 +- src/net/sourceforge/plantuml/ISkinParam.java | 2 +- src/net/sourceforge/plantuml/ISkinSimple.java | 3 + .../sourceforge/plantuml/PSystemBuilder.java | 18 +- src/net/sourceforge/plantuml/SkinParam.java | 444 +++++++------- .../plantuml/SkinParamDelegator.java | 9 +- .../plantuml/SourceFileReaderAbstract.java | 12 +- .../plantuml/SourceStringReader.java | 37 +- .../sourceforge/plantuml/SpriteContainer.java | 1 + .../plantuml/SpriteContainerEmpty.java | 3 +- .../sourceforge/plantuml/TitledDiagram.java | 9 +- src/net/sourceforge/plantuml/UmlDiagram.java | 79 ++- src/net/sourceforge/plantuml/UseStyle.java | 11 +- .../acearth/PSystemXearthFactory.java | 13 +- .../activitydiagram/ActivityDiagram.java | 5 +- .../ActivityDiagramFactory.java | 5 +- .../activitydiagram3/ActivityDiagram3.java | 78 +-- .../ActivityDiagramFactory3.java | 7 +- .../activitydiagram3/ftile/Hexagon.java | 6 +- .../vcompact/FtileFactoryDelegatorSwitch.java | 18 +- .../ftile/vcompact/FtileGroup.java | 31 +- .../ftile/vcompact/FtileSwitch.java | 34 +- .../ftile/vcompact/VCompactFactory.java | 10 +- .../ftile/vcompact/cond/FtileSwitchNude.java | 28 +- .../cond/FtileSwitchWithDiamonds.java | 27 +- .../cond/FtileSwitchWithManyLinks.java | 26 +- .../vcompact/cond/FtileSwitchWithOneLink.java | 7 +- .../ftile/vertical/FtileBlackBlock.java | 9 +- .../ftile/vertical/FtileCircleEnd.java | 17 +- .../ftile/vertical/FtileCircleStart.java | 19 +- .../ftile/vertical/FtileCircleStop.java | 17 +- .../ftile/vertical/FtileDiamondSquare.java | 7 +- .../plantuml/api/PSystemFactory.java | 2 +- .../plantuml/{ => api}/ThemeStyle.java | 4 +- .../plantuml/board/BoardDiagram.java | 9 +- .../plantuml/board/BoardDiagramFactory.java | 7 +- .../sourceforge/plantuml/bpm/BpmDiagram.java | 14 +- .../plantuml/bpm/BpmDiagramFactory.java | 5 +- .../plantuml/braille/BrailleDrawer.java | 4 +- .../classdiagram/AbstractEntityDiagram.java | 5 +- .../plantuml/classdiagram/ClassDiagram.java | 12 +- .../classdiagram/ClassDiagramFactory.java | 7 +- .../command/CommandAssumeTransparent.java | 6 +- .../plantuml/command/PSystemBasicFactory.java | 11 +- .../command/PSystemCommandFactory.java | 7 +- .../command/PSystemSingleLineFactory.java | 18 +- .../compositediagram/CompositeDiagram.java | 5 +- .../CompositeDiagramFactory.java | 7 +- .../plantuml/creole/legacy/PSystemCreole.java | 2 +- .../creole/legacy/PSystemCreoleFactory.java | 9 +- .../plantuml/cucadiagram/CucaDiagram.java | 5 +- .../plantuml/cucadiagram/DisplaySection.java | 28 +- .../plantuml/cucadiagram/WithLinkType.java | 2 +- .../definition/PSystemDefinitionFactory.java | 9 +- .../descdiagram/DescriptionDiagram.java | 5 +- .../DescriptionDiagramFactory.java | 7 +- .../descdiagram/command/CommandNewpage.java | 9 +- .../plantuml/directdot/PSystemDotFactory.java | 9 +- .../plantuml/ditaa/PSystemDitaaFactory.java | 30 +- .../plantuml/eggs/PSystemWelcomeFactory.java | 7 +- src/net/sourceforge/plantuml/elk/ElkPath.java | 69 ++- .../plantuml/error/PSystemErrorUtils.java | 30 +- .../flashcode/FlashCodeUtilsZxing.java | 3 +- .../plantuml/flowdiagram/FlowDiagram.java | 16 +- .../flowdiagram/FlowDiagramFactory.java | 5 +- .../sourceforge/plantuml/gitlog/GNode.java | 24 +- .../plantuml/gitlog/GitDiagram.java | 10 +- .../plantuml/gitlog/GitDiagramFactory.java | 9 +- .../sourceforge/plantuml/gitlog/MagicBox.java | 21 +- .../plantuml/gitlog/SmetanaForGit.java | 18 +- .../plantuml/graphic/ColorAndSizeChange.java | 2 +- .../plantuml/graphic/ColorChange.java | 2 +- .../plantuml/graphic/FontConfiguration.java | 2 +- .../plantuml/graphic/HtmlCommandFactory.java | 2 +- .../sourceforge/plantuml/graphic/Rainbow.java | 2 +- .../plantuml/graphic/Splitter.java | 2 +- .../plantuml/graphic/USymbolRectangle.java | 8 +- .../plantuml/graphic/color/ColorParser.java | 2 +- .../plantuml/graphic/color/Colors.java | 2 +- .../plantuml/hcl/HclDiagramFactory.java | 5 +- src/net/sourceforge/plantuml/help/Help.java | 12 +- .../plantuml/help/HelpFactory.java | 5 +- .../plantuml/jcckit/PSystemJcckitFactory.java | 6 +- .../plantuml/jsondiagram/JsonDiagram.java | 6 +- .../jsondiagram/JsonDiagramFactory.java | 13 +- .../plantuml/logo/PSystemLogoFactory.java | 6 +- .../plantuml/math/PSystemLatexFactory.java | 8 +- .../plantuml/math/PSystemMathFactory.java | 8 +- .../plantuml/mindmap/MindMapDiagram.java | 5 +- .../mindmap/MindMapDiagramFactory.java | 5 +- .../plantuml/nwdiag/NwDiagram.java | 5 +- .../plantuml/nwdiag/NwDiagramFactory.java | 7 +- .../AbstractClassOrObjectDiagram.java | 5 +- .../plantuml/oregon/PSystemOregonFactory.java | 14 +- .../sourceforge/plantuml/posimo/DotPath.java | 142 +++-- .../plantuml/project/GanttDiagram.java | 5 +- .../plantuml/project/GanttDiagramFactory.java | 7 +- .../plantuml/project/draw/TimeHeader.java | 2 +- .../project/draw/TimeHeaderCalendar.java | 2 +- .../project/draw/TimeHeaderDaily.java | 2 +- .../project/draw/TimeHeaderMonthly.java | 2 +- .../project/draw/TimeHeaderQuarterly.java | 2 +- .../project/draw/TimeHeaderSimple.java | 2 +- .../project/draw/TimeHeaderWeekly.java | 2 +- .../project/draw/TimeHeaderYearly.java | 2 +- .../sourceforge/plantuml/salt/Dictionary.java | 4 +- .../plantuml/salt/PSystemSalt.java | 19 +- .../plantuml/salt/PSystemSaltFactory.java | 9 +- .../plantuml/salt/PSystemSaltFactory2.java | 7 +- .../salt/element/AbstractElement.java | 45 +- .../salt/element/AbstractElementText.java | 2 +- .../plantuml/salt/element/ElementButton.java | 11 +- .../salt/element/ElementDroplist.java | 7 +- .../plantuml/salt/element/ElementImage.java | 13 +- .../plantuml/salt/element/ElementLine.java | 3 +- .../plantuml/salt/element/ElementMenuBar.java | 11 +- .../salt/element/ElementMenuEntry.java | 1 + .../salt/element/ElementMenuPopup.java | 16 +- .../plantuml/salt/element/ElementPyramid.java | 34 +- .../salt/element/ElementPyramidScrolled.java | 29 +- .../salt/element/ElementRadioCheckbox.java | 5 +- .../plantuml/salt/element/ElementTabBar.java | 15 +- .../plantuml/salt/element/ElementTree.java | 8 +- .../plantuml/salt/element/Grid.java | 7 +- .../sequencediagram/InGroupableList.java | 82 ++- .../plantuml/sequencediagram/LinkAnchor.java | 25 +- .../plantuml/sequencediagram/Reference.java | 9 +- .../sequencediagram/SequenceDiagram.java | 5 +- .../SequenceDiagramFactory.java | 7 +- .../sequencediagram/command/CommandArrow.java | 2 +- .../teoz/CommunicationTileSelfNoteRight.java | 4 +- .../skin/rose/ComponentRoseActiveLine.java | 2 +- .../skin/rose/ComponentRoseDivider.java | 19 +- .../rose/ComponentRoseGroupingHeader.java | 29 +- .../plantuml/skin/rose/ComponentRoseLine.java | 2 +- .../plantuml/sprite/ListSpriteDiagram.java | 12 +- .../sprite/ListSpriteDiagramFactory.java | 7 +- .../plantuml/sprite/SpriteMonochrome.java | 106 ++-- .../plantuml/sprite/StdlibDiagram.java | 19 +- .../plantuml/sprite/StdlibDiagramFactory.java | 5 +- .../plantuml/statediagram/StateDiagram.java | 5 +- .../statediagram/StateDiagramFactory.java | 7 +- .../plantuml/style/DarkString.java | 94 +++ .../plantuml/style/FromSkinparamToStyle.java | 23 +- src/net/sourceforge/plantuml/style/PName.java | 28 +- src/net/sourceforge/plantuml/style/SName.java | 4 + src/net/sourceforge/plantuml/style/Style.java | 29 +- .../plantuml/style/StyleLoader.java | 4 +- src/net/sourceforge/plantuml/style/Value.java | 2 +- .../plantuml/style/ValueAbstract.java | 2 +- .../plantuml/style/ValueColor.java | 2 +- .../plantuml/style/ValueForDark.java | 97 --- .../sourceforge/plantuml/style/ValueImpl.java | 77 ++- .../sourceforge/plantuml/style/ValueNull.java | 2 +- .../sourceforge/plantuml/svek/Cluster.java | 10 +- .../plantuml/svek/GeneralImageBuilder.java | 7 +- .../sourceforge/plantuml/svek/SvekLine.java | 4 +- .../sourceforge/plantuml/svek/SvekResult.java | 31 +- .../svek/image/EntityImageCircleEnd.java | 2 +- .../svek/image/EntityImageCircleStart.java | 2 +- .../image/EntityImageLollipopInterface.java | 73 ++- .../plantuml/svek/image/EntityImageMap.java | 62 +- .../plantuml/svek/image/EntityImageNote.java | 77 +-- .../svek/image/EntityImageObject.java | 77 +-- .../plantuml/svek/image/EntityImagePort.java | 44 +- .../svek/image/EntityImageStateBorder.java | 49 +- .../svek/image/EntityImageSynchroBar.java | 18 +- .../plantuml/svek/image/EntityImageTips.java | 49 +- .../svek/image/EntityImageUseCase.java | 37 +- .../sourceforge/plantuml/svg/SvgGraphics.java | 7 +- .../plantuml/timingdiagram/ChangeState.java | 23 +- .../plantuml/timingdiagram/Highlight.java | 35 +- .../plantuml/timingdiagram/Player.java | 44 +- .../plantuml/timingdiagram/PlayerAnalog.java | 74 +-- .../plantuml/timingdiagram/PlayerBinary.java | 10 +- .../plantuml/timingdiagram/PlayerClock.java | 15 +- .../timingdiagram/PlayerRobustConcise.java | 75 ++- .../timingdiagram/TimeConstraint.java | 23 +- .../plantuml/timingdiagram/TimingDiagram.java | 75 ++- .../timingdiagram/TimingDiagramFactory.java | 7 +- .../plantuml/timingdiagram/TimingNote.java | 39 +- .../plantuml/timingdiagram/TimingRuler.java | 84 ++- .../timingdiagram/graphic/Histogram.java | 143 +++-- .../timingdiagram/graphic/PlayerFrame.java | 32 +- .../timingdiagram/graphic/Ribbon.java | 69 +-- .../timingdiagram/graphic/TimeArrow.java | 6 +- .../plantuml/ugraphic/URectangle.java | 24 +- .../color/ColorMapperForceDark.java} | 82 +-- .../ugraphic/color/HColorAutomatic.java | 18 +- .../ugraphic/color/HColorBackground.java | 5 + .../plantuml/ugraphic/color/HColorSet.java | 29 +- .../plantuml/ugraphic/color/HColorSimple.java | 12 +- .../plantuml/ugraphic/color/HColorUtils.java | 8 +- .../sourceforge/plantuml/version/Version.java | 2 +- .../sourceforge/plantuml/wbs/WBSDiagram.java | 5 +- .../plantuml/wbs/WBSDiagramFactory.java | 5 +- src/net/sourceforge/plantuml/wire/Block.java | 11 +- .../plantuml/wire/CommandComponent.java | 3 +- .../plantuml/wire/CommandSpot.java | 3 +- .../plantuml/wire/CommandWLink.java | 7 +- .../plantuml/wire/WArrowDirection.java | 12 +- src/net/sourceforge/plantuml/wire/WBlock.java | 31 +- .../plantuml/wire/WLinkHorizontal.java | 18 +- .../sourceforge/plantuml/wire/WLinkType.java | 8 +- .../plantuml/wire/WLinkVertical.java | 15 +- .../plantuml/wire/WOrientation.java | 4 +- src/net/sourceforge/plantuml/wire/WPrint.java | 6 +- .../plantuml/wire/WireDiagram.java | 38 +- .../plantuml/wire/WireDiagramFactory.java | 7 +- .../plantuml/yaml/YamlDiagramFactory.java | 9 +- src/smetana/core/CString.java | 14 +- .../sourceforge/plantuml/SkinParamTest.java | 5 +- .../plantuml/ugraphic/ImageBuilderTest.java | 3 +- test/nonreg/simple/A0000_TestResult.java | 70 +-- test/nonreg/simple/A0001_TestResult.java | 198 +++---- test/nonreg/simple/A0002_TestResult.java | 90 +-- test/nonreg/simple/A0003_TestResult.java | 38 +- test/nonreg/simple/A0004_TestResult.java | 552 +++++++++--------- test/nonreg/simple/A0005_TestResult.java | 162 ++--- test/nonreg/simple/A0006_TestResult.java | 132 ++--- 227 files changed, 3664 insertions(+), 2875 deletions(-) rename skin/{plantuml2.skin => rose.skin} (65%) rename src/net/sourceforge/plantuml/{ => api}/ThemeStyle.java (95%) create mode 100644 src/net/sourceforge/plantuml/style/DarkString.java delete mode 100644 src/net/sourceforge/plantuml/style/ValueForDark.java rename src/net/sourceforge/plantuml/{style/ValueDeltaPriority.java => ugraphic/color/ColorMapperForceDark.java} (51%) diff --git a/skin/plantuml.skin b/skin/plantuml.skin index dc649f211..b813836db 100644 --- a/skin/plantuml.skin +++ b/skin/plantuml.skin @@ -8,19 +8,19 @@ root { RoundCorner 0 DiagonalCorner 0 LineThickness 1.0 - LineColor #A80036 - BackGroundColor #FEFECE + LineColor #181818 + BackGroundColor #f8f8f8 Shadowing 0.0 } document { - BackGroundColor White + BackGroundColor white header { HorizontalAlignment right FontSize 10 - FontColor #888888 - BackGroundColor none - LineColor none + FontColor #8 + BackGroundColor transparent + LineColor transparent } title { HorizontalAlignment center @@ -28,19 +28,19 @@ document { FontStyle bold Padding 5 Margin 5 - LineColor none - BackGroundColor none + LineColor transparent + BackGroundColor transparent } footer { HorizontalAlignment center FontSize 10 - FontColor #888888 - BackGroundColor none - LineColor none + FontColor #8 + BackGroundColor transparent + LineColor transparent } legend { LineColor black - BackGroundColor #DDDDDD + BackGroundColor #D FontSize 14 RoundCorner 15 Padding 6 @@ -51,8 +51,12 @@ document { FontSize 14 Padding 0 Margin 1 - LineColor none - BackGroundColor none + LineColor transparent + BackGroundColor transparent + } + frame { + LineColor black + LineThickness 1.5 } } @@ -63,60 +67,12 @@ stereotype { element { - Shadowing 4.0 + Shadowing 0.0 title { FontStyle bold } } -artifact { - Shadowing 4.0 -} -node { - Shadowing 2.0 -} -person { - Shadowing 2.0 -} -queue { - Shadowing 2.0 -} -rectangle { - Shadowing 3.0 -} -stack { - Shadowing 3.0 -} -storage { - Shadowing 3.0 -} -boundary { - Shadowing 4.0 -} -card { - Shadowing 3.0 -} -cloud { - Shadowing 3.0 -} -collections { - Shadowing 3.0 -} -component { - Shadowing 4.0 -} -database { - Shadowing 3.0 -} -file { - Shadowing 3.0 -} -frame { - Shadowing 3.0 -} -folder { - Shadowing 3.0 -} group { package { LineThickness 1.5 @@ -141,7 +97,7 @@ sequenceDiagram { } groupHeader { - BackGroundColor #EEEEEE + BackGroundColor #e LineColor black FontSize 13 FontStyle bold @@ -152,6 +108,41 @@ sequenceDiagram { LineStyle 5 } + destroy { + } + + reference { + FontSize 12 + LineColor black + BackGroundColor transparent + LineThickness 2.0 + HorizontalAlignment center + } + + referenceHeader { + LineColor black + BackGroundColor #e + FontColor black + FontSize 13 + FontStyle bold + LineThickness 2.0 + } + + box { + BackGroundColor #d + + FontSize 13 + FontStyle bold + } + + separator { + LineColor black + LineThickness 2.0 + BackGroundColor #e + + FontSize 13 + FontStyle bold + } } classDiagram { @@ -214,42 +205,6 @@ stateDiagram { } -destroy { -} - -reference { - FontSize 12 - LineColor black - BackGroundColor while - LineThickness 2.0 - HorizontalAlignment center -} - -referenceHeader { - LineColor black - BackGroundColor #EEEEEE - FontColor black - FontSize 13 - FontStyle bold - LineThickness 2.0 -} - -box { - BackGroundColor #DDDDDD - - FontSize 13 - FontStyle bold -} - -separator { - LineColor black - LineThickness 2.0 - BackGroundColor #EEEEEE - - FontSize 13 - FontStyle bold -} - delay { FontSize 11 FontStyle plain @@ -302,17 +257,13 @@ swimlane { FontSize 18 } -diamond { - Shadowing 3.0 -} - arrow { FontSize 13 } note { FontSize 13 - BackGroundColor #FBFB77 + BackGroundColor #ebebeb } partition { @@ -345,10 +296,6 @@ wbsDiagram { FontSize 12 } -activityDiagram { - Shadowing 3.0 -} - activityDiagram { activity { LineThickness 1.5 @@ -366,16 +313,23 @@ activityDiagram { arrow { FontSize 11 } -} - -activityBar { - Shadowing 3.0 - BackgroundColor black -} - -circle { - LineColor black - Shadowing 3.0 + circle { + start { + LineColor #2 + BackgroundColor #2 + } + stop { + LineColor #2 + BackgroundColor transparent + } + end { + LineColor #2 + BackgroundColor transparent + } + } + activityBar { + BackgroundColor #5 + } } @@ -395,7 +349,6 @@ ganttDiagram { } note { FontSize 9 - Shadowing 0.0 } separator { FontSize 11 @@ -409,8 +362,8 @@ ganttDiagram { LineColor #C0C0C0 } closed { - BackGroundColor #E0E8E8 - FontColor #909898 + BackGroundColor #E0E0E0 + FontColor #989898 } task { RoundCorner 0 @@ -456,27 +409,250 @@ yamlDiagram,jsonDiagram { timingDiagram { + LineColor #3 + FontColor #3 + FontStyle bold + LineThickness 1.5 + timeline { + FontStyle plain + FontSize 11 + } arrow { + LineColor darkblue LineThickness 1.5 } constraintArrow { + FontSize 12 + FontStyle plain + FontColor darkred + LineColor darkred LineThickness 1.5 } + clock { + LineColor darkgreen + } + concise { + FontSize 12 + LineColor darkgreen + BackgroundColor #c + } + robust { + FontStyle plain + FontSize 12 + LineColor darkgreen + LineThickness 2 + BackgroundColor #c + } + highlight { + BackgroundColor #e + LineThickness 2 + LineStyle 4;4 + } } nwdiagDiagram { network { FontSize 12 - Shadowing 1.0 } server { FontSize 12 } group { FontSize 12 - BackGroundColor #ddd + BackGroundColor #d } arrow { FontSize 11 } } + + +@media (prefers-color-scheme:dark) { +root { + HyperLinkColor blue + FontColor white + LineColor #e7e7e7 + BackGroundColor #070707 +} + +document { + BackGroundColor black + header { + FontColor #7 + } + footer { + FontColor #7 + } + legend { + LineColor white + BackGroundColor #2 + } + frame { + LineColor white + } +} + +group { + package { + LineColor white + } + folder { + LineColor white + } +} + +sequenceDiagram { + group { + LineColor white + } + + groupHeader { + BackGroundColor #5 + LineColor white + } + + lifeLine { + BackGroundColor black + } + reference { + LineColor #d + } + + referenceHeader { + LineColor #d + FontColor white + BackGroundColor #4 + } + + box { + BackGroundColor #2 + } + + separator { + LineColor white + BackGroundColor #1 + } + +} + +spot { + spotAnnotation { + BackgroundColor #4A0000 + } + spotAbstractClass { + BackgroundColor #2A5D60 + } + spotClass { + BackgroundColor #2E5233 + } + spotInterface { + BackgroundColor #352866 + } + spotEnum { + BackgroundColor #852D19 + } + spotEntity { + BackgroundColor #2E5233 + } +} + + +swimlane { + LineColor white +} + +note { + BackGroundColor #3 +} + + +activityDiagram { + partition { + LineColor white + } + circle { + start { + LineColor #d + BackgroundColor #d + } + stop { + LineColor #d + BackgroundColor transparent + } + end { + LineColor #d + BackgroundColor transparent + } + } + activityBar { + BackgroundColor #a + } +} + + +milestone { + BackGroundColor white + LineColor white +} + +timingDiagram { + LineColor #d + FontColor #d + arrow { + LineColor lightblue + } + constraintArrow { + LineColor tomato + FontColor tomato + } + clock { + LineColor lightgreen + } + concise { + LineColor lightgreen + BackgroundColor #6 + } + robust { + LineColor lightgreen + BackgroundColor #3 + } + highlight { + BackgroundColor #1 + } +} + + + +ganttDiagram { + timeline { + LineColor #3f3f3f + } + closed { + BackGroundColor #1f1f1f + FontColor #676767 + } + undone { + BackGroundColor black + } +} + + +yamlDiagram,jsonDiagram { + BackGroundColor black + FontColor white + LineColor white + node { + highlight { + BackGroundColor #ccff02 + } + } + + +nwdiagDiagram { + group { + BackGroundColor #2 + } +} + +} + diff --git a/skin/plantuml2.skin b/skin/rose.skin similarity index 65% rename from skin/plantuml2.skin rename to skin/rose.skin index 890b5fce5..13133d2a6 100644 --- a/skin/plantuml2.skin +++ b/skin/rose.skin @@ -8,19 +8,19 @@ root { RoundCorner 0 DiagonalCorner 0 LineThickness 1.0 - LineColor #181818 - BackGroundColor #f8f8f8 + LineColor #A80036 + BackGroundColor #FEFECE Shadowing 0.0 } document { - BackGroundColor White + BackGroundColor white header { HorizontalAlignment right FontSize 10 - FontColor #888888 - BackGroundColor none - LineColor none + FontColor #8 + BackGroundColor transparent + LineColor transparent } title { HorizontalAlignment center @@ -28,19 +28,19 @@ document { FontStyle bold Padding 5 Margin 5 - LineColor none - BackGroundColor none + LineColor transparent + BackGroundColor transparent } footer { HorizontalAlignment center FontSize 10 - FontColor #888888 - BackGroundColor none - LineColor none + FontColor #8 + BackGroundColor transparent + LineColor transparent } legend { LineColor black - BackGroundColor #DDDDDD + BackGroundColor #d FontSize 14 RoundCorner 15 Padding 6 @@ -51,8 +51,12 @@ document { FontSize 14 Padding 0 Margin 1 - LineColor none - BackGroundColor none + LineColor transparent + BackGroundColor transparent + } + frame { + LineColor black + LineThickness 1.5 } } @@ -63,12 +67,60 @@ stereotype { element { - Shadowing 0.0 + Shadowing 4.0 title { FontStyle bold } } +artifact { + Shadowing 4.0 +} +node { + Shadowing 2.0 +} +person { + Shadowing 2.0 +} +queue { + Shadowing 2.0 +} +rectangle { + Shadowing 3.0 +} +stack { + Shadowing 3.0 +} +storage { + Shadowing 3.0 +} +boundary { + Shadowing 4.0 +} +card { + Shadowing 3.0 +} +cloud { + Shadowing 3.0 +} +collections { + Shadowing 3.0 +} +component { + Shadowing 4.0 +} +database { + Shadowing 3.0 +} +file { + Shadowing 3.0 +} +frame { + Shadowing 3.0 +} +folder { + Shadowing 3.0 +} group { package { LineThickness 1.5 @@ -93,7 +145,7 @@ sequenceDiagram { } groupHeader { - BackGroundColor #EEEEEE + BackGroundColor #e LineColor black FontSize 13 FontStyle bold @@ -104,6 +156,42 @@ sequenceDiagram { LineStyle 5 } + + destroy { + } + + reference { + FontSize 12 + LineColor black + BackGroundColor white + LineThickness 2.0 + HorizontalAlignment center + } + + referenceHeader { + LineColor black + BackGroundColor #e + FontColor black + FontSize 13 + FontStyle bold + LineThickness 2.0 + } + + box { + BackGroundColor #d + + FontSize 13 + FontStyle bold + } + + separator { + LineColor black + LineThickness 2.0 + BackGroundColor #e + + FontSize 13 + FontStyle bold + } } classDiagram { @@ -166,42 +254,6 @@ stateDiagram { } -destroy { -} - -reference { - FontSize 12 - LineColor black - BackGroundColor while - LineThickness 2.0 - HorizontalAlignment center -} - -referenceHeader { - LineColor black - BackGroundColor #EEEEEE - FontColor black - FontSize 13 - FontStyle bold - LineThickness 2.0 -} - -box { - BackGroundColor #DDDDDD - - FontSize 13 - FontStyle bold -} - -separator { - LineColor black - LineThickness 2.0 - BackGroundColor #EEEEEE - - FontSize 13 - FontStyle bold -} - delay { FontSize 11 FontStyle plain @@ -254,13 +306,17 @@ swimlane { FontSize 18 } +diamond { + Shadowing 3.0 +} + arrow { FontSize 13 } note { FontSize 13 - BackGroundColor #ebebeb + BackGroundColor #FBFB77 } partition { @@ -293,6 +349,10 @@ wbsDiagram { FontSize 12 } +activityDiagram { + Shadowing 3.0 +} + activityDiagram { activity { LineThickness 1.5 @@ -310,14 +370,24 @@ activityDiagram { arrow { FontSize 11 } -} - -activityBar { - BackgroundColor black -} - -circle { - LineColor black + circle { + start { + LineColor black + BackgroundColor black + } + stop { + LineColor black + BackgroundColor white + } + end { + LineColor black + BackgroundColor white + } + } + activityBar { + Shadowing 3.0 + BackgroundColor black + } } @@ -337,6 +407,7 @@ ganttDiagram { } note { FontSize 9 + Shadowing 0.0 } separator { FontSize 11 @@ -397,17 +468,51 @@ yamlDiagram,jsonDiagram { timingDiagram { + LineColor #3 + FontColor #3 + FontStyle bold + LineThickness 1.5 + timeline { + FontStyle plain + FontSize 11 + } arrow { + LineColor darkblue LineThickness 1.5 } constraintArrow { + FontSize 12 + FontStyle plain + FontColor darkred + LineColor darkred LineThickness 1.5 } + clock { + LineColor darkgreen + } + concise { + FontSize 12 + LineColor darkgreen + BackgroundColor #c + } + robust { + FontStyle plain + FontSize 12 + LineColor darkgreen + LineThickness 2 + BackgroundColor #c + } + highlight { + BackgroundColor #e + LineThickness 2 + LineStyle 4;4 + } } nwdiagDiagram { network { FontSize 12 + Shadowing 1.0 } server { FontSize 12 @@ -420,33 +525,3 @@ nwdiagDiagram { FontSize 11 } } - - -@media (prefers-color-scheme:dark) { -element { - LineColor #e7e7e7 - BackGroundColor #070707 - FontColor white -} -spot { - spotAnnotation { - BackgroundColor #4A0000 - } - spotAbstractClass { - BackgroundColor #2A5D60 - } - spotClass { - BackgroundColor #2E5233 - } - spotInterface { - BackgroundColor #352866 - } - spotEnum { - BackgroundColor #852D19 - } - spotEntity { - BackgroundColor #2E5233 - } -} -} - diff --git a/src/jcckit/util/ConfigParameters.java b/src/jcckit/util/ConfigParameters.java index 5e1cb7e85..151e68954 100644 --- a/src/jcckit/util/ConfigParameters.java +++ b/src/jcckit/util/ConfigParameters.java @@ -21,7 +21,7 @@ package jcckit.util; import java.awt.Color; import java.util.StringTokenizer; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; @@ -306,7 +306,7 @@ static private HColorSet colors = HColorSet.instance(); private Color decodeInternal(String value) { if (value!=null) { try { - return new ColorMapperIdentity().toColor(colors.getColor(ThemeStyle.LIGHT, value, null)); + return new ColorMapperIdentity().toColor(colors.getColor(ThemeStyle.LIGHT_REGULAR, value, null)); } catch (NoSuchColorException e) { return Color.WHITE; } diff --git a/src/net/sourceforge/plantuml/AnnotatedWorker.java b/src/net/sourceforge/plantuml/AnnotatedWorker.java index 223b1e302..9fcddc0df 100644 --- a/src/net/sourceforge/plantuml/AnnotatedWorker.java +++ b/src/net/sourceforge/plantuml/AnnotatedWorker.java @@ -50,6 +50,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.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; @@ -57,6 +58,7 @@ import net.sourceforge.plantuml.svek.DecorateEntityImage; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; @@ -88,22 +90,39 @@ public class AnnotatedWorker { public TextBlock addFrame(final TextBlock original) { final Display mainFrame = annotated.getMainFrame(); - if (mainFrame == null) { + if (mainFrame == null) return original; - } final double x1 = 5; final double x2 = 7; final double y1 = 10; final double y2 = 10; - final SymbolContext symbolContext = new SymbolContext(getBackgroundColor(), HColorUtils.BLACK) - .withShadow(getSkinParam().shadowing(null) ? 3 : 0); + final double deltaShadow; + final FontConfiguration fontConfiguration; + final UStroke stroke; + final HColor borderColor; + if (UseStyle.useBetaStyle()) { + final Style style = StyleSignature.of(SName.root, SName.document, SName.frame) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + deltaShadow = style.value(PName.Shadowing).asDouble(); + fontConfiguration = new FontConfiguration(getSkinParam(), style); + stroke = style.getStroke(); + borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + } else { + deltaShadow = getSkinParam().shadowing(null) ? 3 : 0; + fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.CAPTION, null); + stroke = new UStroke(); + borderColor = HColorUtils.BLACK; + } + + final SymbolContext symbolContext = new SymbolContext(getBackgroundColor(), borderColor).withShadow(deltaShadow) + .withStroke(stroke); final MinMax originalMinMax = TextBlockUtils.getMinMax(original, stringBounder, false); - final TextBlock title = mainFrame.create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null), - HorizontalAlignment.CENTER, getSkinParam()); + + final TextBlock title = mainFrame.create(fontConfiguration, HorizontalAlignment.CENTER, getSkinParam()); final Dimension2D dimTitle = title.calculateDimension(stringBounder); - // final Dimension2D dimOriginal = original.calculateDimension(stringBounder); + final double width = x1 + Math.max(originalMinMax.getWidth(), dimTitle.getWidth()) + x2; final double height = dimTitle.getHeight() + y1 + originalMinMax.getHeight() + y2; final TextBlock frame = USymbol.FRAME.asBig(title, HorizontalAlignment.LEFT, TextBlockUtils.empty(0, 0), width, @@ -143,9 +162,9 @@ public class AnnotatedWorker { private TextBlock addLegend(TextBlock original) { final DisplayPositioned legend = annotated.getLegend(); - if (legend.isNull()) { + if (legend.isNull()) return original; - } + final TextBlock text = EntityImageLegend.create(legend.getDisplay(), getSkinParam()); return DecorateEntityImage.add(original, text, legend.getHorizontalAlignment(), legend.getVerticalAlignment()); @@ -157,18 +176,18 @@ public class AnnotatedWorker { private TextBlock addCaption(TextBlock original) { final DisplayPositioned caption = annotated.getCaption(); - if (caption.isNull()) { + if (caption.isNull()) return original; - } + final TextBlock text = getCaption(); return DecorateEntityImage.addBottom(original, text, HorizontalAlignment.CENTER); } public TextBlock getCaption() { final DisplayPositioned caption = annotated.getCaption(); - if (caption.isNull()) { + if (caption.isNull()) return TextBlockUtils.empty(0, 0); - } + if (UseStyle.useBetaStyle()) { final Style style = StyleSignature.of(SName.root, SName.document, SName.caption) .getMergedStyle(skinParam.getCurrentStyleBuilder()); @@ -180,9 +199,8 @@ public class AnnotatedWorker { private TextBlock addTitle(TextBlock original) { final DisplayPositioned title = (DisplayPositioned) annotated.getTitle(); - if (title.isNull()) { + if (title.isNull()) return original; - } final TextBlock block; if (UseStyle.useBetaStyle()) { @@ -201,9 +219,9 @@ public class AnnotatedWorker { private TextBlock addHeaderAndFooter(TextBlock original) { final DisplaySection footer = annotated.getFooter(); final DisplaySection header = annotated.getHeader(); - if (footer.isNull() && header.isNull()) { + if (footer.isNull() && header.isNull()) return original; - } + TextBlock textFooter = null; if (footer.isNull() == false) { Style style = null; diff --git a/src/net/sourceforge/plantuml/BlockUml.java b/src/net/sourceforge/plantuml/BlockUml.java index b2fccd755..0ba10e152 100644 --- a/src/net/sourceforge/plantuml/BlockUml.java +++ b/src/net/sourceforge/plantuml/BlockUml.java @@ -48,6 +48,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.code.AsciiEncoder; import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.TranscoderUtil; @@ -70,13 +71,14 @@ public class BlockUml { private final Defines localDefines; private final ISkinSimple skinParam; private final Set included = new HashSet<>(); + private final ThemeStyle style; public Set getIncluded() { return Collections.unmodifiableSet(included); } - BlockUml(String... strings) { - this(convert(strings), Defines.createEmpty(), null, null, null); + BlockUml(ThemeStyle style, String... strings) { + this(style, convert(strings), Defines.createEmpty(), null, null, null); } public String getEncodedUrl() throws IOException { @@ -113,21 +115,24 @@ public class BlockUml { private boolean preprocessorError; /** - * @deprecated being kept for backwards compatibility, perhaps other projects are using this? + * @deprecated being kept for backwards compatibility, perhaps other projects + * are using this? */ @Deprecated public BlockUml(List strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) { - this(strings, defines, skinParam, mode, charsetOrDefault(mode.getCharset())); + this(ThemeStyle.LIGHT_REGULAR, strings, defines, skinParam, mode, charsetOrDefault(mode.getCharset())); } - - public BlockUml(List strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode, Charset charset) { + + public BlockUml(ThemeStyle style, List strings, Defines defines, ISkinSimple skinParam, + PreprocessorModeSet mode, Charset charset) { + this.style = style; this.rawSource = new ArrayList<>(strings); this.localDefines = defines; this.skinParam = skinParam; final String s0 = strings.get(0).getTrimmed().getString(); - if (StartUtils.startsWithSymbolAnd("start", s0) == false) { + if (StartUtils.startsWithSymbolAnd("start", s0) == false) throw new IllegalArgumentException(); - } + if (mode == null) { this.data = new ArrayList<>(strings); } else { @@ -141,39 +146,38 @@ public class BlockUml { } public String getFileOrDirname() { - if (OptionFlags.getInstance().isWord()) { + if (OptionFlags.getInstance().isWord()) return null; - } + final Matcher2 m = StartUtils.patternFilename.matcher(StringUtils.trin(data.get(0).getString())); final boolean ok = m.find(); - if (ok == false) { + if (ok == false) return null; - } + String result = m.group(1); final int x = result.indexOf(','); - if (x != -1) { + if (x != -1) result = result.substring(0, x); - } + for (int i = 0; i < result.length(); i++) { final char c = result.charAt(i); - if ("<>|".indexOf(c) != -1) { + if ("<>|".indexOf(c) != -1) return null; - } + } - if (result.startsWith("file://")) { + if (result.startsWith("file://")) result = result.substring("file://".length()); - } + result = result.replaceAll("\\.\\w\\w\\w$", ""); return result; } public Diagram getDiagram() { if (system == null) { - if (preprocessorError) { + if (preprocessorError) system = new PSystemErrorPreprocessor(data, debug); - } else { - system = new PSystemBuilder().createPSystem(skinParam, data, rawSource); - } + else + system = new PSystemBuilder().createPSystem(style, skinParam, data, rawSource); } return system; } @@ -186,9 +190,9 @@ public class BlockUml { try { final AsciiEncoder coder = new AsciiEncoder(); final MessageDigest msgDigest = MessageDigest.getInstance("MD5"); - for (StringLocated s : data) { + for (StringLocated s : data) msgDigest.update(s.getString().getBytes(UTF_8)); - } + final byte[] digest = msgDigest.digest(); return coder.encode(digest); } catch (Exception e) { @@ -212,12 +216,12 @@ public class BlockUml { public List getDefinition(boolean withHeader) { final List result = new ArrayList<>(); - for (StringLocated s : data) { + for (StringLocated s : data) result.add(s.getString()); - } - if (withHeader) { + + if (withHeader) return Collections.unmodifiableList(result); - } + return Collections.unmodifiableList(result.subList(1, result.size() - 1)); } diff --git a/src/net/sourceforge/plantuml/BlockUmlBuilder.java b/src/net/sourceforge/plantuml/BlockUmlBuilder.java index 735197e1b..cf9237a45 100644 --- a/src/net/sourceforge/plantuml/BlockUmlBuilder.java +++ b/src/net/sourceforge/plantuml/BlockUmlBuilder.java @@ -47,6 +47,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.ImportedFiles; @@ -65,25 +66,36 @@ public final class BlockUmlBuilder implements DefinitionsContainer { private final Defines defines; private final ImportedFiles importedFiles; private final Charset charset; + private final ThemeStyle style; /** - * @deprecated being kept for backwards compatibility, perhaps other projects are using this? + * @deprecated being kept for backwards compatibility, perhaps other projects + * are using this? */ @Deprecated public BlockUmlBuilder(List config, String charset, Defines defines, Reader readerInit, SFile newCurrentDir, String desc) throws IOException { - - this(config, charsetOrDefault(charset), defines, readerInit, newCurrentDir, desc); + this(ThemeStyle.LIGHT_REGULAR, config, charsetOrDefault(charset), defines, readerInit, newCurrentDir, desc); } - - public BlockUmlBuilder(List config, Charset charset, Defines defines, Reader readerInit, SFile newCurrentDir, - String desc) throws IOException { - + + /** + * @deprecated being kept for backwards compatibility, perhaps other projects + * are using this? + */ + @Deprecated + public BlockUmlBuilder(List config, String charset, Defines defines, Reader reader) throws IOException { + this(config, charset, defines, reader, null, null); + } + + public BlockUmlBuilder(ThemeStyle style, List config, Charset charset, Defines defines, Reader readerInit, + SFile newCurrentDir, String desc) throws IOException { + + this.style = style; this.defines = defines; this.charset = requireNonNull(charset); this.reader = new UncommentReadLine(ReadLineReader.create(readerInit, desc)); this.importedFiles = ImportedFiles.createImportedFiles(new AParentFolderRegular(newCurrentDir)); - + try (ReadLineNumbered includer = new Preprocessor(config, reader)) { init(includer); } finally { @@ -91,14 +103,6 @@ public final class BlockUmlBuilder implements DefinitionsContainer { } } - /** - * @deprecated being kept for backwards compatibility, perhaps other projects are using this? - */ - @Deprecated - public BlockUmlBuilder(List config, String charset, Defines defines, Reader reader) throws IOException { - this(config, charset, defines, reader, null, null); - } - private void init(ReadLineNumbered includer) throws IOException { StringLocated s = null; List current = null; @@ -121,9 +125,9 @@ public final class BlockUmlBuilder implements DefinitionsContainer { current.add(s); } else if (paused) { final StringLocated append = StartUtils.getPossibleAppend(s); - if (append != null) { + if (append != null) current.add(append); - } + } if (StartUtils.isArobaseUnpauseDiagram(s.getString())) { @@ -131,10 +135,10 @@ public final class BlockUmlBuilder implements DefinitionsContainer { reader.setPaused(false); } if (StartUtils.isArobaseEndDiagram(s.getString()) && current != null) { - if (paused) { + if (paused) current.add(s); - } - final BlockUml uml = new BlockUml(current, defines.cloneMe(), null, this, charset); + + final BlockUml uml = new BlockUml(style, current, defines.cloneMe(), null, this, charset); usedFiles.addAll(uml.getIncluded()); blocks.add(uml); current = null; @@ -152,11 +156,10 @@ public final class BlockUmlBuilder implements DefinitionsContainer { } public List getDefinition(String name) { - for (BlockUml block : blocks) { - if (block.isStartDef(name)) { + for (BlockUml block : blocks) + if (block.isStartDef(name)) return block.getDefinition(false); - } - } + return Collections.emptyList(); } @@ -165,7 +168,8 @@ public final class BlockUmlBuilder implements DefinitionsContainer { } /** - * @deprecated being kept for backwards compatibility, perhaps other projects are using this? + * @deprecated being kept for backwards compatibility, perhaps other projects + * are using this? */ @Deprecated public final String getCharset() { diff --git a/src/net/sourceforge/plantuml/EmbeddedDiagram.java b/src/net/sourceforge/plantuml/EmbeddedDiagram.java index 0200ab50b..804341a9f 100644 --- a/src/net/sourceforge/plantuml/EmbeddedDiagram.java +++ b/src/net/sourceforge/plantuml/EmbeddedDiagram.java @@ -200,7 +200,8 @@ public class EmbeddedDiagram implements CharSequence { } private Diagram getSystem() throws IOException, InterruptedException { - final BlockUml blockUml = new BlockUml(system.as2(), Defines.createEmpty(), skinParam, null, null); + final BlockUml blockUml = new BlockUml(skinParam.getThemeStyle(), system.as2(), Defines.createEmpty(), + skinParam, null, null); return blockUml.getDiagram(); } diff --git a/src/net/sourceforge/plantuml/FileFormatOption.java b/src/net/sourceforge/plantuml/FileFormatOption.java index 5217ba27f..a2dc7a1e6 100644 --- a/src/net/sourceforge/plantuml/FileFormatOption.java +++ b/src/net/sourceforge/plantuml/FileFormatOption.java @@ -39,6 +39,7 @@ import java.awt.geom.AffineTransform; import java.io.Serializable; import java.util.Objects; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.StringBounder; /** @@ -59,23 +60,23 @@ public final class FileFormatOption implements Serializable { private final double scale; private final String preserveAspectRatio; private final String watermark; + private final ThemeStyle style; public double getScaleCoef() { return scale; } public FileFormatOption(FileFormat fileFormat) { - this(fileFormat, true, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, null); + this(fileFormat, true, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, null, ThemeStyle.LIGHT_REGULAR); } public FileFormatOption(FileFormat fileFormat, boolean withMetadata) { - this(fileFormat, withMetadata, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, - null); + this(fileFormat, withMetadata, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, null, ThemeStyle.LIGHT_REGULAR); } - private FileFormatOption(FileFormat fileFormat, boolean withMetadata, boolean useRedForError, - String svgLinkTarget, boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion, - double scale, String preserveAspectRatio, String watermark) { + private FileFormatOption(FileFormat fileFormat, boolean withMetadata, boolean useRedForError, String svgLinkTarget, + boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion, double scale, + String preserveAspectRatio, String watermark, ThemeStyle style) { this.hoverColor = hoverColor; this.watermark = watermark; this.fileFormat = fileFormat; @@ -86,6 +87,7 @@ public final class FileFormatOption implements Serializable { this.tikzFontDistortion = Objects.requireNonNull(tikzFontDistortion); this.scale = scale; this.preserveAspectRatio = preserveAspectRatio; + this.style = style; } public StringBounder getDefaultStringBounder(SvgCharSizeHack charSizeHack) { @@ -105,38 +107,43 @@ public final class FileFormatOption implements Serializable { } public FileFormatOption withUseRedForError() { - return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); } public FileFormatOption withTikzFontDistortion(TikzFontDistortion tikzFontDistortion) { - return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); } public FileFormatOption withSvgLinkTarget(String svgLinkTarget) { - return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); } public FileFormatOption withPreserveAspectRatio(String preserveAspectRatio) { - return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); } public FileFormatOption withHoverColor(String hoverColor) { - return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); } public FileFormatOption withScale(double scale) { - return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); } public FileFormatOption withWartermark(String watermark) { - return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, - hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); + return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); + } + + public FileFormatOption withStyle(ThemeStyle style) { + return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor, + tikzFontDistortion, scale, preserveAspectRatio, watermark, style); } @Override @@ -183,4 +190,8 @@ public final class FileFormatOption implements Serializable { return watermark; } + public ThemeStyle getStyle() { + return style; + } + } diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 5d6f1778c..e72eb08dd 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -194,6 +194,6 @@ public interface ISkinParam extends ISkinSimple { public LengthAdjust getlengthAdjust(); - public void assumeTransparent(ThemeStyle style); + // public void assumeTransparent(ThemeStyle style); } diff --git a/src/net/sourceforge/plantuml/ISkinSimple.java b/src/net/sourceforge/plantuml/ISkinSimple.java index 54f4c32d4..6aaa83f1e 100644 --- a/src/net/sourceforge/plantuml/ISkinSimple.java +++ b/src/net/sourceforge/plantuml/ISkinSimple.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml; import java.util.Map; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.HColorSet; @@ -63,5 +64,7 @@ public interface ISkinSimple extends SpriteContainer { public void copyAllFrom(ISkinSimple other); public double minClassWidth(); + + public ThemeStyle getThemeStyle(); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/net/sourceforge/plantuml/PSystemBuilder.java index 5429d0463..becfdad41 100644 --- a/src/net/sourceforge/plantuml/PSystemBuilder.java +++ b/src/net/sourceforge/plantuml/PSystemBuilder.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.acearth.PSystemXearthFactory; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3; import net.sourceforge.plantuml.api.PSystemFactory; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.board.BoardDiagramFactory; import net.sourceforge.plantuml.bpm.BpmDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; @@ -105,7 +106,7 @@ public class PSystemBuilder { public static final long startTime = System.currentTimeMillis(); - final public Diagram createPSystem(ISkinSimple skinParam, List source, + final public Diagram createPSystem(ThemeStyle style, ISkinSimple skinParam, List source, List rawSource) { final long now = System.currentTimeMillis(); @@ -129,10 +130,10 @@ public class PSystemBuilder { final DiagramType diagramType = umlSource.getDiagramType(); final List errors = new ArrayList<>(); for (PSystemFactory systemFactory : factories) { - if (diagramType != systemFactory.getDiagramType()) { + if (diagramType != systemFactory.getDiagramType()) continue; - } - final Diagram sys = systemFactory.createSystem(umlSource, skinParam); + + final Diagram sys = systemFactory.createSystem(style, umlSource, skinParam); if (isOk(sys)) { result = sys; return sys; @@ -140,9 +141,8 @@ public class PSystemBuilder { errors.add((PSystemError) sys); } - final PSystemError err = PSystemErrorUtils.merge(errors); - result = err; - return err; + result = PSystemErrorUtils.merge(errors); + return result; } finally { if (result != null && OptionFlags.getInstance().isEnableStats()) { StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass()); @@ -228,9 +228,9 @@ public class PSystemBuilder { } private boolean isOk(Diagram ps) { - if (ps == null || ps instanceof PSystemError) { + if (ps == null || ps instanceof PSystemError) return false; - } + return true; } diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index c0218bab0..9a1f58f6b 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -51,6 +51,7 @@ import java.util.Objects; import java.util.Set; import java.util.TreeSet; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; @@ -79,6 +80,7 @@ import net.sourceforge.plantuml.svg.LengthAdjust; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.color.ColorMapper; +import net.sourceforge.plantuml.ugraphic.color.ColorMapperForceDark; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.ColorMapperLightnessInverse; import net.sourceforge.plantuml.ugraphic.color.ColorMapperMonochrome; @@ -95,40 +97,42 @@ public class SkinParam implements ISkinParam { public static final String DEFAULT_PRESERVE_ASPECT_RATIO = "none"; // private String skin = "debug.skin"; - private String skin = "plantuml.skin"; private StyleBuilder styleBuilder; + // private ThemeStyle themeStyle = ThemeStyle.LIGHT_REGULAR; + private final ThemeStyle themeStyle; - private SkinParam(UmlDiagramType type) { - UseStyle.setBetaStyle(false); + private SkinParam(UmlDiagramType type, ThemeStyle style) { + this.themeStyle = style; this.type = type; - if (type == UmlDiagramType.MINDMAP) { + UseStyle.setBetaStyle(false); + if (type == UmlDiagramType.MINDMAP) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.WBS) { + + if (type == UmlDiagramType.WBS) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.GANTT) { + + if (type == UmlDiagramType.GANTT) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.JSON) { + + if (type == UmlDiagramType.JSON) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.GIT) { + + if (type == UmlDiagramType.GIT) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.BOARD) { + + if (type == UmlDiagramType.BOARD) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.YAML) { + + if (type == UmlDiagramType.YAML) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.HCL) { + + if (type == UmlDiagramType.HCL) UseStyle.setBetaStyle(true); - } - if (type == UmlDiagramType.NWDIAG) { + + if (type == UmlDiagramType.NWDIAG) UseStyle.setBetaStyle(true); - } + if (type == UmlDiagramType.SEQUENCE) { // skin = "debug.skin"; // USE_STYLE2.set(true); @@ -166,9 +170,9 @@ public class SkinParam implements ISkinParam { public StyleBuilder getCurrentStyleBuilderInternal() throws IOException { final StyleLoader tmp = new StyleLoader(this); StyleBuilder result = tmp.loadSkin(this.getDefaultSkin()); - if (result == null) { + if (result == null) result = tmp.loadSkin("plantuml.skin"); - } + return result; } @@ -205,7 +209,6 @@ public class SkinParam implements ISkinParam { final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder()); for (Style style : convertor.getStyles()) muteStyle(style); - } else { paramsPendingForStyleMigration.put(key, value); } @@ -216,9 +219,9 @@ public class SkinParam implements ISkinParam { final StyleBuilder styleBuilder = this.getCurrentStyleBuilder(); try { final BlocLines lines = BlocLines.load(internalIs, null); - for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) { + for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) this.muteStyle(modifiedStyle); - } + } catch (IOException e) { e.printStackTrace(); } @@ -236,12 +239,12 @@ public class SkinParam implements ISkinParam { paramsPendingForStyleMigration.clear(); } - public static SkinParam create(UmlDiagramType type) { - return new SkinParam(type); + public static SkinParam create(UmlDiagramType type, ThemeStyle style) { + return new SkinParam(type, style); } - public static SkinParam noShadowing(UmlDiagramType type) { - final SkinParam result = new SkinParam(type); + public static SkinParam noShadowing(UmlDiagramType type, ThemeStyle style) { + final SkinParam result = new SkinParam(type, style); result.setParam("shadowing", "false"); return result; } @@ -277,9 +280,9 @@ public class SkinParam implements ISkinParam { final String s = mm.group(1); result.add(key.replaceAll(stereoPatternString, "") + "<<" + s + ">>"); } - if (result.size() == 0) { + if (result.size() == 0) result.add(key); - } + return Collections.unmodifiableList(result); } @@ -292,9 +295,9 @@ public class SkinParam implements ISkinParam { public HColor getHyperlinkColor() { final HColor result = getHtmlColor(ColorParam.hyperlink, null, false); - if (result == null) { + if (result == null) return HColorUtils.BLUE; - } + return result; } @@ -308,9 +311,9 @@ public class SkinParam implements ISkinParam { applyPendingStyleMigration(); for (String key2 : cleanForKey(key)) { final String result = params.get(key2); - if (result != null) { + if (result != null) return result; - } + } return null; } @@ -348,9 +351,9 @@ public class SkinParam implements ISkinParam { checkStereotype(stereotype); for (String s : stereotype.getMultipleLabels()) { final String value2 = getValue(param.name() + "color" + "<<" + s + ">>"); - if (value2 != null && getIHtmlColorSet().getColorOrWhite(themeStyle, value2) != null) { + if (value2 != null && getIHtmlColorSet().getColorOrWhite(themeStyle, value2) != null) return getIHtmlColorSet().getColorOrWhite(themeStyle, value2); - } + } } final String value = getValue(getParamName(param, clickable)); @@ -373,9 +376,9 @@ public class SkinParam implements ISkinParam { public char getCircledCharacter(Stereotype stereotype) { final String value2 = getValue( "spotchar" + Objects.requireNonNull(stereotype).getLabel(Guillemet.DOUBLE_COMPARATOR)); - if (value2 != null && value2.length() > 0) { + if (value2 != null && value2.length() > 0) return value2.charAt(0); - } + return 0; } @@ -383,24 +386,24 @@ public class SkinParam implements ISkinParam { if (stereotype != null) { checkStereotype(stereotype); final String value2 = getValue(param.name() + "color" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - if (value2 != null) { + if (value2 != null) return new Colors(themeStyle, value2, getIHtmlColorSet(), param.getColorType()); - } + } final String value = getValue(getParamName(param, false)); - if (value == null) { + if (value == null) return Colors.empty(); - } + return new Colors(themeStyle, value, getIHtmlColorSet(), param.getColorType()); } private String getParamName(ColorParam param, boolean clickable) { String n = param.name(); - if (clickable && n.endsWith("Background")) { + if (clickable && n.endsWith("Background")) n = n.replaceAll("Background", "ClickableBackground"); - } else if (clickable && n.endsWith("Border")) { + else if (clickable && n.endsWith("Border")) n = n.replaceAll("Border", "ClickableBorder"); - } + return n + "color"; } @@ -416,17 +419,17 @@ public class SkinParam implements ISkinParam { checkStereotype(stereotype); final String value2 = getFirstValueNonNullWithSuffix( "fontsize" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param); - if (value2 != null && value2.matches("\\d+")) { + if (value2 != null && value2.matches("\\d+")) return Integer.parseInt(value2); - } + } String value = getFirstValueNonNullWithSuffix("fontsize", param); - if (value == null || value.matches("\\d+") == false) { + if (value == null || value.matches("\\d+") == false) value = getValue("defaultfontsize"); - } - if (value == null || value.matches("\\d+") == false) { + + if (value == null || value.matches("\\d+") == false) return param[0].getDefaultSize(this); - } + return Integer.parseInt(value); } @@ -435,20 +438,20 @@ public class SkinParam implements ISkinParam { checkStereotype(stereotype); final String value2 = getFirstValueNonNullWithSuffix( "fontname" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param); - if (value2 != null) { + if (value2 != null) return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value2); - } + } // Times, Helvetica, Courier or Symbol String value = getFirstValueNonNullWithSuffix("fontname", param); - if (value != null) { + if (value != null) return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value); - } + if (param[0] != FontParam.CIRCLED_CHARACTER) { value = getValue("defaultfontname"); - if (value != null) { + if (value != null) return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value); - } + } return param[0].getDefaultFamily(); } @@ -460,27 +463,28 @@ public class SkinParam implements ISkinParam { value = getFirstValueNonNullWithSuffix("fontcolor" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param); } - if (value == null) { + + if (value == null) value = getFirstValueNonNullWithSuffix("fontcolor", param); - } - if (value == null) { + + if (value == null) value = getValue("defaultfontcolor"); - } - if (value == null) { + + if (value == null) value = param[0].getDefaultColor(); - } - if (value == null) { + + if (value == null) return null; - } + return getIHtmlColorSet().getColorOrWhite(themeStyle, value); } private String getFirstValueNonNullWithSuffix(String suffix, FontParam... param) { for (FontParam p : param) { final String v = getValue(p.name() + suffix); - if (v != null) { + if (v != null) return v; - } + } return null; } @@ -492,29 +496,29 @@ public class SkinParam implements ISkinParam { value = getFirstValueNonNullWithSuffix("fontstyle" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param); } - if (value == null) { + if (value == null) value = getFirstValueNonNullWithSuffix("fontstyle", param); - } - if (value == null) { + + if (value == null) value = getValue("defaultfontstyle"); - } - if (value == null) { + + if (value == null) return param[0].getDefaultFontStyle(this, inPackageTitle); - } + int result = Font.PLAIN; - if (StringUtils.goLowerCase(value).contains("bold")) { + if (StringUtils.goLowerCase(value).contains("bold")) result = result | Font.BOLD; - } - if (StringUtils.goLowerCase(value).contains("italic")) { + + if (StringUtils.goLowerCase(value).contains("italic")) result = result | Font.ITALIC; - } + return result; } public UFont getFont(Stereotype stereotype, boolean inPackageTitle, FontParam... fontParam) { - if (stereotype != null) { + if (stereotype != null) checkStereotype(stereotype); - } + final String fontFamily = getFontFamily(stereotype, fontParam); final int fontStyle = getFontStyle(stereotype, inPackageTitle, fontParam); final int fontSize = getFontSize(stereotype, fontParam); @@ -622,12 +626,12 @@ public class SkinParam implements ISkinParam { public DotSplines getDotSplines() { final String value = getValue("linetype"); - if ("polyline".equalsIgnoreCase(value)) { + if ("polyline".equalsIgnoreCase(value)) return DotSplines.POLYLINE; - } - if ("ortho".equalsIgnoreCase(value)) { + + if ("ortho".equalsIgnoreCase(value)) return DotSplines.ORTHO; - } + return DotSplines.SPLINES; } @@ -646,98 +650,101 @@ public class SkinParam implements ISkinParam { } if ("first".equalsIgnoreCase(value)) { if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { - if (isReverseDefine) { + if (isReverseDefine) return HorizontalAlignment.LEFT; - } + return HorizontalAlignment.RIGHT; } else { - if (isReverseDefine) { + if (isReverseDefine) return HorizontalAlignment.RIGHT; - } + return HorizontalAlignment.LEFT; } } if ("direction".equalsIgnoreCase(value)) { - if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) { + if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) return HorizontalAlignment.LEFT; - } - if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { + + if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) return HorizontalAlignment.RIGHT; - } - if (arrowDirection == ArrowDirection.BOTH_DIRECTION) { + + if (arrowDirection == ArrowDirection.BOTH_DIRECTION) return HorizontalAlignment.CENTER; - } + } if ("reversedirection".equalsIgnoreCase(value)) { - if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) { + if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) return HorizontalAlignment.RIGHT; - } - if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { + + if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) return HorizontalAlignment.LEFT; - } - if (arrowDirection == ArrowDirection.BOTH_DIRECTION) { + + if (arrowDirection == ArrowDirection.BOTH_DIRECTION) return HorizontalAlignment.CENTER; - } + } final HorizontalAlignment result = HorizontalAlignment.fromString(value); - if (result == null && param == AlignmentParam.noteTextAlignment) { + if (result == null && param == AlignmentParam.noteTextAlignment) return getDefaultTextAlignment(overrideDefault == null ? HorizontalAlignment.LEFT : overrideDefault); - } else if (result == null && param == AlignmentParam.stateMessageAlignment) { + else if (result == null && param == AlignmentParam.stateMessageAlignment) return getDefaultTextAlignment(HorizontalAlignment.CENTER); - } else if (result == null) { + else if (result == null) return param.getDefaultValue(); - } + return result; } public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue) { final String value = getValue("defaulttextalignment"); final HorizontalAlignment result = HorizontalAlignment.fromString(value); - if (result == null) { + if (result == null) return defaultValue; - } + return result; } public HorizontalAlignment getStereotypeAlignment() { final String value = getValue("stereotypealignment"); final HorizontalAlignment result = HorizontalAlignment.fromString(value); - if (result == null) { + if (result == null) return HorizontalAlignment.CENTER; - } + return result; } private String getArg(String value, int i) { - if (value == null) { + if (value == null) return null; - } + final String[] split = value.split(":"); - if (i >= split.length) { + if (i >= split.length) return split[0]; - } + return split[i]; } public ColorMapper getColorMapper() { + if (themeStyle == ThemeStyle.DARK) + return new ColorMapperForceDark(); + final String monochrome = getValue("monochrome"); - if ("true".equals(monochrome)) { + if ("true".equals(monochrome)) return new ColorMapperMonochrome(false); - } - if ("reverse".equals(monochrome)) { + + if ("reverse".equals(monochrome)) return new ColorMapperMonochrome(true); - } + final String value = getValue("reversecolor"); - if (value == null) { + if (value == null) return new ColorMapperIdentity(); - } - if ("dark".equalsIgnoreCase(value)) { + + if ("dark".equalsIgnoreCase(value)) return new ColorMapperLightnessInverse(); - } + final ColorOrder order = ColorOrder.fromString(value); - if (order == null) { + if (order == null) return new ColorMapperIdentity(); - } + return new ColorMapperReverse(order); } @@ -745,20 +752,20 @@ public class SkinParam implements ISkinParam { if (stereotype != null) { checkStereotype(stereotype); final String value2 = getValue("shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - if (value2 != null) { + if (value2 != null) return value2.equalsIgnoreCase("true"); - } + } final String value = getValue("shadowing"); - if ("false".equalsIgnoreCase(value)) { + if ("false".equalsIgnoreCase(value)) return false; - } - if ("true".equalsIgnoreCase(value)) { + + if ("true".equalsIgnoreCase(value)) return true; - } - if (strictUmlStyle()) { + + if (strictUmlStyle()) return false; - } + return true; } @@ -766,14 +773,14 @@ public class SkinParam implements ISkinParam { if (stereotype != null) { checkStereotype(stereotype); final String value2 = getValue("note" + "shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - if (value2 != null) { + if (value2 != null) return value2.equalsIgnoreCase("true"); - } + } final String value2 = getValue("note" + "shadowing"); - if (value2 != null) { + if (value2 != null) return value2.equalsIgnoreCase("true"); - } + return shadowing(stereotype); } @@ -782,24 +789,24 @@ public class SkinParam implements ISkinParam { if (stereotype != null) { checkStereotype(stereotype); final String value2 = getValue(name + "shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - if (value2 != null) { + if (value2 != null) return value2.equalsIgnoreCase("true"); - } + } final String value = getValue(name + "shadowing"); - if (value == null) { + if (value == null) return shadowing(stereotype); - } - if ("false".equalsIgnoreCase(value)) { + + if ("false".equalsIgnoreCase(value)) return false; - } - if ("true".equalsIgnoreCase(value)) { + + if ("true".equalsIgnoreCase(value)) return true; - } - if (strictUmlStyle()) { + + if (strictUmlStyle()) return false; - } + return true; } @@ -815,25 +822,25 @@ public class SkinParam implements ISkinParam { public Sprite getSprite(String name) { Sprite result = sprites.get(name); - if (result == null) { + if (result == null) result = SpriteImage.fromInternal(name); - } + return result; } public PackageStyle packageStyle() { final String value = getValue("packageStyle"); final PackageStyle p = PackageStyle.fromString(value); - if (p == null) { + if (p == null) return PackageStyle.FOLDER; - } + return p; } public ComponentStyle componentStyle() { - if (strictUmlStyle()) { + if (strictUmlStyle()) return ComponentStyle.UML2; - } + final String value = getValue("componentstyle"); if ("uml1".equalsIgnoreCase(value)) return ComponentStyle.UML1; @@ -849,9 +856,9 @@ public class SkinParam implements ISkinParam { } public boolean useSwimlanes(UmlDiagramType type) { - if (type != UmlDiagramType.ACTIVITY) { + if (type != UmlDiagramType.ACTIVITY) return false; - } + return swimlanes(); } @@ -872,43 +879,43 @@ public class SkinParam implements ISkinParam { public double getDiagonalCorner(CornerParam param, Stereotype stereotype) { final String key = param.getDiagonalKey(); Double result = getCornerInternal(key, param, stereotype); - if (result != null) { + if (result != null) return result; - } + result = getCornerInternal(key, param, null); - if (result != null) { + if (result != null) return result; - } - if (param == CornerParam.DEFAULT) { + + if (param == CornerParam.DEFAULT) return 0; - } + return getDiagonalCorner(CornerParam.DEFAULT, stereotype); } public double getRoundCorner(CornerParam param, Stereotype stereotype) { final String key = param.getRoundKey(); Double result = getCornerInternal(key, param, stereotype); - if (result != null) { + if (result != null) return result; - } + result = getCornerInternal(key, param, null); - if (result != null) { + if (result != null) return result; - } - if (param == CornerParam.DEFAULT) { + + if (param == CornerParam.DEFAULT) return 0; - } + return getRoundCorner(CornerParam.DEFAULT, stereotype); } private Double getCornerInternal(String key, CornerParam param, Stereotype stereotype) { - if (stereotype != null) { + if (stereotype != null) key += stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR); - } + final String value = getValue(key); - if (value != null && value.matches("\\d+")) { + if (value != null && value.matches("\\d+")) return Double.parseDouble(value); - } + return null; } @@ -919,43 +926,42 @@ public class SkinParam implements ISkinParam { final String styleValue = getValue( param.name() + "style" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - if (styleValue != null) { + if (styleValue != null) style = LinkStyle.fromString2(styleValue); - } final String value2 = getValue( param.name() + "thickness" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); if (value2 != null && value2.matches("[\\d.]+")) { - if (style == null) { + if (style == null) style = LinkStyle.NORMAL(); - } + return style.goThickness(Double.parseDouble(value2)).getStroke3(); } } final String value = getValue(param.name() + "thickness"); if (value != null && value.matches("[\\d.]+")) { - if (style == null) { + if (style == null) style = LinkStyle.NORMAL(); - } + return style.goThickness(Double.parseDouble(value)).getStroke3(); } if (style == null) { final String styleValue = getValue(param.name() + "style"); - if (styleValue != null) { + if (styleValue != null) style = LinkStyle.fromString2(styleValue); - } + } - if (style != null && style.isNormal() == false) { + if (style != null && style.isNormal() == false) return style.getStroke3(); - } + return null; } public LineBreakStrategy maxMessageSize() { String value = getValue("wrapmessagewidth"); - if (value == null) { + if (value == null) value = getValue("maxmessagesize"); - } + return new LineBreakStrategy(value); } @@ -980,18 +986,18 @@ public class SkinParam implements ISkinParam { public ConditionStyle getConditionStyle() { final String value = getValue("conditionStyle"); final ConditionStyle p = ConditionStyle.fromString(value); - if (p == null) { + if (p == null) return ConditionStyle.INSIDE_HEXAGON; - } + return p; } public ConditionEndStyle getConditionEndStyle() { final String value = getValue("conditionEndStyle"); final ConditionEndStyle p = ConditionEndStyle.fromString(value); - if (p == null) { + if (p == null) return ConditionEndStyle.DIAMOND; - } + return p; } @@ -1016,16 +1022,16 @@ public class SkinParam implements ISkinParam { if (stereotype != null) { checkStereotype(stereotype); final String value2 = getValue("activityshape" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); - if (value2 != null) { + if (value2 != null) value = value2; - } + } - if ("roundedbox".equalsIgnoreCase(value)) { + if ("roundedbox".equalsIgnoreCase(value)) return false; - } - if ("octagon".equalsIgnoreCase(value)) { + + if ("octagon".equalsIgnoreCase(value)) return true; - } + return false; } @@ -1088,12 +1094,12 @@ public class SkinParam implements ISkinParam { public int swimlaneWidth() { final String value = getValue("swimlanewidth"); - if ("same".equalsIgnoreCase(value)) { + if ("same".equalsIgnoreCase(value)) return SWIMLANE_WIDTH_SAME; - } - if (value != null && value.matches("\\d+")) { + + if (value != null && value.matches("\\d+")) return Integer.parseInt(value); - } + return 0; } @@ -1103,9 +1109,9 @@ public class SkinParam implements ISkinParam { public HColor hoverPathColor() { final String value = getValue("pathhovercolor"); - if (value == null) { + if (value == null) return null; - } + return getIHtmlColorSet().getColorOrWhite(themeStyle, value, null); } @@ -1121,17 +1127,17 @@ public class SkinParam implements ISkinParam { private double getAsDouble(final String name) { final String value = getValue(name); - if (value != null && value.matches("\\d+(\\.\\d+)?")) { + if (value != null && value.matches("\\d+(\\.\\d+)?")) return Double.parseDouble(value); - } + return 0; } private int getAsInt(String key, int defaultValue) { final String value = getValue(key); - if (value != null && value.matches("\\d+")) { + if (value != null && value.matches("\\d+")) return Integer.parseInt(value); - } + return defaultValue; } @@ -1173,9 +1179,9 @@ public class SkinParam implements ISkinParam { final double margin = getAsDouble("SequenceMessageMargin"); final String borderColor = getValue("SequenceMessageBorderColor"); final String backgroundColor = getValue("SequenceMessageBackGroundColor"); - if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) { + if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) return Padder.NONE; - } + final HColor border = borderColor == null ? null : getIHtmlColorSet().getColorOrWhite(themeStyle, borderColor); final HColor background = backgroundColor == null ? null : getIHtmlColorSet().getColorOrWhite(themeStyle, backgroundColor); @@ -1186,12 +1192,12 @@ public class SkinParam implements ISkinParam { public ActorStyle actorStyle() { final String value = getValue("actorstyle"); - if ("awesome".equalsIgnoreCase(value)) { + if ("awesome".equalsIgnoreCase(value)) return ActorStyle.AWESOME; - } - if ("hollow".equalsIgnoreCase(value)) { + + if ("hollow".equalsIgnoreCase(value)) return ActorStyle.HOLLOW; - } + return ActorStyle.STICKMAN; } @@ -1201,31 +1207,29 @@ public class SkinParam implements ISkinParam { } public String transformStringForSizeHack(String s) { - for (Entry ent : svgCharSizes.entrySet()) { + for (Entry ent : svgCharSizes.entrySet()) s = s.replace(ent.getKey(), ent.getValue()); - } + return s; } public LengthAdjust getlengthAdjust() { final String value = getValue("lengthAdjust"); - if ("spacingAndGlyphs".equalsIgnoreCase(value)) { + if ("spacingAndGlyphs".equalsIgnoreCase(value)) return LengthAdjust.SPACING_AND_GLYPHS; - } - if ("spacing".equalsIgnoreCase(value)) { + + if ("spacing".equalsIgnoreCase(value)) return LengthAdjust.SPACING; - } - if ("none".equalsIgnoreCase(value)) { + + if ("none".equalsIgnoreCase(value)) return LengthAdjust.NONE; - } + return LengthAdjust.defaultValue(); } - private ThemeStyle themeStyle = ThemeStyle.LIGHT; - - public void assumeTransparent(ThemeStyle style) { - this.themeStyle = style; - } +// public void assumeTransparent(ThemeStyle style) { +// this.themeStyle = style; +// } public ThemeStyle getThemeStyle() { return themeStyle; diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 1ae639952..d72492244 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml; import java.util.Collection; import java.util.Map; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; @@ -455,10 +456,10 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getlengthAdjust(); } - @Override - public void assumeTransparent(ThemeStyle style) { - skinParam.assumeTransparent(style); - } +// @Override +// public void assumeTransparent(ThemeStyle style) { +// skinParam.assumeTransparent(style); +// } @Override public ThemeStyle getThemeStyle() { diff --git a/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java b/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java index 98850b650..52c39b76b 100644 --- a/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java +++ b/src/net/sourceforge/plantuml/SourceFileReaderAbstract.java @@ -54,6 +54,7 @@ import java.util.List; import java.util.Set; import net.sourceforge.plantuml.api.ImageDataSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.preproc.Defines; @@ -68,13 +69,13 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader { protected File outputFile; protected final BlockUmlBuilder builder; - protected /*final*/ FileFormatOption fileFormatOption; + protected /* final */ FileFormatOption fileFormatOption; private boolean checkMetadata; private boolean noerror; - public SourceFileReaderAbstract(File file, FileFormatOption fileFormatOption, Defines defines, List config, String charsetName) - throws IOException { - + public SourceFileReaderAbstract(File file, FileFormatOption fileFormatOption, Defines defines, List config, + String charsetName) throws IOException { + if (!file.exists()) { throw new IllegalArgumentException(); } @@ -83,7 +84,7 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader { this.file = file; this.fileFormatOption = fileFormatOption; - this.builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), + this.builder = new BlockUmlBuilder(fileFormatOption.getStyle(), config, charset, defines, getReader(charset), SFile.fromFile(file.getAbsoluteFile().getParentFile()), FileWithSuffix.getFileName(file)); } @@ -112,6 +113,7 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader { return builder.getIncludedFiles(); } + @Deprecated public final void setFileFormatOption(FileFormatOption fileFormatOption) { this.fileFormatOption = fileFormatOption; } diff --git a/src/net/sourceforge/plantuml/SourceStringReader.java b/src/net/sourceforge/plantuml/SourceStringReader.java index d7f6f23ac..2ae87e0d1 100644 --- a/src/net/sourceforge/plantuml/SourceStringReader.java +++ b/src/net/sourceforge/plantuml/SourceStringReader.java @@ -47,6 +47,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -58,6 +59,7 @@ import net.sourceforge.plantuml.svek.TextBlockBackcolored; public class SourceStringReader { final private List blocks; + final private ThemeStyle style; public SourceStringReader(String source) { this(Defines.createEmpty(), source, Collections.emptyList()); @@ -87,23 +89,27 @@ public class SourceStringReader { this(defines, source, charset, config, FileSystem.getInstance().getCurrentDir()); } - public SourceStringReader(Defines defines, String source, String charset, List config, SFile newCurrentDir) { + public SourceStringReader(Defines defines, String source, String charset, List config, + SFile newCurrentDir) { this(defines, source, charsetOrDefault(charset), config, newCurrentDir); } - + public SourceStringReader(Defines defines, String source, Charset charset, List config, SFile newCurrentDir) { - // // WARNING GLOBAL LOCK HERE - // synchronized (SourceStringReader.class) { + this(defines, source, charset, config, newCurrentDir, ThemeStyle.LIGHT_REGULAR); + } + + public SourceStringReader(Defines defines, String source, Charset charset, List config, SFile newCurrentDir, + ThemeStyle style) { + this.style = style; try { - final BlockUmlBuilder builder = new BlockUmlBuilder(config, charset, defines, new StringReader(source), - newCurrentDir, "string"); + final BlockUmlBuilder builder = new BlockUmlBuilder(style, config, charset, defines, + new StringReader(source), newCurrentDir, "string"); this.blocks = builder.getBlockUmls(); } catch (IOException e) { Log.error("error " + e); throw new IllegalStateException(e); } - // } } @Deprecated @@ -128,11 +134,11 @@ public class SourceStringReader { @Deprecated public String generateImage(OutputStream os, FileFormatOption fileFormatOption) throws IOException { - return outputImage(os, fileFormatOption).getDescription(); + return outputImage(os, fileFormatOption.withStyle(style)).getDescription(); } public DiagramDescription outputImage(OutputStream os, FileFormatOption fileFormatOption) throws IOException { - return outputImage(os, 0, fileFormatOption); + return outputImage(os, 0, fileFormatOption.withStyle(style)); } @Deprecated @@ -146,11 +152,12 @@ public class SourceStringReader { @Deprecated public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException { - return outputImage(os, numImage, fileFormatOption).getDescription(); + return outputImage(os, numImage, fileFormatOption.withStyle(style)).getDescription(); } public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException { + fileFormatOption = fileFormatOption.withStyle(style); if (blocks.size() == 0) { noStartumlFound(os, fileFormatOption); return null; @@ -175,6 +182,7 @@ public class SourceStringReader { } public DiagramDescription generateDiagramDescription(int numImage, FileFormatOption fileFormatOption) { + fileFormatOption = fileFormatOption.withStyle(style); if (blocks.size() == 0) { return null; } @@ -201,14 +209,15 @@ public class SourceStringReader { } public DiagramDescription generateDiagramDescription(FileFormatOption fileFormatOption) { - return generateDiagramDescription(0, fileFormatOption); + return generateDiagramDescription(0, fileFormatOption.withStyle(style)); } public DiagramDescription generateDiagramDescription(int numImage) { - return generateDiagramDescription(numImage, new FileFormatOption(FileFormat.PNG)); + return generateDiagramDescription(numImage, new FileFormatOption(FileFormat.PNG).withStyle(style)); } public String getCMapData(int numImage, FileFormatOption fileFormatOption) throws IOException { + fileFormatOption = fileFormatOption.withStyle(style); if (blocks.size() == 0) { return null; } @@ -229,11 +238,11 @@ public class SourceStringReader { } public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException { + fileFormatOption = fileFormatOption.withStyle(style); final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"), fileFormatOption.isUseRedForError()); - return plainImageBuilder(error, fileFormatOption) - .write(os); + return plainImageBuilder(error, fileFormatOption).write(os); } public final List getBlocks() { diff --git a/src/net/sourceforge/plantuml/SpriteContainer.java b/src/net/sourceforge/plantuml/SpriteContainer.java index c2b88d6e4..d1a07bb5c 100644 --- a/src/net/sourceforge/plantuml/SpriteContainer.java +++ b/src/net/sourceforge/plantuml/SpriteContainer.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.sprite.Sprite; public interface SpriteContainer extends SvgCharSizeHack { diff --git a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java index 758b22878..653723b76 100644 --- a/src/net/sourceforge/plantuml/SpriteContainerEmpty.java +++ b/src/net/sourceforge/plantuml/SpriteContainerEmpty.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml; import java.util.Map; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.SpriteImage; @@ -103,7 +104,7 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { } public ThemeStyle getThemeStyle() { - return ThemeStyle.LIGHT; + return ThemeStyle.LIGHT_REGULAR; } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/TitledDiagram.java b/src/net/sourceforge/plantuml/TitledDiagram.java index fd974fcbc..fe732a31e 100644 --- a/src/net/sourceforge/plantuml/TitledDiagram.java +++ b/src/net/sourceforge/plantuml/TitledDiagram.java @@ -41,6 +41,7 @@ import java.io.InputStream; import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.anim.AnimationDecoder; import net.sourceforge.plantuml.api.ApiStable; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.UmlSource; @@ -86,18 +87,18 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram, return pragma; } - public TitledDiagram(UmlSource source, UmlDiagramType type) { + public TitledDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type) { super(source); this.type = type; - this.skinParam = SkinParam.create(type); + this.skinParam = SkinParam.create(type, style); } public final StyleBuilder getCurrentStyleBuilder() { return skinParam.getCurrentStyleBuilder(); } - public TitledDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { - this(source, type); + public TitledDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) { + this(style, source, type); if (orig != null) { this.skinParam.copyAllFrom(orig); } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index c7af421e7..cb66842cf 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -52,6 +52,7 @@ import java.io.PrintWriter; import java.util.List; import net.sourceforge.plantuml.api.ImageDataSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.ImageData; @@ -86,12 +87,12 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot private int minwidth = Integer.MAX_VALUE; - public UmlDiagram(UmlSource source, UmlDiagramType type) { - super(source, type); + public UmlDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type) { + super(style, source, type); } - public UmlDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { - super(source, type, orig); + public UmlDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) { + super(style, source, type, orig); } final public int getMinwidth() { @@ -111,24 +112,23 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot } public final DisplaySection getFooterOrHeaderTeoz(FontParam param) { - if (param == FontParam.FOOTER) { + if (param == FontParam.FOOTER) return getFooter(); - } - if (param == FontParam.HEADER) { + + if (param == FontParam.HEADER) return getHeader(); - } + throw new IllegalArgumentException(); } - + @Override final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion()); - if (fileFormatOption.getFileFormat() == FileFormat.PDF) { + if (fileFormatOption.getFileFormat() == FileFormat.PDF) return exportDiagramInternalPdf(os, index); - } try { final ImageData imageData = exportDiagramInternal(os, index, fileFormatOption); @@ -141,7 +141,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot e.printStackTrace(); exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion()); } catch (Throwable e) { - //e.printStackTrace(); + // e.printStackTrace(); exportDiagramError(os, e, fileFormatOption, null); } return ImageDataSimple.error(); @@ -172,27 +172,24 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot Log.error("Issue in flashcode generation " + e); // e.printStackTrace(); } - if (im2 != null) { + if (im2 != null) GraphvizCrash.addDecodeHint(strings); - } + } final BufferedImage im = im2; final TextBlockBackcolored graphicStrings = GraphicStrings.createBlackOnWhite(strings, IconLoader.getRandom(), GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT); final UDrawable drawable = (im == null) ? graphicStrings : new UDrawable() { - public void drawU(UGraphic ug) { - graphicStrings.drawU(ug); - final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); - ug = ug.apply(UTranslate.dy(height)); - ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3)); - } - }; + public void drawU(UGraphic ug) { + graphicStrings.drawU(ug); + final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); + ug = ug.apply(UTranslate.dy(height)); + ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3)); + } + }; - plainImageBuilder(drawable, fileFormat) - .metadata(metadata) - .seed(seed) - .write(os); + plainImageBuilder(drawable, fileFormat).metadata(metadata).seed(seed).write(os); } private static void exportDiagramErrorText(OutputStream os, Throwable exception, List strings) { @@ -209,18 +206,18 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot public String getFlashData() { final UmlSource source = getSource(); - if (source == null) { + if (source == null) return ""; - } + return source.getPlainString(); } static private List getFailureText1(Throwable exception, String graphvizVersion, String textDiagram) { final List strings = GraphvizCrash.anErrorHasOccured(exception, textDiagram); strings.add("PlantUML (" + Version.versionString() + ") cannot parse result from dot/GraphViz."); - if (exception instanceof EmptySvgException) { + if (exception instanceof EmptySvgException) strings.add("Because dot/GraphViz returns an empty string."); - } + GraphvizCrash.checkOldVersionWarning(strings); if (graphvizVersion != null) { strings.add(" "); @@ -289,9 +286,9 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot final String name = changeName(suggestedFile.getFile(index).getAbsolutePath()); final SFile cmapFile = new SFile(name); try (PrintWriter pw = cmapFile.createPrintWriter()) { - if (PSystemUtils.canFileBeWritten(cmapFile) == false) { + if (PSystemUtils.canFileBeWritten(cmapFile) == false) return; - } + pw.print(cmapdata.getCMapData(cmapFile.getName().substring(0, cmapFile.getName().length() - 6))); } } @@ -302,24 +299,24 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot @Override public String getWarningOrError() { - if (lastInfo == null) { + if (lastInfo == null) return null; - } + final double actualWidth = lastInfo.getWidth(); - if (actualWidth == 0) { + if (actualWidth == 0) return null; - } + final String value = getSkinParam().getValue("widthwarning"); - if (value == null) { + if (value == null) return null; - } - if (value.matches("\\d+") == false) { + + if (value.matches("\\d+") == false) return null; - } + final int widthwarning = Integer.parseInt(value); - if (actualWidth > widthwarning) { + if (actualWidth > widthwarning) return "The image is " + ((int) actualWidth) + " pixel width. (Warning limit is " + widthwarning + ")"; - } + return null; } diff --git a/src/net/sourceforge/plantuml/UseStyle.java b/src/net/sourceforge/plantuml/UseStyle.java index 23bef5966..5c0af8698 100644 --- a/src/net/sourceforge/plantuml/UseStyle.java +++ b/src/net/sourceforge/plantuml/UseStyle.java @@ -40,11 +40,12 @@ public class UseStyle { private static final ThreadLocal useBeta = new ThreadLocal<>(); static public boolean useBetaStyle() { - final Boolean result = useBeta.get(); - if (result == null) { - return false; - } - return result; +// final Boolean result = useBeta.get(); +// if (result == null) { +// return false; +// } +// return result; + return true; } static public void setBetaStyle(boolean betastyle) { diff --git a/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java b/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java index a8956db7b..b5705b0c5 100644 --- a/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java +++ b/src/net/sourceforge/plantuml/acearth/PSystemXearthFactory.java @@ -41,6 +41,7 @@ import java.util.List; import java.util.Map; import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; @@ -55,7 +56,7 @@ public class PSystemXearthFactory extends PSystemBasicFactory { private int height; @Override - public PSystemXearth initDiagram(UmlSource source, String startLine) { + public PSystemXearth initDiagram(ThemeStyle style, UmlSource source, String startLine) { this.width = 512; this.height = 512; this.config.clear(); @@ -74,18 +75,18 @@ public class PSystemXearthFactory extends PSystemBasicFactory { } @Override - public PSystemXearth executeLine(UmlSource source, PSystemXearth system, String line) { + public PSystemXearth executeLine(ThemeStyle style, UmlSource source, PSystemXearth system, String line) { if (system == null && line.startsWith("xearth")) { extractDimension(line); system = new PSystemXearth(source, width, height, config, markers); return system; } - if (system == null) { + if (system == null) return null; - } - if (line.startsWith("#") || line.startsWith("'")) { + + if (line.startsWith("#") || line.startsWith("'")) return system; - } + final Pattern2 p = MyPattern.cmpile("(\\w+)[%s]*=[%s]*(.*)"); final Matcher2 m = p.matcher(line); if (m.find()) { diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java index 2b4e11c2a..3a6d2eb97 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java +++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java @@ -42,6 +42,7 @@ import java.util.Objects; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.cucadiagram.Code; @@ -62,8 +63,8 @@ public class ActivityDiagram extends CucaDiagram { private IEntity lastEntityBrancheConsulted; private ConditionalContext currentContext; - public ActivityDiagram(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.ACTIVITY, skinParam); + public ActivityDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.ACTIVITY, skinParam); setNamespaceSeparator(null); } diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java index 837bb3bc0..e1ebcd707 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagramFactory.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.activitydiagram.command.CommandIf; import net.sourceforge.plantuml.activitydiagram.command.CommandLinkActivity; import net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity; import net.sourceforge.plantuml.activitydiagram.command.CommandPartition; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; @@ -59,8 +60,8 @@ import net.sourceforge.plantuml.core.UmlSource; public class ActivityDiagramFactory extends PSystemCommandFactory { @Override - public ActivityDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new ActivityDiagram(source, skinParam); + public ActivityDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new ActivityDiagram(style, source, skinParam); } @Override diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index 20fa7c20e..ec9070da2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -74,23 +75,22 @@ public class ActivityDiagram3 extends UmlDiagram { private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma()); - public ActivityDiagram3(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.ACTIVITY, skinParam); + public ActivityDiagram3(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.ACTIVITY, skinParam); } private void manageSwimlaneStrategy() { - if (swimlaneStrategy == null) { + if (swimlaneStrategy == null) swimlaneStrategy = SwimlaneStrategy.SWIMLANE_FORBIDDEN; - } + } public CommandExecutionResult swimlane(String name, HColor color, Display label) { - if (swimlaneStrategy == null) { + if (swimlaneStrategy == null) swimlaneStrategy = SwimlaneStrategy.SWIMLANE_ALLOWED; - } - if (swimlaneStrategy == SwimlaneStrategy.SWIMLANE_FORBIDDEN) { + + if (swimlaneStrategy == SwimlaneStrategy.SWIMLANE_FORBIDDEN) return CommandExecutionResult.error("This swimlane must be defined at the start of the diagram."); - } swinlanes.swimlane(name, color, label); return CommandExecutionResult.ok(); @@ -114,14 +114,14 @@ public class ActivityDiagram3 extends UmlDiagram { final InstructionSimple ins = new InstructionSimple(activity, nextLinkRenderer(), swinlanes.getCurrentSwimlane(), style, url, colors, stereotype); final CommandExecutionResult added = current().add(ins); - if (added.isOk() == false) { + if (added.isOk() == false) return added; - } + setNextLinkRendererInternal(LinkRendering.none()); manageHasUrl(activity); - if (url != null) { + if (url != null) hasUrl = true; - } + return CommandExecutionResult.ok(); } @@ -157,34 +157,34 @@ public class ActivityDiagram3 extends UmlDiagram { public void stop() { manageSwimlaneStrategy(); final InstructionStop ins = new InstructionStop(swinlanes.getCurrentSwimlane(), nextLinkRenderer()); - if (manageSpecialStopEndAfterEndWhile(ins)) { + if (manageSpecialStopEndAfterEndWhile(ins)) return; - } + current().add(ins); } public void end() { manageSwimlaneStrategy(); final InstructionEnd ins = new InstructionEnd(swinlanes.getCurrentSwimlane(), nextLinkRenderer()); - if (manageSpecialStopEndAfterEndWhile(ins)) { + if (manageSpecialStopEndAfterEndWhile(ins)) return; - } + current().add(ins); } private boolean manageSpecialStopEndAfterEndWhile(Instruction special) { - if (current() instanceof InstructionList == false) { + if (current() instanceof InstructionList == false) return false; - } + final InstructionList current = (InstructionList) current(); final Instruction last = current.getLast(); - if (last instanceof InstructionWhile == false) { + if (last instanceof InstructionWhile == false) return false; - } + final InstructionWhile instructionWhile = (InstructionWhile) last; - if (instructionWhile.containsBreak()) { + if (instructionWhile.containsBreak()) return false; - } + instructionWhile.setSpecial(special); return true; } @@ -285,9 +285,9 @@ public class ActivityDiagram3 extends UmlDiagram { public CommandExecutionResult switchCase(Display labelCase) { if (current() instanceof InstructionSwitch) { final boolean ok = ((InstructionSwitch) current()).switchCase(labelCase, nextLinkRenderer()); - if (ok == false) { + if (ok == false) return CommandExecutionResult.error("You cannot put an elseIf here"); - } + setNextLinkRendererInternal(LinkRendering.none()); return CommandExecutionResult.ok(); @@ -317,9 +317,9 @@ public class ActivityDiagram3 extends UmlDiagram { public CommandExecutionResult elseIf(LinkRendering inlabel, Display test, LinkRendering whenThen, HColor color) { if (current() instanceof InstructionIf) { final boolean ok = ((InstructionIf) current()).elseIf(inlabel, test, whenThen, nextLinkRenderer(), color); - if (ok == false) { + if (ok == false) return CommandExecutionResult.error("You cannot put an elseIf here"); - } + setNextLinkRendererInternal(LinkRendering.none()); return CommandExecutionResult.ok(); } @@ -329,9 +329,9 @@ public class ActivityDiagram3 extends UmlDiagram { public CommandExecutionResult else2(LinkRendering whenElse) { if (current() instanceof InstructionIf) { final boolean result = ((InstructionIf) current()).swithToElse2(whenElse, nextLinkRenderer()); - if (result == false) { + if (result == false) return CommandExecutionResult.error("Cannot find if"); - } + setNextLinkRendererInternal(LinkRendering.none()); return CommandExecutionResult.ok(); } @@ -411,9 +411,9 @@ public class ActivityDiagram3 extends UmlDiagram { } final public CommandExecutionResult kill() { - if (current().kill() == false) { + if (current().kill() == false) return CommandExecutionResult.error("kill cannot be used here"); - } + return CommandExecutionResult.ok(); } @@ -444,11 +444,11 @@ public class ActivityDiagram3 extends UmlDiagram { // System.err.println("setNextLink=" + linkRenderer); if (current() instanceof InstructionCollection) { final Instruction last = ((InstructionCollection) current()).getLast(); - if (last instanceof InstructionWhile) { + if (last instanceof InstructionWhile) ((InstructionWhile) last).outColor(linkRenderer.getRainbow()); - } else if (last instanceof InstructionIf) { + else if (last instanceof InstructionIf) ((InstructionIf) last).outColor(linkRenderer); - } + } this.setNextLinkRendererInternal(linkRenderer); } @@ -468,18 +468,18 @@ public class ActivityDiagram3 extends UmlDiagram { } public void setColorNextArrow(Rainbow color) { - if (color == null) { + if (color == null) return; - } + final LinkRendering link = new LinkRendering(color); setNextLink(link); } public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type, Colors colors) { final boolean ok = current().addNote(note, position, type, colors, swinlanes.getCurrentSwimlane()); - if (ok == false) { + if (ok == false) return CommandExecutionResult.error("Cannot add note here"); - } + manageHasUrl(note); return CommandExecutionResult.ok(); } @@ -487,9 +487,9 @@ public class ActivityDiagram3 extends UmlDiagram { private boolean hasUrl = false; private void manageHasUrl(Display display) { - if (display.hasUrl()) { + if (display.hasUrl()) hasUrl = true; - } + } @Override diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java index c59747225..172924d01 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagramFactory3.java @@ -84,11 +84,12 @@ import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane2; import net.sourceforge.plantuml.activitydiagram3.command.CommandSwitch; import net.sourceforge.plantuml.activitydiagram3.command.CommandWhile3; import net.sourceforge.plantuml.activitydiagram3.command.CommandWhileEnd3; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandDecoratorMultine; import net.sourceforge.plantuml.command.CommandFootboxIgnored; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.UmlSource; public class ActivityDiagramFactory3 extends PSystemCommandFactory { @@ -161,8 +162,8 @@ public class ActivityDiagramFactory3 extends PSystemCommandFactory { } @Override - public ActivityDiagram3 createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new ActivityDiagram3(source, skinParam); + public ActivityDiagram3 createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new ActivityDiagram3(style, source, skinParam); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Hexagon.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Hexagon.java index 65a098d92..6fcd60d10 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Hexagon.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Hexagon.java @@ -105,7 +105,7 @@ public class Hexagon { }; } - public static UPolygon asPolygonSquare(boolean shadowing, double width, double height) { + public static UPolygon asPolygonSquare(double shadowing, double width, double height) { final UPolygon diams = new UPolygon(); diams.addPoint(width / 2, 0); @@ -113,9 +113,7 @@ public class Hexagon { diams.addPoint(width / 2, height); diams.addPoint(0, height / 2); - if (shadowing) { - diams.setDeltaShadow(3); - } + diams.setDeltaShadow(shadowing); return diams; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java index 1eaa644ba..a1cdd8c5d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorSwitch.java @@ -163,10 +163,20 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator { } private Ftile getDiamond2(Swimlane swimlane, Branch branch0) { - final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HColor backColor = branch0.getColor() == null - ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) - : branch0.getColor(); + final HColor borderColor; + final HColor backColor; + if (UseStyle.useBetaStyle()) { + final Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(skinParam().getCurrentStyleBuilder()); + borderColor = style.value(PName.LineColor).asColor(skinParam().getThemeStyle(), + skinParam().getIHtmlColorSet()); + backColor = branch0.getColor() == null ? style.value(PName.BackGroundColor) + .asColor(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet()) : branch0.getColor(); + } else { + borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); + backColor = branch0.getColor() == null + ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) + : branch0.getColor(); + } return new FtileDiamondInside(TextBlockUtils.empty(0, 0), branch0.skinParam(), backColor, borderColor, swimlane); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index 59cae05cb..789e24a38 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -96,9 +96,7 @@ public class FtileGroup extends AbstractFtile { super(inner.skinParam()); this.roundCorner = roundCorner; this.type = type; - this.backColor = backColor == null ? HColorUtils.WHITE : backColor; this.inner = FtileUtils.addHorizontalMargin(inner, 10); - this.borderColor = borderColor == null ? HColorUtils.BLACK : borderColor; final FontConfiguration fc; final Style style; @@ -106,7 +104,15 @@ public class FtileGroup extends AbstractFtile { style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder()); fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet()); this.shadowing = style.value(PName.Shadowing).asDouble(); + this.backColor = backColor == null + ? style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()) + : backColor; + this.borderColor = borderColor == null + ? style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()) + : borderColor; } else { + this.backColor = backColor == null ? HColorUtils.WHITE : backColor; + this.borderColor = borderColor == null ? HColorUtils.BLACK : borderColor; style = null; final UFont font = skinParam.getFont(null, false, FontParam.PARTITION); final HColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); @@ -114,16 +120,15 @@ public class FtileGroup extends AbstractFtile { skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); this.shadowing = skinParam().shadowing(null) ? 3 : 0; } - if (title == null) { + if (title == null) this.name = TextBlockUtils.empty(0, 0); - } else { + else this.name = title.create(fc, HorizontalAlignment.LEFT, skinParam); - } - if (Display.isNull(displayNote)) { + + if (Display.isNull(displayNote)) this.headerNote = TextBlockUtils.empty(0, 0); - } else { + else this.headerNote = new FloatingNote(displayNote, skinParam, style); - } final UStroke thickness = skinParam.getThickness(LineParam.partitionBorder, null); this.stroke = thickness == null ? new UStroke(2) : thickness; @@ -183,9 +188,9 @@ public class FtileGroup extends AbstractFtile { private FtileGeometry cachedInnerDimension; private FtileGeometry getInnerDimension(StringBounder stringBounder) { - if (cachedInnerDimension == null) { + if (cachedInnerDimension == null) cachedInnerDimension = getInnerDimensionSlow(stringBounder); - } + return cachedInnerDimension; } @@ -208,10 +213,10 @@ public class FtileGroup extends AbstractFtile { final double height = orig.getHeight() + diffHeightTitle(stringBounder) + diffYY2 + headerNoteHeight(stringBounder); final double titleAndHeaderNoteHeight = diffHeightTitle(stringBounder) + headerNoteHeight(stringBounder); - if (orig.hasPointOut()) { + if (orig.hasPointOut()) return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, orig.getInY() + titleAndHeaderNoteHeight, orig.getOutY() + titleAndHeaderNoteHeight); - } + return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, orig.getInY() + titleAndHeaderNoteHeight); } @@ -224,8 +229,6 @@ public class FtileGroup extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimTotal = calculateDimension(stringBounder); - // final double roundCorner = - // type.getSkinParameter().getRoundCorner(skinParam(), null); final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(shadowing) .withStroke(stroke).withCorner(roundCorner, 0); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java index b03afb24d..97c3e8f16 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSwitch.java @@ -82,9 +82,9 @@ class FtileSwitch extends AbstractFtile { public Set getSwimlanes() { final Set result = new HashSet<>(); - if (getSwimlaneIn() != null) { + if (getSwimlaneIn() != null) result.add(getSwimlaneIn()); - } + return Collections.unmodifiableSet(result); } @@ -102,9 +102,8 @@ class FtileSwitch extends AbstractFtile { Objects.requireNonNull(afterEndwhile); final List tiles = new ArrayList<>(); - for (Branch branch : thens) { + for (Branch branch : thens) tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); - } List inlabelSizes = new ArrayList<>(); for (Branch branch : thens) { @@ -115,8 +114,8 @@ class FtileSwitch extends AbstractFtile { ftileFactory.skinParam()); final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); - FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, - borderColor, swimlane); + FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, borderColor, + swimlane); TextBlock tbInlabel = null; if (Display.isNull(branch.getInlabel())) { inlabelSizes.add(0.0); @@ -140,9 +139,9 @@ class FtileSwitch extends AbstractFtile { @Override public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { - if (tiles.contains(child)) { + if (tiles.contains(child)) return getTranslate1(child, stringBounder); - } + throw new UnsupportedOperationException(); } @@ -150,9 +149,9 @@ class FtileSwitch extends AbstractFtile { double x1 = 0; for (Ftile candidate : tiles) { final FtileGeometry dim1 = candidate.calculateDimension(stringBounder); - if (candidate == tile) { + if (candidate == tile) return new UTranslate(x1, 25); - } + x1 += dim1.getWidth() + xSeparation; } throw new IllegalArgumentException(); @@ -160,16 +159,16 @@ class FtileSwitch extends AbstractFtile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - for (Ftile tile : tiles) { + for (Ftile tile : tiles) ug.apply(getTranslate1(tile, stringBounder)).draw(tile); - } + } private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) { Dimension2D result = new Dimension2DDouble(0, 0); - for (Ftile couple : tiles) { + for (Ftile couple : tiles) result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder)); - } + result = Dimension2DDouble.delta(result, xSeparation * (tiles.size() - 1), 100); return new FtileGeometry(result, result.getWidth() / 2, 0); @@ -180,11 +179,10 @@ class FtileSwitch extends AbstractFtile { final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); final List all = new ArrayList<>(tiles); - for (Ftile tmp : all) { - if (tmp.calculateDimension(stringBounder).hasPointOut()) { + for (Ftile tmp : all) + if (tmp.calculateDimension(stringBounder).hasPointOut()) return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight()); - } - } + return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index f1f328fff..d39b09629 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -94,10 +94,6 @@ public class VCompactFactory implements FtileFactory { this.stringBounder = stringBounder; } - private StyleSignature getSignatureCircle() { - return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); - } - private StyleSignature getSignatureCircleEnd() { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.end); } @@ -106,11 +102,15 @@ public class VCompactFactory implements FtileFactory { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.stop); } + private StyleSignature getSignatureCircleStart() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.start); + } + public Ftile start(Swimlane swimlane) { final HColor color; Style style = null; if (UseStyle.useBetaStyle()) { - style = getSignatureCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + style = getSignatureCircleStart().getMergedStyle(skinParam.getCurrentStyleBuilder()); color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } else { color = rose.getHtmlColor(skinParam, ColorParam.activityStart); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java index 63e6414a8..202164d53 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchNude.java @@ -70,12 +70,12 @@ public class FtileSwitchNude extends FtileDimensionMemoize { public Set getSwimlanes() { final Set result = new HashSet<>(); - if (getSwimlaneIn() != null) { + if (getSwimlaneIn() != null) result.add(getSwimlaneIn()); - } - for (Ftile tile : tiles) { + + for (Ftile tile : tiles) result.addAll(tile.getSwimlanes()); - } + return Collections.unmodifiableSet(result); } @@ -89,9 +89,9 @@ public class FtileSwitchNude extends FtileDimensionMemoize { @Override public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { - if (tiles.contains(child)) { + if (tiles.contains(child)) return getTranslateNude(child, stringBounder); - } + throw new UnsupportedOperationException(); } @@ -99,9 +99,9 @@ public class FtileSwitchNude extends FtileDimensionMemoize { double x1 = 0; for (Ftile candidate : tiles) { final FtileGeometry dim1 = candidate.calculateDimension(stringBounder); - if (candidate == tile) { + if (candidate == tile) return UTranslate.dx(x1); - } + x1 += dim1.getWidth() + xSeparation; } throw new IllegalArgumentException(); @@ -109,27 +109,27 @@ public class FtileSwitchNude extends FtileDimensionMemoize { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - for (Ftile tile : tiles) { + for (Ftile tile : tiles) ug.apply(getTranslateNude(tile, stringBounder)).draw(tile); - } + } @Override final protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder); for (Ftile tile : tiles) - if (tile.calculateDimension(stringBounder).hasPointOut()) { + if (tile.calculateDimension(stringBounder).hasPointOut()) return dimTotal; - } + return dimTotal.withoutPointOut(); } @Override protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder) { Dimension2D result = new Dimension2DDouble(0, 0); - for (Ftile couple : tiles) { + for (Ftile couple : tiles) result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder)); - } + result = Dimension2DDouble.delta(result, xSeparation * (tiles.size() - 1), 100); return new FtileGeometry(result, result.getWidth() / 2, 0); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java index e35cbee81..23acf8ba3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithDiamonds.java @@ -85,18 +85,18 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude { - tiles.get(0).calculateDimension(stringBounder).getRight() - tiles.get(tiles.size() - 1).calculateDimension(stringBounder).getLeft(); w9 = getW9(stringBounder); - if (w13 > w9) { + if (w13 > w9) mode = Mode.BIG_DIAMOND; - } else { + else mode = Mode.SMALL_DIAMOND; - } + } private double getW9(StringBounder stringBounder) { double result = 0; - for (int i = 1; i < tiles.size() - 1; i++) { + for (int i = 1; i < tiles.size() - 1; i++) result += tiles.get(i).calculateDimension(stringBounder).getWidth(); - } + return result; } @@ -144,17 +144,15 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude { final StringBounder stringBounder = ug.getStringBounder(); ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1); - if (mode == Mode.BIG_DIAMOND) { - for (Ftile tile : tiles) { + if (mode == Mode.BIG_DIAMOND) + for (Ftile tile : tiles) tile.drawU(ug.apply(getTranslateOf(tile, stringBounder))); - } - } else { + else super.drawU(ug.apply(getTranslateMain(stringBounder))); - } - if (calculateDimension(stringBounder).hasPointOut()) { + if (calculateDimension(stringBounder).hasPointOut()) ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2); - } + } final protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) { @@ -163,11 +161,10 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude { double dx = 0; final double suppx = (w13 - w9) / (tiles.size() - 1); for (int i = 0; i < tiles.size() - 1; i++) { - if (tile == tiles.get(i)) { + if (tile == tiles.get(i)) return main.compose(UTranslate.dx(dx)); - } - dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx; + dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx; } if (tile == tiles.get(tiles.size() - 1)) { final double dx9 = tiles.get(0).calculateDimension(stringBounder).getWidth() + w13 + SUPP15 + SUPP15; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java index 44f61b9eb..19b993d76 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithManyLinks.java @@ -41,7 +41,6 @@ import java.util.List; import net.sourceforge.plantuml.Direction; 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.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; @@ -50,7 +49,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; 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.cucadiagram.Display; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -100,13 +98,13 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { private Point2D getP1(StringBounder stringBounder) { final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final Point2D pt; - if (getFtile2() == tiles.get(0)) { + if (getFtile2() == tiles.get(0)) pt = dimDiamond1.getPointD(); - } else if (getFtile2() == tiles.get(tiles.size() - 1)) { + else if (getFtile2() == tiles.get(tiles.size() - 1)) pt = dimDiamond1.getPointB(); - } else { + else throw new IllegalStateException(); - } + return getTranslateDiamond1(stringBounder).getTranslated(pt); } @@ -129,9 +127,9 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); - if (geo.hasPointOut() == false) { + if (geo.hasPointOut() == false) return; - } + final Point2D p1 = getP1(stringBounder); final double x1 = p1.getX(); final double y1 = p1.getY(); @@ -320,18 +318,18 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { branches.get(lastOutgoingArrow).getTextBlockSpecial())); for (int i = firstOutgoingArrow + 1; i < lastOutgoingArrow; i++) { final Ftile tile = tiles.get(i); - if (tile.calculateDimension(stringBounder).hasPointOut()) { + if (tile.calculateDimension(stringBounder).hasPointOut()) conns.add(new ConnectionVerticalBottom(tile, branches.get(i).getTextBlockSpecial())); - } + } } private int getFirstOutgoingArrow(StringBounder stringBounder) { for (int i = 0; i < tiles.size() - 1; i++) { final Ftile tile = tiles.get(i); - if (tile.calculateDimension(stringBounder).hasPointOut()) { + if (tile.calculateDimension(stringBounder).hasPointOut()) return i; - } + } return tiles.size(); } @@ -339,9 +337,9 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds { private int getLastOutgoingArrow(StringBounder stringBounder) { for (int i = tiles.size() - 1; i >= 0; i--) { final Ftile tile = tiles.get(i); - if (tile.calculateDimension(stringBounder).hasPointOut()) { + if (tile.calculateDimension(stringBounder).hasPointOut()) return i; - } + } return -1; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java index cae0831d8..34e1e7d31 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileSwitchWithOneLink.java @@ -80,8 +80,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds { final double x2 = p2.getX(); final double y2 = p2.getY(); - final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(), - arrowHorizontalAlignment()); + final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()) + .withLabel(branch.getTextBlockPositive(), arrowHorizontalAlignment()); // snake.addPoint(x1, y1); snake.addPoint(x2, y1); snake.addPoint(x2, y2); @@ -139,9 +139,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds { final Ftile single = tiles.get(0); conns.add(new ConnectionVerticalTop(single, branches.get(0))); - if (single.calculateDimension(stringBounder).hasPointOut()) { + if (single.calculateDimension(stringBounder).hasPointOut()) conns.add(new ConnectionVerticalBottom(single)); - } return FtileUtils.addConnection(this, conns); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java index 1ce3ab43b..d50cbf46f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java @@ -66,7 +66,7 @@ public class FtileBlackBlock extends AbstractFtile { private double width; private double height; private TextBlock label = TextBlockUtils.empty(0, 0); - private final HColor colorBar; + private HColor colorBar; private final Swimlane swimlane; public FtileBlackBlock(ISkinParam skinParam, HColor colorBar, Swimlane swimlane) { @@ -93,16 +93,17 @@ public class FtileBlackBlock extends AbstractFtile { return new FtileGeometry(width + supp, height, width / 2, 0, height); } - private StyleSignature getDefaultStyleDefinitionBar() { - return StyleSignature.of(SName.root, SName.element, SName.activityBar); + private StyleSignature getSignature() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activityBar); } public void drawU(UGraphic ug) { final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX(); if (UseStyle.useBetaStyle()) { - final Style style = getDefaultStyleDefinitionBar().getMergedStyle(skinParam().getCurrentStyleBuilder()); + final Style style = getSignature().getMergedStyle(skinParam().getCurrentStyleBuilder()); final double shadowing = style.value(PName.Shadowing).asDouble(); rect.setDeltaShadow(shadowing); + colorBar = style.value(PName.BackGroundColor).asColor(skinParam().getThemeStyle(), getIHtmlColorSet()); } else { if (skinParam().shadowing(null)) rect.setDeltaShadow(3); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java index bfcda35a3..792a399fa 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java @@ -59,8 +59,8 @@ public class FtileCircleEnd extends AbstractFtile { private static final int SIZE = 20; - private final HColor borderColor; - private final HColor backColor; + private HColor borderColor; + private HColor backColor; private final Swimlane swimlane; private double shadowing; @@ -76,17 +76,18 @@ public class FtileCircleEnd extends AbstractFtile { this.swimlane = swimlane; if (UseStyle.useBetaStyle()) { this.shadowing = style.value(PName.Shadowing).asDouble(); - } else { - if (skinParam().shadowing(null)) { - this.shadowing = 3; - } + this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + } else if (skinParam().shadowing(null)) { + this.shadowing = 3; } + } public Set getSwimlanes() { - if (swimlane == null) { + if (swimlane == null) return Collections.emptySet(); - } + return Collections.singleton(swimlane); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java index 4f9efbedc..ed895e90d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java @@ -57,18 +57,23 @@ public class FtileCircleStart extends AbstractFtile { private static final int SIZE = 20; - private final HColor backColor; + private HColor backColor; + private HColor borderColor; private final Swimlane swimlane; private double shadowing; public FtileCircleStart(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { super(skinParam); - this.backColor = backColor; this.swimlane = swimlane; - if (UseStyle.useBetaStyle()) + this.backColor = backColor; + this.borderColor = new HColorNone(); + if (UseStyle.useBetaStyle()) { this.shadowing = style.value(PName.Shadowing).asDouble(); - else if (skinParam().shadowing(null)) + this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + } else if (skinParam().shadowing(null)) { this.shadowing = 3; + } } @Override @@ -77,9 +82,9 @@ public class FtileCircleStart extends AbstractFtile { } public Set getSwimlanes() { - if (swimlane == null) { + if (swimlane == null) return Collections.emptySet(); - } + return Collections.singleton(swimlane); } @@ -94,7 +99,7 @@ public class FtileCircleStart extends AbstractFtile { public void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); circle.setDeltaShadow(shadowing); - ug.apply(new HColorNone()).apply(backColor.bg()).draw(circle); + ug.apply(borderColor).apply(backColor.bg()).draw(circle); } @Override diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java index e76423ca5..efc2107e7 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java @@ -58,8 +58,8 @@ public class FtileCircleStop extends AbstractFtile { private static final int SIZE = 22; - private final HColor borderColor; - private final HColor backColor; + private HColor borderColor; + private HColor backColor; private final Swimlane swimlane; private double shadowing; @@ -75,17 +75,18 @@ public class FtileCircleStop extends AbstractFtile { this.swimlane = swimlane; if (UseStyle.useBetaStyle()) { this.shadowing = style.value(PName.Shadowing).asDouble(); - } else { - if (skinParam().shadowing(null)) { - this.shadowing = 3; - } + this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + } else if (skinParam().shadowing(null)) { + this.shadowing = 3; } + } public Set getSwimlanes() { - if (swimlane == null) { + if (swimlane == null) return Collections.emptySet(); - } + return Collections.singleton(swimlane); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondSquare.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondSquare.java index 27ae55252..df3d2577d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondSquare.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondSquare.java @@ -88,7 +88,8 @@ public class FtileDiamondSquare extends FtileDiamondWIP { final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()); - ug.draw(Hexagon.asPolygonSquare(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); + + ug.draw(Hexagon.asPolygonSquare(shadowing, dimTotal.getWidth(), dimTotal.getHeight())); // Fix why north and south are the same north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); @@ -114,9 +115,9 @@ public class FtileDiamondSquare extends FtileDiamondWIP { private Dimension2D calculateDimensionInternal(StringBounder stringBounder) { final Dimension2D dimLabel = label.calculateDimension(stringBounder); - if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) { + if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) return new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2); - } + Dimension2D result = dimLabel; result = Dimension2DDouble.delta(result, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2); return result; diff --git a/src/net/sourceforge/plantuml/api/PSystemFactory.java b/src/net/sourceforge/plantuml/api/PSystemFactory.java index 054ed1974..afaf2a29b 100644 --- a/src/net/sourceforge/plantuml/api/PSystemFactory.java +++ b/src/net/sourceforge/plantuml/api/PSystemFactory.java @@ -42,7 +42,7 @@ import net.sourceforge.plantuml.core.UmlSource; public interface PSystemFactory { - Diagram createSystem(UmlSource source, ISkinSimple skinParam); + Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam); DiagramType getDiagramType(); diff --git a/src/net/sourceforge/plantuml/ThemeStyle.java b/src/net/sourceforge/plantuml/api/ThemeStyle.java similarity index 95% rename from src/net/sourceforge/plantuml/ThemeStyle.java rename to src/net/sourceforge/plantuml/api/ThemeStyle.java index d0f756d44..b7f7d690c 100644 --- a/src/net/sourceforge/plantuml/ThemeStyle.java +++ b/src/net/sourceforge/plantuml/api/ThemeStyle.java @@ -33,10 +33,10 @@ * * */ -package net.sourceforge.plantuml; +package net.sourceforge.plantuml.api; public enum ThemeStyle { - DARK, LIGHT + LIGHT_REGULAR, DARK } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/board/BoardDiagram.java b/src/net/sourceforge/plantuml/board/BoardDiagram.java index a569b0375..43b9a3fd0 100644 --- a/src/net/sourceforge/plantuml/board/BoardDiagram.java +++ b/src/net/sourceforge/plantuml/board/BoardDiagram.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -69,17 +70,15 @@ public class BoardDiagram extends UmlDiagram { return new DiagramDescription("Board"); } - public BoardDiagram(UmlSource source) { - super(source, UmlDiagramType.BOARD); + public BoardDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.BOARD); } @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return createImageBuilder(fileFormatOption) - .drawable(getTextBlock()) - .write(os); + return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os); } private TextBlockBackcolored getTextBlock() { diff --git a/src/net/sourceforge/plantuml/board/BoardDiagramFactory.java b/src/net/sourceforge/plantuml/board/BoardDiagramFactory.java index f8577b997..2936275b1 100644 --- a/src/net/sourceforge/plantuml/board/BoardDiagramFactory.java +++ b/src/net/sourceforge/plantuml/board/BoardDiagramFactory.java @@ -39,9 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -68,8 +69,8 @@ public class BoardDiagramFactory extends PSystemCommandFactory { } @Override - public BoardDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new BoardDiagram(source); + public BoardDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new BoardDiagram(style, source); } } diff --git a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java index 34f03d0f2..2f1ef441f 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmDiagram.java +++ b/src/net/sourceforge/plantuml/bpm/BpmDiagram.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -74,29 +75,26 @@ public class BpmDiagram extends UmlDiagram { return new DiagramDescription("(Bpm Diagram)"); } - public BpmDiagram(UmlSource source) { - super(source, UmlDiagramType.BPM); + public BpmDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.BPM); } @Override public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { - return super.createImageBuilder(fileFormatOption) - .annotations(false); + return super.createImageBuilder(fileFormatOption).annotations(false); } @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return createImageBuilder(fileFormatOption) - .drawable(getUDrawable()) - .write(os); + return createImageBuilder(fileFormatOption).drawable(getUDrawable()).write(os); } private UDrawable getUDrawable() { final Grid grid = createGrid(); cleanGrid(grid); - final GridArray gridArray = grid.toArray(SkinParam.create(getUmlDiagramType())); + final GridArray gridArray = grid.toArray(SkinParam.create(getUmlDiagramType(), ThemeStyle.LIGHT_REGULAR)); // gridArray.addEdges(edges); // System.err.println("gridArray=" + gridArray); return gridArray; diff --git a/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java b/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java index 627cedd3a..577ccbe8c 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java +++ b/src/net/sourceforge/plantuml/bpm/BpmDiagramFactory.java @@ -40,6 +40,7 @@ import java.util.List; import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; @@ -65,8 +66,8 @@ public class BpmDiagramFactory extends PSystemCommandFactory { } @Override - public AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new BpmDiagram(source); + public AbstractPSystem createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new BpmDiagram(style, source); } } diff --git a/src/net/sourceforge/plantuml/braille/BrailleDrawer.java b/src/net/sourceforge/plantuml/braille/BrailleDrawer.java index 174706fc8..66b29bfa4 100644 --- a/src/net/sourceforge/plantuml/braille/BrailleDrawer.java +++ b/src/net/sourceforge/plantuml/braille/BrailleDrawer.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.braille; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -55,7 +55,7 @@ public class BrailleDrawer implements UDrawable { } public void drawU(UGraphic ug) { - ug = ug.apply(HColorSet.instance().getColorOrWhite(ThemeStyle.LIGHT, "#F0F0F0")); + ug = ug.apply(HColorSet.instance().getColorOrWhite(ThemeStyle.LIGHT_REGULAR, "#F0F0F0")); for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) { ug.apply(UTranslate.dx(x * step + spotSize + 1)) .draw(ULine.vline((grid.getMaxY() - grid.getMinY()) * step)); diff --git a/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java b/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java index e179d0d26..b139fdb57 100644 --- a/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java +++ b/src/net/sourceforge/plantuml/classdiagram/AbstractEntityDiagram.java @@ -42,14 +42,15 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; public abstract class AbstractEntityDiagram extends CucaDiagram { - public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { - super(source, type, orig); + public AbstractEntityDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) { + super(style, source, type, orig); } final protected List getDotStrings() { diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index a3ac3e6c3..d8e07ca1e 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java @@ -42,6 +42,7 @@ import java.util.Objects; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.creole.CreoleMode; @@ -61,8 +62,8 @@ import net.sourceforge.plantuml.svek.image.EntityImageClass; public class ClassDiagram extends AbstractClassOrObjectDiagram { - public ClassDiagram(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.CLASS, skinParam); + public ClassDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.CLASS, skinParam); } private Code getShortName1972(Code code) { @@ -195,10 +196,9 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { final RowLayout rawLayout = getRawLayout(i); fullLayout.addRowLayout(rawLayout); } - return createImageBuilder(fileFormatOption) - .annotations(false) // Backwards compatibility - this only applies when "layout_new_line" is used - .drawable(fullLayout) - .write(os); + return createImageBuilder(fileFormatOption).annotations(false) // Backwards compatibility - this only applies + // when "layout_new_line" is used + .drawable(fullLayout).write(os); } private RowLayout getRawLayout(int raw) { diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index a598c32cb..cd5944323 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -40,6 +40,7 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod; import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing; import net.sourceforge.plantuml.classdiagram.command.CommandCreateClass; @@ -64,8 +65,8 @@ import net.sourceforge.plantuml.command.CommandNamespaceEmpty; import net.sourceforge.plantuml.command.CommandPackage; import net.sourceforge.plantuml.command.CommandPackageEmpty; import net.sourceforge.plantuml.command.CommandRankDir; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.note.CommandConstraintOnLinks; import net.sourceforge.plantuml.command.note.CommandFactoryNote; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; @@ -84,8 +85,8 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap; public class ClassDiagramFactory extends PSystemCommandFactory { @Override - public ClassDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new ClassDiagram(source, skinParam); + public ClassDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new ClassDiagram(style, source, skinParam); } @Override diff --git a/src/net/sourceforge/plantuml/command/CommandAssumeTransparent.java b/src/net/sourceforge/plantuml/command/CommandAssumeTransparent.java index a821d89fc..d7fbd7232 100644 --- a/src/net/sourceforge/plantuml/command/CommandAssumeTransparent.java +++ b/src/net/sourceforge/plantuml/command/CommandAssumeTransparent.java @@ -36,7 +36,6 @@ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.LineLocation; -import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -61,8 +60,9 @@ public class CommandAssumeTransparent extends SingleLineCommand2 @Override protected CommandExecutionResult executeArg(TitledDiagram system, LineLocation location, RegexResult arg) { - final String type = arg.get("TYPE", 0).toUpperCase(); - system.getSkinParam().assumeTransparent(ThemeStyle.valueOf(type)); + // final String type = arg.get("TYPE", 0).toUpperCase(); + // system.getSkinParam().assumeTransparent(ThemeStyle.valueOf(type)); + // This is ignored and will be suppressed in some future return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java b/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java index 40bc79f94..620c8163b 100644 --- a/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java +++ b/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java @@ -40,6 +40,7 @@ import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -57,20 +58,20 @@ public abstract class PSystemBasicFactory

extends PSy this(DiagramType.UML); } - public abstract P executeLine(UmlSource source, P system, String line); + public abstract P executeLine(ThemeStyle style, UmlSource source, P system, String line); - public abstract P initDiagram(UmlSource source, String startLine); + public abstract P initDiagram(ThemeStyle style, UmlSource source, String startLine); private boolean isEmptyLine(StringLocated result) { return result.getTrimmed().getString().length() == 0; } @Override - final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { + final public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { source = source.removeInitialSkinparam(); final IteratorCounter2 it = source.iterator2(); final StringLocated startLine = it.next(); - P system = initDiagram(source, startLine.getString()); + P system = initDiagram(style, source, startLine.getString()); boolean first = true; while (it.hasNext()) { final StringLocated s = it.next(); @@ -84,7 +85,7 @@ public abstract class PSystemBasicFactory

extends PSy } return system; } - system = executeLine(source, system, s.getString()); + system = executeLine(style, source, system, s.getString()); if (system == null) { final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation()); // return PSystemErrorUtils.buildV1(source, err, null); diff --git a/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java b/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java index 5e0977dd5..b248cf427 100644 --- a/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java +++ b/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -57,7 +58,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory { protected abstract List createCommands(); - public abstract AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam); + public abstract AbstractPSystem createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam); protected PSystemCommandFactory() { this(DiagramType.UML); @@ -68,7 +69,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory { } @Override - final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { + final public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { final IteratorCounter2 it = source.iterator2(); final StringLocated startLine = it.next(); if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) @@ -80,7 +81,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory { return buildEmptyError(source, startLine.getLocation(), it.getTrace()); } - AbstractPSystem sys = createEmptyDiagram(source, skinParam); + AbstractPSystem sys = createEmptyDiagram(style, source, skinParam); while (it.hasNext()) { if (StartUtils.isArobaseEndDiagram(it.peek().getString())) { diff --git a/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java b/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java index dfba3f108..ac59479ec 100644 --- a/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java +++ b/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -57,11 +58,11 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory { } @Override - final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { + final public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { - if (source.getTotalLineCount() != 3) { + if (source.getTotalLineCount() != 3) return null; - } + final IteratorCounter2 it = source.iterator2(); if (source.isEmpty()) { final LineLocation location = it.next().getLocation(); @@ -69,17 +70,16 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory { } final StringLocated startLine = it.next(); - if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) { + if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) throw new UnsupportedOperationException(); - } - if (it.hasNext() == false) { + if (it.hasNext() == false) return buildEmptyError(source, startLine.getLocation(), it.getTrace()); - } + final StringLocated s = it.next(); - if (StartUtils.isArobaseEndDiagram(s.getString())) { + if (StartUtils.isArobaseEndDiagram(s.getString())) return buildEmptyError(source, s.getLocation(), it.getTrace()); - } + final AbstractPSystem sys = executeLine(source, s.getString()); if (sys == null) { final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation()); diff --git a/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java b/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java index f0618cc73..7dc3449f3 100644 --- a/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java +++ b/src/net/sourceforge/plantuml/compositediagram/CompositeDiagram.java @@ -39,6 +39,7 @@ import java.util.Objects; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.cucadiagram.Code; @@ -49,8 +50,8 @@ import net.sourceforge.plantuml.graphic.USymbol; public class CompositeDiagram extends AbstractEntityDiagram { - public CompositeDiagram(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.COMPOSITE, skinParam); + public CompositeDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.COMPOSITE, skinParam); } @Override diff --git a/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java b/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java index 0ac6bdff5..51470d8cc 100644 --- a/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java +++ b/src/net/sourceforge/plantuml/compositediagram/CompositeDiagramFactory.java @@ -39,9 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.compositediagram.command.CommandCreateBlock; import net.sourceforge.plantuml.compositediagram.command.CommandCreatePackageBlock; import net.sourceforge.plantuml.compositediagram.command.CommandEndPackageBlock; @@ -69,7 +70,7 @@ public class CompositeDiagramFactory extends PSystemCommandFactory { } @Override - public CompositeDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new CompositeDiagram(source, skinParam); + public CompositeDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new CompositeDiagram(style, source, skinParam); } } diff --git a/src/net/sourceforge/plantuml/creole/legacy/PSystemCreole.java b/src/net/sourceforge/plantuml/creole/legacy/PSystemCreole.java index 212851684..b4f9a3758 100644 --- a/src/net/sourceforge/plantuml/creole/legacy/PSystemCreole.java +++ b/src/net/sourceforge/plantuml/creole/legacy/PSystemCreole.java @@ -77,7 +77,7 @@ public class PSystemCreole extends PlainDiagram { final UFont font = UFont.serif(14); final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font); final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, - SkinParam.create(UmlDiagramType.SEQUENCE), CreoleMode.FULL).createSheet(display); + SkinParam.create(UmlDiagramType.SEQUENCE, fileFormatOption.getStyle()), CreoleMode.FULL).createSheet(display); return new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); // final Dimension2D dim = TextBlockUtils.getDimension(sheetBlock); diff --git a/src/net/sourceforge/plantuml/creole/legacy/PSystemCreoleFactory.java b/src/net/sourceforge/plantuml/creole/legacy/PSystemCreoleFactory.java index f9f200688..f9663fb0d 100644 --- a/src/net/sourceforge/plantuml/creole/legacy/PSystemCreoleFactory.java +++ b/src/net/sourceforge/plantuml/creole/legacy/PSystemCreoleFactory.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.creole.legacy; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -46,15 +47,15 @@ public class PSystemCreoleFactory extends PSystemBasicFactory { } @Override - public PSystemCreole initDiagram(UmlSource source, String startLine) { - if (getDiagramType() == DiagramType.CREOLE) { + public PSystemCreole initDiagram(ThemeStyle style, UmlSource source, String startLine) { + if (getDiagramType() == DiagramType.CREOLE) return new PSystemCreole(source); - } + return null; } @Override - public PSystemCreole executeLine(UmlSource source, PSystemCreole system, String line) { + public PSystemCreole executeLine(ThemeStyle style, UmlSource source, PSystemCreole system, String line) { system.doCommandLine(line); return system; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java index 0b299a987..02a513089 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java +++ b/src/net/sourceforge/plantuml/cucadiagram/CucaDiagram.java @@ -53,6 +53,7 @@ import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.api.ImageDataSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; @@ -119,8 +120,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, return ident; } - public CucaDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { - super(source, type, orig); + public CucaDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) { + super(style, source, type, orig); this.stacks2.add(Ident.empty()); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java b/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java index 6125977c4..878961540 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java +++ b/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java @@ -54,16 +54,16 @@ public class DisplaySection { public DisplaySection withPage(int page, int lastpage) { final DisplaySection result = new DisplaySection(); - for (Map.Entry ent : this.map.entrySet()) { + for (Map.Entry ent : this.map.entrySet()) result.map.put(ent.getKey(), ent.getValue().withPage(page, lastpage)); - } + return result; } public Display getDisplay() { - if (map.size() == 0) { + if (map.size() == 0) return null; - } + return map.values().iterator().next(); } @@ -72,31 +72,31 @@ public class DisplaySection { } public final HorizontalAlignment getHorizontalAlignment() { - if (map.size() == 0) { + if (map.size() == 0) return HorizontalAlignment.CENTER; - } + return map.keySet().iterator().next(); } public boolean isNull() { - if (map.size() == 0) { + if (map.size() == 0) return true; - } + final Display display = map.values().iterator().next(); return Display.isNull(display); } public TextBlock createRibbon(FontConfiguration fontConfiguration, ISkinSimple spriteContainer, Style style) { - if (map.size() == 0) { + if (map.size() == 0) return null; - } + final Display display = map.values().iterator().next(); - if (Display.isNull(display) || display.size() == 0) { + if (Display.isNull(display) || display.size() == 0) return null; - } - if (style != null) { + + if (style != null) return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer); - } + return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java b/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java index ac6f107d1..79050b43d 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java +++ b/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java @@ -40,7 +40,7 @@ import java.util.Collections; import java.util.List; import java.util.StringTokenizer; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.ugraphic.UStroke; diff --git a/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java b/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java index 807e68cb5..c31055964 100644 --- a/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java +++ b/src/net/sourceforge/plantuml/definition/PSystemDefinitionFactory.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.definition; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -46,15 +47,15 @@ public class PSystemDefinitionFactory extends PSystemBasicFactory { @Override protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) { final int dpi = diagram.getSkinParam().getDpi(); - final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSource(), diagram.getSkinParam()); - if (dpi != 96) { + final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSkinParam().getThemeStyle(), + diagram.getSource(), diagram.getSkinParam()); + if (dpi != 96) emptyDiagram.setParam("dpi", "" + dpi); - } - NewpagedDiagram result = new NewpagedDiagram(diagram.getSource(), diagram, emptyDiagram); + + final NewpagedDiagram result = new NewpagedDiagram(diagram.getSource(), diagram, emptyDiagram); return CommandExecutionResult.newDiagram(result); } } diff --git a/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java b/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java index 166bebd52..44bfb6c20 100644 --- a/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java +++ b/src/net/sourceforge/plantuml/directdot/PSystemDotFactory.java @@ -34,6 +34,7 @@ */ package net.sourceforge.plantuml.directdot; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -47,21 +48,21 @@ public class PSystemDotFactory extends PSystemBasicFactory { } @Override - public PSystemDot initDiagram(UmlSource source, String startLine) { + public PSystemDot initDiagram(ThemeStyle style, UmlSource source, String startLine) { data = null; return null; } @Override - public PSystemDot executeLine(UmlSource source, PSystemDot system, String line) { + public PSystemDot executeLine(ThemeStyle style, UmlSource source, PSystemDot system, String line) { if (system == null && line.matches("(strict\\s+)?(di)?graph\\s+\"?[-\\w]+\"?\\s*\\{")) { data = new StringBuilder(line); data.append("\n"); return new PSystemDot(source, data.toString()); } - if (data == null || system == null) { + if (data == null || system == null) return null; - } + data.append(line); data.append("\n"); return new PSystemDot(source, data.toString()); diff --git a/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java b/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java index bf8d1e37e..daa3a3451 100644 --- a/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java +++ b/src/net/sourceforge/plantuml/ditaa/PSystemDitaaFactory.java @@ -37,10 +37,10 @@ package net.sourceforge.plantuml.ditaa; import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; -import net.sourceforge.plantuml.definition.PSystemDefinition; public class PSystemDitaaFactory extends PSystemBasicFactory { @@ -56,15 +56,15 @@ public class PSystemDitaaFactory extends PSystemBasicFactory { } @Override - public PSystemDitaa initDiagram(UmlSource source, String startLine) { + public PSystemDitaa initDiagram(ThemeStyle style, UmlSource source, String startLine) { boolean performSeparationOfCommonEdges = true; - if (startLine != null && (startLine.contains("-E") || startLine.contains("--no-separation"))) { + if (startLine != null && (startLine.contains("-E") || startLine.contains("--no-separation"))) performSeparationOfCommonEdges = false; - } + boolean dropShadows = true; - if (startLine != null && (startLine.contains("-S") || startLine.contains("--no-shadows"))) { + if (startLine != null && (startLine.contains("-S") || startLine.contains("--no-shadows"))) dropShadows = false; - } + final float scale = extractScale(startLine); if (getDiagramType() == DiagramType.UML) { return null; @@ -76,29 +76,29 @@ public class PSystemDitaaFactory extends PSystemBasicFactory { } @Override - public PSystemDitaa executeLine(UmlSource source, PSystemDitaa system, String line) { + public PSystemDitaa executeLine(ThemeStyle style, UmlSource source, PSystemDitaa system, String line) { if (system == null && (line.equals("ditaa") || line.startsWith("ditaa("))) { boolean performSeparationOfCommonEdges = true; - if (line.contains("-E") || line.contains("--no-separation")) { + if (line.contains("-E") || line.contains("--no-separation")) performSeparationOfCommonEdges = false; - } + boolean dropShadows = true; - if (line.contains("-S") || line.contains("--no-shadows")) { + if (line.contains("-S") || line.contains("--no-shadows")) dropShadows = false; - } + final float scale = extractScale(line); return new PSystemDitaa(source, "", performSeparationOfCommonEdges, dropShadows, scale); } - if (system == null) { + if (system == null) return null; - } + return system.add(line); } private float extractScale(String line) { - if (line == null) { + if (line == null) return 1; - } + final Pattern p = Pattern.compile("scale=([\\d.]+)"); final Matcher m = p.matcher(line); if (m.find()) { diff --git a/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java b/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java index 5943498e0..e95af5734 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemWelcomeFactory.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml.eggs; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.api.PSystemFactory; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -45,10 +46,10 @@ import net.sourceforge.plantuml.graphic.GraphicPosition; public class PSystemWelcomeFactory implements PSystemFactory { @Override - public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { - if (source.getTotalLineCount() == 2) { + public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + if (source.getTotalLineCount() == 2) return new PSystemWelcome(source, GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT); - } + return null; } diff --git a/src/net/sourceforge/plantuml/elk/ElkPath.java b/src/net/sourceforge/plantuml/elk/ElkPath.java index 42456db70..eabb4d17d 100644 --- a/src/net/sourceforge/plantuml/elk/ElkPath.java +++ b/src/net/sourceforge/plantuml/elk/ElkPath.java @@ -39,6 +39,16 @@ import java.awt.geom.Point2D; import java.util.Collection; import java.util.List; +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.cucadiagram.CucaDiagram; +import net.sourceforge.plantuml.cucadiagram.Link; +import net.sourceforge.plantuml.cucadiagram.LinkDecor; +import net.sourceforge.plantuml.cucadiagram.LinkType; + /* * You can choose between real "org.eclipse.elk..." classes or proxied "net.sourceforge.plantuml.elk.proxy..." * @@ -61,19 +71,14 @@ import net.sourceforge.plantuml.elk.proxy.graph.ElkBendPoint; import net.sourceforge.plantuml.elk.proxy.graph.ElkEdge; import net.sourceforge.plantuml.elk.proxy.graph.ElkEdgeSection; import net.sourceforge.plantuml.elk.proxy.graph.ElkLabel; - -import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.LineParam; -import net.sourceforge.plantuml.UmlDiagramType; -import net.sourceforge.plantuml.cucadiagram.CucaDiagram; -import net.sourceforge.plantuml.cucadiagram.Link; -import net.sourceforge.plantuml.cucadiagram.LinkDecor; -import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -109,43 +114,51 @@ public class ElkPath implements UDrawable { } private ColorParam getArrowColorParam() { - if (diagram.getUmlDiagramType() == UmlDiagramType.CLASS) { + if (diagram.getUmlDiagramType() == UmlDiagramType.CLASS) return ColorParam.arrow; - } else if (diagram.getUmlDiagramType() == UmlDiagramType.OBJECT) { + else if (diagram.getUmlDiagramType() == UmlDiagramType.OBJECT) return ColorParam.arrow; - } else if (diagram.getUmlDiagramType() == UmlDiagramType.DESCRIPTION) { + else if (diagram.getUmlDiagramType() == UmlDiagramType.DESCRIPTION) return ColorParam.arrow; - } else if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) { + else if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) return ColorParam.arrow; - } else if (diagram.getUmlDiagramType() == UmlDiagramType.STATE) { + else if (diagram.getUmlDiagramType() == UmlDiagramType.STATE) return ColorParam.arrow; - } + throw new IllegalStateException(); } + private Style getStyle() { + final StyleSignature signature = StyleSignature.of(SName.root, SName.element, styleName, SName.arrow); + return signature.getMergedStyle(diagram.getCurrentStyleBuilder()); + } + public void drawU(UGraphic ug) { - if (link.isHidden()) { + if (link.isHidden()) return; - } - HColor color = rose.getHtmlColor(diagram.getSkinParam(), null, getArrowColorParam()); + HColor color; + final ISkinParam skinParam = diagram.getSkinParam(); + + if (UseStyle.useBetaStyle()) + color = getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + else + color = rose.getHtmlColor(skinParam, null, getArrowColorParam()); if (this.link.getColors() != null) { final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); - if (newColor != null) { + if (newColor != null) color = newColor; - } - } else if (this.link.getSpecificColor() != null) { color = this.link.getSpecificColor(); } final LinkType linkType = link.getType(); - UStroke stroke = linkType.getStroke3(diagram.getSkinParam().getThickness(LineParam.arrow, null)); - if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) { + UStroke stroke = linkType.getStroke3(skinParam.getThickness(LineParam.arrow, null)); + if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) stroke = link.getColors().getSpecificLineStroke(); - } + ug = ug.apply(stroke).apply(color); final List sections = edge.getSections(); @@ -195,15 +208,15 @@ public class ElkPath implements UDrawable { final TextBlock labelLink; // Nasty trick: we store the type of label (center/head/tail) in the text final String type = label.getText(); - if ("X".equals(type)) { + if ("X".equals(type)) labelLink = centerLabel; - } else if ("1".equals(type)) { + else if ("1".equals(type)) labelLink = tailLabel; - } else if ("2".equals(type)) { + else if ("2".equals(type)) labelLink = headLabel; - } else { + else continue; - } + labelLink.drawU(ug.apply(new UTranslate(x, y))); } } diff --git a/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java b/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java index 89163e2ca..2dee35bb6 100644 --- a/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java +++ b/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java @@ -54,41 +54,39 @@ public class PSystemErrorUtils { } public static PSystemError merge(Collection ps) { - if (ps.size() == 0) { + if (ps.size() == 0) throw new IllegalStateException(); - } + UmlSource source = null; final List errors = new ArrayList<>(); // final List debugs = new ArrayList<>(); final List errorsV2 = new ArrayList<>(); for (PSystemError system : ps) { - if (system == null) { + if (system == null) continue; - } - if (system.getSource() != null && source == null) { + + if (system.getSource() != null && source == null) source = system.getSource(); - } + errors.addAll(system.getErrorsUml()); - if (system instanceof PSystemErrorV2) { + if (system instanceof PSystemErrorV2) errorsV2.add((PSystemErrorV2) system); - } } - if (source == null) { + if (source == null) throw new IllegalStateException(); - } - if (errorsV2.size() > 0) { + + if (errorsV2.size() > 0) return mergeV2(errorsV2); - } + throw new IllegalStateException(); } private static PSystemErrorV2 mergeV2(List errorsV2) { PSystemErrorV2 result = null; - for (PSystemErrorV2 err : errorsV2) { - if (result == null || result.score() < err.score()) { + for (PSystemErrorV2 err : errorsV2) + if (result == null || result.score() < err.score()) result = err; - } - } + return result; } diff --git a/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java b/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java index 3b1d092c7..e22ebfcc1 100644 --- a/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java +++ b/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java @@ -43,7 +43,6 @@ import java.util.concurrent.locks.ReentrantLock; import ext.plantuml.com.google.zxing.BarcodeFormat; import ext.plantuml.com.google.zxing.EncodeHintType; -import ext.plantuml.com.google.zxing.WriterException; import ext.plantuml.com.google.zxing.client.j2se.MatrixToImageWriter; import ext.plantuml.com.google.zxing.common.BitMatrix; import ext.plantuml.com.google.zxing.qrcode.QRCodeWriter; @@ -64,7 +63,7 @@ public class FlashCodeUtilsZxing implements FlashCodeUtils { final int multiple = 1; final BitMatrix bit = writer.encode(s, BarcodeFormat.QR_CODE, multiple, hints); return MatrixToImageWriter.toBufferedImage(bit, fore.getRGB() | 0xFF000000, back.getRGB() | 0xFF000000); - } catch (WriterException e) { + } catch (Exception e) { Log.debug("Cannot create qrcode " + e); } finally { lock.unlock(); diff --git a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java index 93666521b..b7a890aef 100644 --- a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java +++ b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagram.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; @@ -89,8 +90,8 @@ public class FlowDiagram extends UmlDiagram implements TextBlock { return new DiagramDescription("Flow Diagram"); } - public FlowDiagram(UmlSource source) { - super(source, UmlDiagramType.FLOW); + public FlowDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.FLOW); } public void lineSimple(TileGeometry orientation, String idDest, String label) { @@ -126,8 +127,7 @@ public class FlowDiagram extends UmlDiagram implements TextBlock { public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { return imageBuilder(fileFormatOption) .dimension(calculateDimension(fileFormatOption.getDefaultStringBounder(getSkinParam()))) - .margin(getDefaultMargins()) - .metadata(fileFormatOption.isWithMetadata() ? getMetadata() : null) + .margin(getDefaultMargins()).metadata(fileFormatOption.isWithMetadata() ? getMetadata() : null) .seed(seed()); } @@ -135,9 +135,7 @@ public class FlowDiagram extends UmlDiagram implements TextBlock { protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return createImageBuilder(fileFormatOption) - .drawable(this) - .write(os); + return createImageBuilder(fileFormatOption).drawable(this).write(os); } public void drawU(UGraphic ug) { @@ -156,8 +154,8 @@ public class FlowDiagram extends UmlDiagram implements TextBlock { final Dimension2D dimBox = box.calculateDimension(stringBounder); final double deltaX = SINGLE_SIZE_X * 2 - dimBox.getWidth(); final double deltaY = SINGLE_SIZE_Y * 2 - dimBox.getHeight(); - box.drawU(ug.apply(new UTranslate((x + xmin * SINGLE_SIZE_X + deltaX / 2), - (y + ymin * SINGLE_SIZE_Y + deltaY / 2)))); + box.drawU(ug.apply( + new UTranslate((x + xmin * SINGLE_SIZE_X + deltaX / 2), (y + ymin * SINGLE_SIZE_Y + deltaY / 2)))); } ug = ug.apply(HColorUtils.MY_RED); ug = ug.apply(HColorUtils.MY_RED.bg()); diff --git a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java index 72e96c3c6..6d0c10509 100644 --- a/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java +++ b/src/net/sourceforge/plantuml/flowdiagram/FlowDiagramFactory.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; @@ -51,8 +52,8 @@ public class FlowDiagramFactory extends PSystemCommandFactory { } @Override - public FlowDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new FlowDiagram(source); + public FlowDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new FlowDiagram(style, source); } @Override diff --git a/src/net/sourceforge/plantuml/gitlog/GNode.java b/src/net/sourceforge/plantuml/gitlog/GNode.java index fc4cf6536..a41bb21c1 100644 --- a/src/net/sourceforge/plantuml/gitlog/GNode.java +++ b/src/net/sourceforge/plantuml/gitlog/GNode.java @@ -85,33 +85,33 @@ public class GNode { } public boolean canEatTheNextOne() { - if (up.size() != 1) { + if (up.size() != 1) return false; - } - if (down.size() != 1) { + + if (down.size() != 1) return false; - } + final GNode next = down.get(0); - if (next.up.size() != 1) { + if (next.up.size() != 1) return false; - } - if (next.down.size() != 1) { + + if (next.down.size() != 1) return false; - } + return true; } public GNode eatTheNextOne() { - if (canEatTheNextOne() == false) { + if (canEatTheNextOne() == false) throw new IllegalStateException(); - } + final GNode removed = down.get(0); final GNode newNext = removed.down.get(0); this.texts.addAll(removed.texts); this.down.set(0, newNext); - if (newNext.up.remove(removed) == false) { + if (newNext.up.remove(removed) == false) throw new IllegalStateException(); - } + newNext.up.add(this); return removed; } diff --git a/src/net/sourceforge/plantuml/gitlog/GitDiagram.java b/src/net/sourceforge/plantuml/gitlog/GitDiagram.java index d88b7c328..64d9f641f 100644 --- a/src/net/sourceforge/plantuml/gitlog/GitDiagram.java +++ b/src/net/sourceforge/plantuml/gitlog/GitDiagram.java @@ -43,6 +43,7 @@ import java.util.Collection; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; @@ -57,8 +58,8 @@ public class GitDiagram extends UmlDiagram { private final Collection gnodes; - public GitDiagram(UmlSource source, GitTextArea textArea) { - super(source, UmlDiagramType.GIT); + public GitDiagram(ThemeStyle style, UmlSource source, GitTextArea textArea) { + super(style, source, UmlDiagramType.GIT); this.gnodes = new GNodeBuilder(textArea.getAllCommits()).getAllNodes(); new GNodeBuilder(textArea.getAllCommits()); } @@ -67,14 +68,11 @@ public class GitDiagram extends UmlDiagram { return new DiagramDescription("(Git)"); } - @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return createImageBuilder(fileFormatOption) - .drawable(getTextBlock()) - .write(os); + return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os); } private void drawInternal(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/gitlog/GitDiagramFactory.java b/src/net/sourceforge/plantuml/gitlog/GitDiagramFactory.java index 54b311fe8..314c7629d 100644 --- a/src/net/sourceforge/plantuml/gitlog/GitDiagramFactory.java +++ b/src/net/sourceforge/plantuml/gitlog/GitDiagramFactory.java @@ -39,6 +39,7 @@ import java.util.Iterator; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; @@ -51,19 +52,19 @@ public class GitDiagramFactory extends PSystemAbstractFactory { } @Override - public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { + public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { final GitTextArea textArea = new GitTextArea(); final Iterator it = source.iterator2(); it.next(); while (true) { final String line = it.next().getString(); - if (it.hasNext() == false) { + if (it.hasNext() == false) break; - } + textArea.add(line); } - return new GitDiagram(source, textArea); + return new GitDiagram(style, source, textArea); } } diff --git a/src/net/sourceforge/plantuml/gitlog/MagicBox.java b/src/net/sourceforge/plantuml/gitlog/MagicBox.java index 14609a0f6..5cd84fd1b 100644 --- a/src/net/sourceforge/plantuml/gitlog/MagicBox.java +++ b/src/net/sourceforge/plantuml/gitlog/MagicBox.java @@ -44,36 +44,39 @@ 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.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class MagicBox { private final ISkinParam skinParam; private final GNode node; + private final HColor fontColor; public MagicBox(ISkinParam skinParam, GNode node) { this.skinParam = skinParam; this.node = node; - + final Style style = StyleSignature.of(SName.root, SName.element, SName.gitDiagram) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + this.fontColor = style.value(PName.FontColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } private TextBlock getSmallBlock() { - final FontConfiguration mono = new FontConfiguration(UFont.monospaced(15).bold(), HColorUtils.BLACK, - HColorUtils.BLACK, false); - - final TextBlock big = node.getDisplay().create(mono, HorizontalAlignment.CENTER, skinParam); - return big; + final FontConfiguration fc = new FontConfiguration(UFont.monospaced(15).bold(), fontColor, fontColor, false); + return node.getDisplay().create(fc, HorizontalAlignment.CENTER, skinParam); } private TextBlock getCommentBlock() { if (node.getComment() != null && node.isTop()) { - final FontConfiguration tag = new FontConfiguration(UFont.sansSerif(13), HColorUtils.BLACK, - HColorUtils.BLACK, false); + final FontConfiguration tag = new FontConfiguration(UFont.sansSerif(13), fontColor, fontColor, false); return Display.create(node.getComment()).create(tag, HorizontalAlignment.CENTER, skinParam); } return TextBlockUtils.empty(0, 0); diff --git a/src/net/sourceforge/plantuml/gitlog/SmetanaForGit.java b/src/net/sourceforge/plantuml/gitlog/SmetanaForGit.java index 94f2694f4..064d85336 100644 --- a/src/net/sourceforge/plantuml/gitlog/SmetanaForGit.java +++ b/src/net/sourceforge/plantuml/gitlog/SmetanaForGit.java @@ -59,12 +59,13 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.jsondiagram.Mirror; +import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; import smetana.core.CString; import smetana.core.Macro; import smetana.core.Z; @@ -92,6 +93,10 @@ public class SmetanaForGit { .getMergedStyle(skinParam.getCurrentStyleBuilder()); } + private HColor arrowColor() { + return getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + } + public void drawMe(Collection gnodes) { initGraph(gnodes); @@ -101,12 +106,11 @@ public class SmetanaForGit { final MagicBox magicBox = new MagicBox(skinParam, ent.getKey()); magicBox.drawBorder(ug.apply(pos), getSize(node)); - } for (ST_Agedge_s edge : edges) { final ST_Agedgeinfo_t data = (ST_Agedgeinfo_t) Macro.AGDATA(edge); - new GitCurve(data, yMirror).drawCurve(HColorUtils.BLACK, ug); + new GitCurve(data, yMirror).drawCurve(arrowColor(), ug); } } @@ -127,9 +131,9 @@ public class SmetanaForGit { } private void initGraph(Collection gnodes) { - if (g != null) { + if (g != null) return; - } + Z.open(); try { g = agopen(new CString("g"), Z.z().Agdirected, null); @@ -142,9 +146,9 @@ public class SmetanaForGit { for (GNode gnode : nodes.keySet()) { for (GNode parent : gnode.getDowns()) { final ST_Agedge_s edge = createEdge(gnode, parent); - if (edge != null) { + if (edge != null) edges.add(edge); - } + } } diff --git a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java index 1dce16d93..faf7be449 100644 --- a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java +++ b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; diff --git a/src/net/sourceforge/plantuml/graphic/ColorChange.java b/src/net/sourceforge/plantuml/graphic/ColorChange.java index 46ada2c2a..a42e41ea8 100644 --- a/src/net/sourceforge/plantuml/graphic/ColorChange.java +++ b/src/net/sourceforge/plantuml/graphic/ColorChange.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.graphic; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; diff --git a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java index 860b4939a..e1babbcb1 100644 --- a/src/net/sourceforge/plantuml/graphic/FontConfiguration.java +++ b/src/net/sourceforge/plantuml/graphic/FontConfiguration.java @@ -81,7 +81,7 @@ public class FontConfiguration { } public static FontConfiguration blackBlueTrue(UFont font) { - return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLUE, true, 8); + return new FontConfiguration(font, HColorUtils.BLACK.withDark(HColorUtils.WHITE), HColorUtils.BLUE, true, 8); } public FontConfiguration(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { diff --git a/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java b/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java index 9a2cec54c..65ce0e8bc 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java +++ b/src/net/sourceforge/plantuml/graphic/HtmlCommandFactory.java @@ -37,10 +37,10 @@ package net.sourceforge.plantuml.graphic; import java.util.EnumSet; -import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; diff --git a/src/net/sourceforge/plantuml/graphic/Rainbow.java b/src/net/sourceforge/plantuml/graphic/Rainbow.java index e0bd9770c..8dc5f93dc 100644 --- a/src/net/sourceforge/plantuml/graphic/Rainbow.java +++ b/src/net/sourceforge/plantuml/graphic/Rainbow.java @@ -42,8 +42,8 @@ import java.util.Objects; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.Style; diff --git a/src/net/sourceforge/plantuml/graphic/Splitter.java b/src/net/sourceforge/plantuml/graphic/Splitter.java index f2eaf27f9..8f85017dc 100644 --- a/src/net/sourceforge/plantuml/graphic/Splitter.java +++ b/src/net/sourceforge/plantuml/graphic/Splitter.java @@ -42,7 +42,7 @@ import java.util.EnumSet; import java.util.List; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java b/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java index 0df7f8071..92f1146e3 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java @@ -122,13 +122,13 @@ class USymbolRectangle extends USymbol { stereotype.drawU(ug.apply(new UTranslate(posStereoX, posStereoY))); final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); final double posTitle; - if (labelAlignment == HorizontalAlignment.LEFT) { + if (labelAlignment == HorizontalAlignment.LEFT) posTitle = 3; - } else if (labelAlignment == HorizontalAlignment.RIGHT) { + else if (labelAlignment == HorizontalAlignment.RIGHT) posTitle = width - dimTitle.getWidth() - 3; - } else { + else posTitle = (width - dimTitle.getWidth()) / 2; - } + title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight()))); } diff --git a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java index bfd41ebe2..3ef7d3f5c 100644 --- a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java +++ b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.graphic.color; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.ugraphic.color.HColorSet; diff --git a/src/net/sourceforge/plantuml/graphic/color/Colors.java b/src/net/sourceforge/plantuml/graphic/color/Colors.java index c53dbfc3b..01e7886ff 100644 --- a/src/net/sourceforge/plantuml/graphic/color/Colors.java +++ b/src/net/sourceforge/plantuml/graphic/color/Colors.java @@ -45,8 +45,8 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.ugraphic.UGraphic; diff --git a/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java b/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java index 2fb773518..ed2fb434a 100644 --- a/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java +++ b/src/net/sourceforge/plantuml/hcl/HclDiagramFactory.java @@ -41,6 +41,7 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; @@ -56,7 +57,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory { } @Override - public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { + public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { final List highlighted = new ArrayList<>(); JsonValue data = null; StyleExtractor styleExtractor = null; @@ -77,7 +78,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory { } catch (Exception e) { e.printStackTrace(); } - final JsonDiagram result = new JsonDiagram(source, UmlDiagramType.HCL, data, highlighted); + final JsonDiagram result = new JsonDiagram(style, source, UmlDiagramType.HCL, data, highlighted); // if (styleExtractor != null) { // styleExtractor.applyStyles(result.getSkinParam()); // final String title = styleExtractor.getTitle(); diff --git a/src/net/sourceforge/plantuml/help/Help.java b/src/net/sourceforge/plantuml/help/Help.java index 687383b5d..c43afe0fd 100644 --- a/src/net/sourceforge/plantuml/help/Help.java +++ b/src/net/sourceforge/plantuml/help/Help.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; @@ -65,14 +66,13 @@ public class Help extends UmlDiagram { return new DiagramDescription("(Help)"); } - public Help(UmlSource source) { - super(source, UmlDiagramType.HELP); + public Help(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.HELP); } @Override public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { - return super.createImageBuilder(fileFormatOption) - .annotations(false); + return super.createImageBuilder(fileFormatOption).annotations(false); } @Override @@ -84,9 +84,7 @@ public class Help extends UmlDiagram { final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(), CreoleMode.FULL) .createSheet(display); final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); - return createImageBuilder(fileFormat) - .drawable(sheetBlock) - .write(os); + return createImageBuilder(fileFormat).drawable(sheetBlock).write(os); } public void add(CharSequence line) { diff --git a/src/net/sourceforge/plantuml/help/HelpFactory.java b/src/net/sourceforge/plantuml/help/HelpFactory.java index a7f9669a2..5ab9eab3a 100644 --- a/src/net/sourceforge/plantuml/help/HelpFactory.java +++ b/src/net/sourceforge/plantuml/help/HelpFactory.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.UmlSource; @@ -46,8 +47,8 @@ import net.sourceforge.plantuml.core.UmlSource; public class HelpFactory extends PSystemCommandFactory { @Override - public Help createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new Help(source); + public Help createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new Help(style, source); } @Override diff --git a/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java b/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java index 96f1a827e..4f9034b54 100644 --- a/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java +++ b/src/net/sourceforge/plantuml/jcckit/PSystemJcckitFactory.java @@ -42,13 +42,13 @@ import java.util.Properties; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; -import net.sourceforge.plantuml.ditaa.PSystemDitaa; public class PSystemJcckitFactory extends PSystemBasicFactory { @@ -61,7 +61,7 @@ public class PSystemJcckitFactory extends PSystemBasicFactory { } @Override - public PSystemJcckit initDiagram(UmlSource source, String startLine) { + public PSystemJcckit initDiagram(ThemeStyle style, UmlSource source, String startLine) { this.data = null; this.width = 640; this.height = 400; @@ -106,7 +106,7 @@ public class PSystemJcckitFactory extends PSystemBasicFactory { } @Override - public PSystemJcckit executeLine(UmlSource source, PSystemJcckit system, String line) { + public PSystemJcckit executeLine(ThemeStyle style, UmlSource source, PSystemJcckit system, String line) { if (system == null && line.startsWith("jcckit")) { data = new StringBuilder(); extractDimension(line); diff --git a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java index 1f0399b24..a4d2c7225 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java +++ b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java @@ -43,6 +43,7 @@ import java.util.List; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; @@ -66,8 +67,9 @@ public class JsonDiagram extends TitledDiagram { private final JsonValue root; private final List highlighted; - public JsonDiagram(UmlSource source, UmlDiagramType type, JsonValue json, List highlighted) { - super(source, type); + public JsonDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, JsonValue json, + List highlighted) { + super(style, source, type); if (json != null && (json.isString() || json.isBoolean() || json.isNumber())) { this.root = new JsonArray(); ((JsonArray) this.root).add(json); diff --git a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java index daca00169..5b8321867 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java +++ b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagramFactory.java @@ -42,6 +42,7 @@ import java.util.List; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; @@ -57,7 +58,7 @@ public class JsonDiagramFactory extends PSystemAbstractFactory { } @Override - public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { + public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { final List highlighted = new ArrayList<>(); StyleExtractor styleExtractor = null; JsonValue json; @@ -68,9 +69,9 @@ public class JsonDiagramFactory extends PSystemAbstractFactory { it.next(); while (true) { final String line = it.next(); - if (it.hasNext() == false) { + if (it.hasNext() == false) break; - } + if (line.startsWith("#")) { if (line.startsWith("#highlight ")) { highlighted.add(line.substring("#highlight ".length()).trim()); @@ -85,10 +86,10 @@ public class JsonDiagramFactory extends PSystemAbstractFactory { } catch (ParseException e) { json = null; } - final JsonDiagram result = new JsonDiagram(source, UmlDiagramType.JSON, json, highlighted); - if (styleExtractor != null) { + final JsonDiagram result = new JsonDiagram(style, source, UmlDiagramType.JSON, json, highlighted); + if (styleExtractor != null) styleExtractor.applyStyles(result.getSkinParam()); - } + return result; } diff --git a/src/net/sourceforge/plantuml/logo/PSystemLogoFactory.java b/src/net/sourceforge/plantuml/logo/PSystemLogoFactory.java index 657168f11..38a0b1d64 100644 --- a/src/net/sourceforge/plantuml/logo/PSystemLogoFactory.java +++ b/src/net/sourceforge/plantuml/logo/PSystemLogoFactory.java @@ -35,19 +35,19 @@ */ package net.sourceforge.plantuml.logo; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.UmlSource; - public class PSystemLogoFactory extends PSystemBasicFactory { @Override - public PSystemLogo initDiagram(UmlSource source, String startLine) { + public PSystemLogo initDiagram(ThemeStyle style, UmlSource source, String startLine) { return null; } @Override - public PSystemLogo executeLine(UmlSource source, PSystemLogo system, String line) { + public PSystemLogo executeLine(ThemeStyle style, UmlSource source, PSystemLogo system, String line) { if (system == null && line.equalsIgnoreCase("logo")) { return new PSystemLogo(source); } diff --git a/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java b/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java index 8df613597..0165c406f 100644 --- a/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java +++ b/src/net/sourceforge/plantuml/math/PSystemLatexFactory.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.math; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -46,16 +47,15 @@ public class PSystemLatexFactory extends PSystemBasicFactory { } @Override - public PSystemLatex initDiagram(UmlSource source, String startLine) { - if (getDiagramType() == DiagramType.LATEX) { + public PSystemLatex initDiagram(ThemeStyle style, UmlSource source, String startLine) { + if (getDiagramType() == DiagramType.LATEX) return new PSystemLatex(source); - } return null; } @Override - public PSystemLatex executeLine(UmlSource source, PSystemLatex system, String line) { + public PSystemLatex executeLine(ThemeStyle style, UmlSource source, PSystemLatex system, String line) { system.doCommandLine(line); return system; } diff --git a/src/net/sourceforge/plantuml/math/PSystemMathFactory.java b/src/net/sourceforge/plantuml/math/PSystemMathFactory.java index 7d266bfe0..b3525ba86 100644 --- a/src/net/sourceforge/plantuml/math/PSystemMathFactory.java +++ b/src/net/sourceforge/plantuml/math/PSystemMathFactory.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.math; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -46,16 +47,15 @@ public class PSystemMathFactory extends PSystemBasicFactory { } @Override - public PSystemMath initDiagram(UmlSource source, String startLine) { - if (getDiagramType() == DiagramType.MATH) { + public PSystemMath initDiagram(ThemeStyle style, UmlSource source, String startLine) { + if (getDiagramType() == DiagramType.MATH) return new PSystemMath(source); - } return null; } @Override - public PSystemMath executeLine(UmlSource source, PSystemMath system, String line) { + public PSystemMath executeLine(ThemeStyle style, UmlSource source, PSystemMath system, String line) { system.doCommandLine(line); return system; } diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java index abf41f2ba..c5f439d87 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -74,8 +75,8 @@ public class MindMapDiagram extends UmlDiagram { return new DiagramDescription("MindMap"); } - public MindMapDiagram(UmlSource source) { - super(source, UmlDiagramType.MINDMAP); + public MindMapDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.MINDMAP); this.mindmaps.add(new MindMap(getSkinParam())); } diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java index 6994ea1df..89576bc97 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; @@ -67,8 +68,8 @@ public class MindMapDiagramFactory extends PSystemCommandFactory { } @Override - public MindMapDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new MindMapDiagram(source); + public MindMapDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new MindMapDiagram(style, source); } } diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java index f6ac17a2c..b51e15c7f 100644 --- a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java +++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java @@ -50,6 +50,7 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -96,8 +97,8 @@ public class NwDiagram extends UmlDiagram { return new DiagramDescription("(Nwdiag)"); } - public NwDiagram(UmlSource source) { - super(source, UmlDiagramType.NWDIAG); + public NwDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.NWDIAG); } public void init() { diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java index 33e90078d..5ae1fe36e 100644 --- a/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java +++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagramFactory.java @@ -39,10 +39,11 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -53,8 +54,8 @@ public class NwDiagramFactory extends PSystemCommandFactory { } @Override - public NwDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new NwDiagram(source); + public NwDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new NwDiagram(style, source); } @Override diff --git a/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java b/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java index 21d1fae2f..c04ebb2c2 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java +++ b/src/net/sourceforge/plantuml/objectdiagram/AbstractClassOrObjectDiagram.java @@ -40,6 +40,7 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.UmlSource; @@ -59,8 +60,8 @@ import net.sourceforge.plantuml.utils.UniqueSequence; public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram { - public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { - super(source, type, orig); + public AbstractClassOrObjectDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) { + super(style, source, type, orig); } @Override diff --git a/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java b/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java index 801ea3630..05ad8968e 100644 --- a/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java +++ b/src/net/sourceforge/plantuml/oregon/PSystemOregonFactory.java @@ -35,25 +35,25 @@ */ package net.sourceforge.plantuml.oregon; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.UmlSource; public class PSystemOregonFactory extends PSystemBasicFactory { @Override - public PSystemOregon initDiagram(UmlSource source, String startLine) { + public PSystemOregon initDiagram(ThemeStyle style, UmlSource source, String startLine) { return null; } - @Override - public PSystemOregon executeLine(UmlSource source, PSystemOregon system, String line) { - if (system == null && line.equalsIgnoreCase("run oregon trail")) { + public PSystemOregon executeLine(ThemeStyle style, UmlSource source, PSystemOregon system, String line) { + if (system == null && line.equalsIgnoreCase("run oregon trail")) return new PSystemOregon(source); - } - if (system == null) { + + if (system == null) return null; - } + system.add(line); return system; } diff --git a/src/net/sourceforge/plantuml/posimo/DotPath.java b/src/net/sourceforge/plantuml/posimo/DotPath.java index d710d2007..38386396c 100644 --- a/src/net/sourceforge/plantuml/posimo/DotPath.java +++ b/src/net/sourceforge/plantuml/posimo/DotPath.java @@ -50,6 +50,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import net.sourceforge.plantuml.EnsureVisible; @@ -96,38 +97,21 @@ public class DotPath implements UShape, Moveable { private String comment; private String codeLine; + public DotPath copy() { + final DotPath result = new DotPath(); + for (CubicCurve2D.Double c : this.beziers) + result.beziers.add(new CubicCurve2D.Double(c.x1, c.y1, c.ctrlx1, c.ctrly1, c.ctrlx2, c.ctrly2, c.x2, c.y2)); + + return result; + } + + private static DotPath fromBeziers(List beziers) { + final DotPath result = new DotPath(); + result.beziers.addAll(Objects.requireNonNull(beziers)); + return result; + } + public DotPath() { - this(new ArrayList<>()); - } - - public DotPath(DotPath other) { - this(new ArrayList<>()); - for (CubicCurve2D.Double c : other.beziers) { - this.beziers.add(new CubicCurve2D.Double(c.x1, c.y1, c.ctrlx1, c.ctrly1, c.ctrlx2, c.ctrly2, c.x2, c.y2)); - } - } - - private DotPath(List beziers) { - this.beziers.addAll(beziers); - } - - public DotPath addCurve(Point2D pt1, Point2D pt2, Point2D pt3, Point2D pt4) { - final List beziersNew = new ArrayList<>(beziers); - beziersNew.add(new CubicCurve2D.Double(pt1.getX(), pt1.getY(), pt2.getX(), pt2.getY(), pt3.getX(), pt3.getY(), - pt4.getX(), pt4.getY())); - return new DotPath(beziersNew); - } - - public DotPath addCurve(Point2D pt2, Point2D pt3, Point2D pt4) { - final CubicCurve2D.Double last = beziers.get(beziers.size() - 1); - final Point2D p1 = last.getP2(); - return addCurve(p1, pt2, pt3, pt4); - } - - private Point2D mirror(Point2D center, Point2D pt) { - final double x = 2 * center.getX() - pt.getX(); - final double y = 2 * center.getY() - pt.getY(); - return new Point2D.Double(x, y); } public DotPath(SvgResult fullSvg) { @@ -135,9 +119,9 @@ public class DotPath implements UShape, Moveable { throw new IllegalArgumentException(); } final int posC = fullSvg.indexOf("C", 0); - if (posC == -1) { + if (posC == -1) throw new IllegalArgumentException(); - } + final Point2D start = fullSvg.substring(1, posC).getNextPoint(); final List triPoints = new ArrayList<>(); @@ -158,10 +142,29 @@ public class DotPath implements UShape, Moveable { // this.print = triPoints.toString(); } + public DotPath addCurve(Point2D pt1, Point2D pt2, Point2D pt3, Point2D pt4) { + final List beziersNew = new ArrayList<>(beziers); + beziersNew.add(new CubicCurve2D.Double(pt1.getX(), pt1.getY(), pt2.getX(), pt2.getY(), pt3.getX(), pt3.getY(), + pt4.getX(), pt4.getY())); + return fromBeziers(beziersNew); + } + + public DotPath addCurve(Point2D pt2, Point2D pt3, Point2D pt4) { + final CubicCurve2D.Double last = beziers.get(beziers.size() - 1); + final Point2D p1 = last.getP2(); + return addCurve(p1, pt2, pt3, pt4); + } + + private Point2D mirror(Point2D center, Point2D pt) { + final double x = 2 * center.getX() - pt.getX(); + final double y = 2 * center.getY() - pt.getY(); + return new Point2D.Double(x, y); + } + public static boolean isPathConsistent(String init) { - if (init.startsWith("M") == false) { + if (init.startsWith("M") == false) return false; - } + return true; } @@ -173,9 +176,9 @@ public class DotPath implements UShape, Moveable { public Set sample() { final Set result = new HashSet<>(); - for (CubicCurve2D.Double bez : beziers) { + for (CubicCurve2D.Double bez : beziers) sample(bez, result); - } + return Collections.unmodifiableSet(result); } @@ -339,25 +342,25 @@ public class DotPath implements UShape, Moveable { public DotPath addBefore(CubicCurve2D.Double before) { final List copy = new ArrayList<>(beziers); copy.add(0, before); - return new DotPath(copy); + return fromBeziers(copy); } private DotPath addBefore(DotPath other) { final List copy = new ArrayList<>(beziers); copy.addAll(0, other.beziers); - return new DotPath(copy); + return fromBeziers(copy); } public DotPath addAfter(CubicCurve2D.Double after) { final List copy = new ArrayList<>(beziers); copy.add(after); - return new DotPath(copy); + return fromBeziers(copy); } public DotPath addAfter(DotPath other) { final List copy = new ArrayList<>(beziers); copy.addAll(other.beziers); - return new DotPath(copy); + return fromBeziers(copy); } public Map somePoints() { @@ -446,19 +449,19 @@ public class DotPath implements UShape, Moveable { final List all = new ArrayList<>(beziers); for (int i = 0; i < 8; i++) { for (CubicCurve2D.Double immutable : all) { - if (contains(immutable, notIn)) { + if (contains(immutable, notIn)) continue; - } + final CubicCurve2D.Double bez = new CubicCurve2D.Double(); bez.setCurve(immutable); if (BezierUtils.isCutting(bez, shape)) { - while (BezierUtils.dist(bez) > 1.0) { + while (BezierUtils.dist(bez) > 1.0) BezierUtils.shorten(bez, shape); - } + final Point2D.Double result = new Point2D.Double((bez.x1 + bez.x2) / 2, (bez.y1 + bez.y2) / 2); - if (contains(result, notIn) == false) { + if (contains(result, notIn) == false) return result; - } + } } cutAllCubic(all); @@ -479,42 +482,40 @@ public class DotPath implements UShape, Moveable { } static private boolean contains(Point2D.Double point, Rectangle2D... rects) { - for (Rectangle2D r : rects) { - if (r.contains(point)) { + for (Rectangle2D r : rects) + if (r.contains(point)) return true; - } - } + return false; } static private boolean contains(CubicCurve2D.Double cubic, Rectangle2D... rects) { - for (Rectangle2D r : rects) { - if (r.contains(cubic.getP1()) && r.contains(cubic.getP2())) { + for (Rectangle2D r : rects) + if (r.contains(cubic.getP1()) && r.contains(cubic.getP2())) return true; - } - } + return false; } private DotPath manageRect(Rectangle2D start, Rectangle2D end) { final List list = new ArrayList<>(this.beziers); while (true) { - if (BezierUtils.isCutting(list.get(0), start) == false) { + if (BezierUtils.isCutting(list.get(0), start) == false) throw new IllegalStateException(); - } - if (BezierUtils.dist(list.get(0)) <= 1.0) { + + if (BezierUtils.dist(list.get(0)) <= 1.0) break; - } + final CubicCurve2D.Double left = new CubicCurve2D.Double(); final CubicCurve2D.Double right = new CubicCurve2D.Double(); list.get(0).subdivide(left, right); list.set(0, left); list.add(1, right); - if (BezierUtils.isCutting(list.get(1), start)) { + if (BezierUtils.isCutting(list.get(1), start)) list.remove(0); - } + } - return new DotPath(list); + return fromBeziers(list); } private Point2D getFrontierIntersection(Positionable p) { @@ -522,17 +523,14 @@ public class DotPath implements UShape, Moveable { } public void draw(BasicCharArea area, double pixelXPerChar, double pixelYPerChar) { - for (CubicCurve2D.Double bez : beziers) { - if (bez.x1 == bez.x2) { + for (CubicCurve2D.Double bez : beziers) + if (bez.x1 == bez.x2) area.drawVLine('|', (int) (bez.x1 / pixelXPerChar), (int) (bez.y1 / pixelYPerChar), (int) (bez.y2 / pixelYPerChar)); - } else if (bez.y1 == bez.y2) { + else if (bez.y1 == bez.y2) area.drawHLine('-', (int) (bez.y1 / pixelYPerChar), (int) (bez.x1 / pixelXPerChar), (int) (bez.x2 / pixelXPerChar)); - } /* - * else { throw new UnsupportedOperationException("bez=" + toString(bez)); } - */ - } + } static String toString(CubicCurve2D.Double c) { @@ -560,10 +558,10 @@ public class DotPath implements UShape, Moveable { final List reverse = new ArrayList<>(beziers); Collections.reverse(reverse); final List copy = new ArrayList<>(); - for (CubicCurve2D.Double cub : reverse) { + for (CubicCurve2D.Double cub : reverse) copy.add(reverse(cub)); - } - return new DotPath(copy); + + return fromBeziers(copy); } diff --git a/src/net/sourceforge/plantuml/project/GanttDiagram.java b/src/net/sourceforge/plantuml/project/GanttDiagram.java index 16a38627a..826125a3d 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagram.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagram.java @@ -56,6 +56,7 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.WithSprite; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -158,8 +159,8 @@ public class GanttDiagram extends TitledDiagram implements ToTaskDraw, WithSprit this.weekNumberStrategy = new WeekNumberStrategy(firstDayOfWeek, minimalDaysInFirstWeek); } - public GanttDiagram(UmlSource source) { - super(source, UmlDiagramType.GANTT); + public GanttDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.GANTT); } public final int getDpi(FileFormatOption fileFormatOption) { diff --git a/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java b/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java index 7d7fca597..68f238d7e 100644 --- a/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java +++ b/src/net/sourceforge/plantuml/project/GanttDiagramFactory.java @@ -41,10 +41,11 @@ import java.util.Collection; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandNope; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.project.command.CommandColorTask; @@ -166,8 +167,8 @@ public class GanttDiagramFactory extends PSystemCommandFactory { } @Override - public GanttDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new GanttDiagram(source); + public GanttDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new GanttDiagram(style, source); } } diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java index 69d47076b..2b252cb4e 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Objects; import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java index 77ddd1961..e1d6f2df8 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderCalendar.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Locale; import java.util.Map; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.time.Day; import net.sourceforge.plantuml.project.time.DayOfWeek; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java index 41fd42b6d..54a8260d4 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderDaily.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Locale; import java.util.Map; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.time.Day; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java index ffc111c9d..128b6989d 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderMonthly.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Locale; import java.util.Map; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.time.Day; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java index f44082550..724815737 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderQuarterly.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Locale; import java.util.Map; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.time.Day; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java index 43aab42a2..fb7ad0faa 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderSimple.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Map; import net.sourceforge.plantuml.SpriteContainerEmpty; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java index 253f3a966..66aff0f91 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderWeekly.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Locale; import java.util.Map; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.time.Day; diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java b/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java index 294e6736f..725a5f21d 100644 --- a/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java +++ b/src/net/sourceforge/plantuml/project/draw/TimeHeaderYearly.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.project.draw; import java.util.Locale; import java.util.Map; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.project.LoadPlanable; import net.sourceforge.plantuml.project.time.Day; diff --git a/src/net/sourceforge/plantuml/salt/Dictionary.java b/src/net/sourceforge/plantuml/salt/Dictionary.java index cb999cd28..6cd5b2488 100644 --- a/src/net/sourceforge/plantuml/salt/Dictionary.java +++ b/src/net/sourceforge/plantuml/salt/Dictionary.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.SpriteContainer; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.salt.element.Element; import net.sourceforge.plantuml.salt.element.WrappedElement; @@ -129,7 +129,7 @@ public class Dictionary implements SpriteContainer, ISkinSimple { } public ThemeStyle getThemeStyle() { - return ThemeStyle.LIGHT; + return ThemeStyle.LIGHT_REGULAR; } } diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java index 63d5e6d01..79dcdb4c1 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java @@ -53,6 +53,7 @@ import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.WithSprite; import net.sourceforge.plantuml.api.ImageDataSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -97,13 +98,13 @@ public class PSystemSalt extends TitledDiagram implements WithSprite { private final Dictionary dictionary = new Dictionary(); @Deprecated - public PSystemSalt(UmlSource source, List data) { - super(source, UmlDiagramType.SALT); + public PSystemSalt(ThemeStyle style, UmlSource source, List data) { + super(style, source, UmlDiagramType.SALT); this.data = data; } - public PSystemSalt(UmlSource source) { - this(source, new ArrayList()); + public PSystemSalt(ThemeStyle style, UmlSource source) { + this(style, source, new ArrayList()); } public void add(String s) { @@ -117,9 +118,7 @@ public class PSystemSalt extends TitledDiagram implements WithSprite { final Element salt = createElement(manageSprite()); final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam()); final Dimension2D size = salt.getPreferredDimension(stringBounder, 0, 0); - return createImageBuilder(fileFormatOption) - .drawable(getTextBlock(salt, size)) - .write(os); + return createImageBuilder(fileFormatOption).drawable(getTextBlock(salt, size)).write(os); } catch (Exception e) { e.printStackTrace(); UmlDiagram.exportDiagramError(os, e, fileFormatOption, seed(), getMetadata(), "none", @@ -132,7 +131,7 @@ public class PSystemSalt extends TitledDiagram implements WithSprite { return new TextBlockBackcolored() { public void drawU(UGraphic ug) { - ug = ug.apply(HColorUtils.BLACK); + ug = ug.apply(getBlack()); salt.drawU(ug, 0, new Dimension2DDouble(size.getWidth(), size.getHeight())); salt.drawU(ug, 1, new Dimension2DDouble(size.getWidth(), size.getHeight())); } @@ -259,4 +258,8 @@ public class PSystemSalt extends TitledDiagram implements WithSprite { public ClockwiseTopRightBottomLeft getDefaultMargins() { return ClockwiseTopRightBottomLeft.same(5); } + + private HColor getBlack() { + return HColorUtils.BLACK; + } } diff --git a/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java b/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java index 557e13f0b..df4d5d614 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSaltFactory.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.salt; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -47,11 +48,11 @@ public class PSystemSaltFactory extends PSystemBasicFactory { } @Override - public PSystemSalt initDiagram(UmlSource source, String startLine) { + public PSystemSalt initDiagram(ThemeStyle style, UmlSource source, String startLine) { if (getDiagramType() == DiagramType.UML) { return null; } else if (getDiagramType() == DiagramType.SALT) { - return new PSystemSalt(source); + return new PSystemSalt(style, source); } else { throw new IllegalStateException(getDiagramType().name()); } @@ -59,9 +60,9 @@ public class PSystemSaltFactory extends PSystemBasicFactory { } @Override - public PSystemSalt executeLine(UmlSource source, PSystemSalt system, String line) { + public PSystemSalt executeLine(ThemeStyle style, UmlSource source, PSystemSalt system, String line) { if (system == null && line.replace('\t', ' ').trim().equals("salt")) { - return new PSystemSalt(source); + return new PSystemSalt(style, source); } if (system == null) { return null; diff --git a/src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java b/src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java index f82f48cfb..5fa6a4bf4 100644 --- a/src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java +++ b/src/net/sourceforge/plantuml/salt/PSystemSaltFactory2.java @@ -39,9 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -66,8 +67,8 @@ public class PSystemSaltFactory2 extends PSystemCommandFactory { } @Override - public PSystemSalt createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - final PSystemSalt result = new PSystemSalt(source); + public PSystemSalt createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + final PSystemSalt result = new PSystemSalt(style, source); if (getDiagramType() == DiagramType.SALT) { result.setIamSalt(true); } diff --git a/src/net/sourceforge/plantuml/salt/element/AbstractElement.java b/src/net/sourceforge/plantuml/salt/element/AbstractElement.java index 483f1dc4e..da4efdbea 100644 --- a/src/net/sourceforge/plantuml/salt/element/AbstractElement.java +++ b/src/net/sourceforge/plantuml/salt/element/AbstractElement.java @@ -35,12 +35,51 @@ */ package net.sourceforge.plantuml.salt.element; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.graphic.FontConfiguration; +import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public abstract class AbstractElement implements Element { - final protected ThemeStyle getThemeStyle() { - return ThemeStyle.LIGHT; + final protected HColor getBlack() { + return HColorUtils.BLACK.withDark(HColorUtils.WHITE); + } + + final protected HColor getColor88() { + return buildColor("#8", "#8"); + } + + final protected HColor getColorAA() { + return buildColor("#A", "#6"); + } + + final protected HColor getColorBB() { + return buildColor("#B", "#5"); + } + + final protected HColor getColorDD() { + return buildColor("#D", "#3"); + } + + final protected HColor getColorEE() { + return buildColor("#E", "#2"); + } + + final protected HColor getWhite() { + return HColorUtils.WHITE.withDark(HColorUtils.BLACK); + } + + private HColor buildColor(String color1, String color2) { + final HColorSimple tmp1 = (HColorSimple) HColorSet.instance().getColorOrWhite(null, color1); + final HColor tmp2 = HColorSet.instance().getColorOrWhite(null, color2); + return tmp1.withDark(tmp2); + } + + final protected FontConfiguration blackBlueTrue(UFont font) { + return FontConfiguration.blackBlueTrue(font); } } diff --git a/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java b/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java index 43b0131c7..192132403 100644 --- a/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java +++ b/src/net/sourceforge/plantuml/salt/element/AbstractElementText.java @@ -57,7 +57,7 @@ abstract class AbstractElementText extends AbstractElement { private final int charLength; public AbstractElementText(String text, UFont font, boolean manageLength, ISkinSimple spriteContainer) { - config = FontConfiguration.blackBlueTrue(font); + config = blackBlueTrue(font); if (manageLength) { this.charLength = getCharNumber(text); text = StringUtils.trin(text); diff --git a/src/net/sourceforge/plantuml/salt/element/ElementButton.java b/src/net/sourceforge/plantuml/salt/element/ElementButton.java index f1a08d814..11b4003a0 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementButton.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementButton.java @@ -45,7 +45,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementButton extends AbstractElementText implements Element { @@ -64,14 +63,14 @@ public class ElementButton extends AbstractElementText implements Element { } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { - if (zIndex != 0) { + if (zIndex != 0) return; - } + final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); ug = ug.apply(new UStroke(stroke)); - ug = ug.apply(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#EEEEEE").bg()); - ug.apply(new UTranslate(stroke, stroke)).draw( - new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke).rounded(10)); + ug = ug.apply(getColorEE().bg()).apply(getBlack()); + ug.apply(new UTranslate(stroke, stroke)) + .draw(new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke).rounded(10)); final Dimension2D dimPureText = getPureTextDimension(ug.getStringBounder()); drawText(ug, (dim.getWidth() - dimPureText.getWidth()) / 2, stroke + marginY); } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java index 2a92fbc37..7254f4c61 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java @@ -52,7 +52,6 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ElementDroplist extends AbstractElementText implements Element { @@ -92,8 +91,10 @@ public class ElementDroplist extends AbstractElementText implements Element { public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); + ug = ug.apply(getBlack()); + if (zIndex == 0) { - ug.apply(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#EEEEEE").bg()) + ug.apply(getColorEE().bg()) .draw(new URectangle(dim.getWidth() - 1, dim.getHeight() - 1)); drawText(ug, 2, 2); final double xline = dim.getWidth() - box; @@ -112,7 +113,7 @@ public class ElementDroplist extends AbstractElementText implements Element { final Dimension2D dimOpen = Dimension2DDouble.atLeast(openDrop.calculateDimension(ug.getStringBounder()), dim.getWidth() - 1, 0); ug = ug.apply(UTranslate.dy(dim.getHeight() - 1)); - ug.apply(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#EEEEEE").bg()) + ug.apply(getColorEE().bg()) .draw(new URectangle(dimOpen.getWidth() - 1, dimOpen.getHeight() - 1)); openDrop.drawU(ug); } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementImage.java b/src/net/sourceforge/plantuml/salt/element/ElementImage.java index 4818fb8f3..07496dbbf 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementImage.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementImage.java @@ -57,18 +57,19 @@ public class ElementImage extends AbstractElement { } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { - if (zIndex != 0) { + if (zIndex != 0) return; - } + + ug = ug.apply(getBlack()); + final int w = img.get(0).length(); final int h = img.size(); - for (int i = 0; i < w; i++) { + for (int i = 0; i < w; i++) for (int j = 0; j < h; j++) { final char c = img.get(j).charAt(i); - if (c == 'X') { + if (c == 'X') ug.apply(new UTranslate(i, j)).draw(new UPixel()); - } } - } + } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementLine.java b/src/net/sourceforge/plantuml/salt/element/ElementLine.java index f44dd80dd..8b027b4d6 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementLine.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementLine.java @@ -43,7 +43,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementLine extends AbstractElement { @@ -61,7 +60,7 @@ public class ElementLine extends AbstractElement { if (zIndex != 0) { return; } - ug = ug.apply(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#AAAAAA")); + ug = ug.apply(getColorAA()); double y2 = dimToUse.getHeight() / 2; if (separator == '=') { y2 = y2 - 1; diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java index 514c998d4..41d1172d3 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java @@ -48,7 +48,6 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementMenuBar extends AbstractElement { @@ -103,10 +102,11 @@ public class ElementMenuBar extends AbstractElement { public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { final Dimension2D preferred = getPreferredDimension(ug.getStringBounder(), 0, 0); + ug = ug.apply(getBlack()); + double x1 = 0; if (zIndex == 0) { - ug.apply(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#DDDDDD").bg()).draw( - new URectangle(dimToUse.getWidth(), dimToUse.getHeight())); + ug.apply(getColorDD().bg()).draw(new URectangle(dimToUse.getWidth(), dimToUse.getHeight())); for (ElementMenuEntry entry : entries) { entry.drawU(ug.apply(UTranslate.dx(x1)), zIndex, dimToUse); final double w = entry.getPreferredDimension(ug.getStringBounder(), x1, 0).getWidth(); @@ -117,9 +117,8 @@ public class ElementMenuBar extends AbstractElement { } if (zIndex == 1) { - for (ElementMenuEntry entry : popups.keySet()) { - entry.setBackground(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#BBBBBB")); - } + for (ElementMenuEntry entry : popups.keySet()) + entry.setBackground(getColorBB()); final double y1 = preferred.getHeight(); for (Map.Entry ent : popups.entrySet()) { diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java index a3fcc4572..df983f087 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuEntry.java @@ -70,6 +70,7 @@ public class ElementMenuEntry extends AbstractElement { } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { + ug = ug.apply(getBlack()); if (background != null) { final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); ug.apply(background.bg()).draw(new URectangle(dim.getWidth(), dim.getHeight())); diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java index e6e0f6719..f720cb994 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementMenuPopup extends AbstractElement { @@ -76,20 +75,21 @@ public class ElementMenuPopup extends AbstractElement { } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { - if (zIndex != 1) { + if (zIndex != 1) return; - } - ug.apply(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#DDDDDD").bg()).draw( - new URectangle(dimToUse.getWidth(), dimToUse.getHeight())); + + ug = ug.apply(getBlack()); + + ug.apply(getColorDD().bg()).draw(new URectangle(dimToUse.getWidth(), dimToUse.getHeight())); double y1 = 0; for (ElementMenuEntry entry : entries) { final double h = entry.getPreferredDimension(ug.getStringBounder(), 0, y1).getHeight(); - if (entry.getText().equals("-")) { + if (entry.getText().equals("-")) ug.apply(UTranslate.dy(y1 + h / 2)).draw(ULine.hline(dimToUse.getWidth())); - } else { + else entry.drawU(ug.apply(UTranslate.dy(y1)), zIndex, dimToUse); - } + y1 += h; } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java b/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java index cc27eaae7..c42faea17 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementPyramid.java @@ -95,11 +95,13 @@ public class ElementPyramid extends AbstractElement { public Dimension2D getPreferredDimension(StringBounder stringBounder, double x, double y) { init(stringBounder); - return new Dimension2DDouble(colsStart[colsStart.length - 1], rowsStart[rowsStart.length - 1] - + title.calculateDimension(stringBounder).getHeight()); + return new Dimension2DDouble(colsStart[colsStart.length - 1], + rowsStart[rowsStart.length - 1] + title.calculateDimension(stringBounder).getHeight()); } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { + ug = ug.apply(getBlack()); + init(ug.getStringBounder()); final double titleHeight = title.calculateDimension(ug.getStringBounder()).getHeight(); final Grid grid = new Grid(rowsStart, colsStart, tableStrategy, title); @@ -114,21 +116,21 @@ public class ElementPyramid extends AbstractElement { grid.addCell(cell); elt.drawU(ug.apply(new UTranslate(xcell + 1, ycell + 1)), zIndex, new Dimension2DDouble(width, height)); } - if (zIndex == 0) { - grid.drawU(ug, 0, 0); - } + if (zIndex == 0) + grid.drawU(ug, 0, 0, getWhite()); + } private void init(StringBounder stringBounder) { - if (rowsStart != null) { + if (rowsStart != null) return; - } + final double titleHeight = title.calculateDimension(stringBounder).getHeight(); rowsStart = new double[rows + 1]; rowsStart[0] = titleHeight / 2; - for (int i = 1; i < rows + 1; i++) { + for (int i = 1; i < rows + 1; i++) rowsStart[i] = titleHeight / 2; - } + colsStart = new double[cols + 1]; final List all = new ArrayList<>(positions1.values()); Collections.sort(all, new LeftFirst()); @@ -149,21 +151,19 @@ public class ElementPyramid extends AbstractElement { private void ensureColWidth(int first, int last, double width) { final double actual = colsStart[last] - colsStart[first]; final double missing = width - actual; - if (missing > 0) { - for (int i = last; i < colsStart.length; i++) { + if (missing > 0) + for (int i = last; i < colsStart.length; i++) colsStart[i] += missing; - } - } + } private void ensureRowHeight(int first, int last, double height) { final double actual = rowsStart[last] - rowsStart[first]; final double missing = height - actual; - if (missing > 0) { - for (int i = last; i < rowsStart.length; i++) { + if (missing > 0) + for (int i = last; i < rowsStart.length; i++) rowsStart[i] += missing; - } - } + } public final int getNbRows() { diff --git a/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java b/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java index 793119899..2bb747035 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementPyramidScrolled.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ElementPyramidScrolled extends ElementPyramid { @@ -55,7 +54,8 @@ public class ElementPyramidScrolled extends ElementPyramid { private final double v2 = 12; private final ScrollStrategy scrollStrategy; - public ElementPyramidScrolled(Positionner2 positionner, ISkinSimple spriteContainer, ScrollStrategy scrollStrategy) { + public ElementPyramidScrolled(Positionner2 positionner, ISkinSimple spriteContainer, + ScrollStrategy scrollStrategy) { super(positionner, TableStrategy.DRAW_OUTSIDE, null, spriteContainer); this.scrollStrategy = scrollStrategy; } @@ -63,25 +63,26 @@ public class ElementPyramidScrolled extends ElementPyramid { @Override public Dimension2D getPreferredDimension(StringBounder stringBounder, double x, double y) { final Dimension2D result = super.getPreferredDimension(stringBounder, x, y); - if (scrollStrategy == ScrollStrategy.HORIZONTAL_ONLY) { + if (scrollStrategy == ScrollStrategy.HORIZONTAL_ONLY) return Dimension2DDouble.delta(result, 0, 30); - } - if (scrollStrategy == ScrollStrategy.VERTICAL_ONLY) { + + if (scrollStrategy == ScrollStrategy.VERTICAL_ONLY) return Dimension2DDouble.delta(result, 30, 0); - } + return Dimension2DDouble.delta(result, 30); } @Override public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { super.drawU(ug, zIndex, dimToUse); + ug = ug.apply(getBlack()); final Dimension2D dim = super.getPreferredDimension(ug.getStringBounder(), 0, 0); - if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.VERTICAL_ONLY) { + if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.VERTICAL_ONLY) drawV(ug.apply(UTranslate.dx(dim.getWidth() + 4)), v1, dim.getHeight()); - } - if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.HORIZONTAL_ONLY) { + + if (scrollStrategy == ScrollStrategy.BOTH || scrollStrategy == ScrollStrategy.HORIZONTAL_ONLY) drawH(ug.apply(UTranslate.dy(dim.getHeight() + 4)), dim.getWidth(), v1); - } + } private UPath getTr0() { @@ -128,16 +129,16 @@ public class ElementPyramidScrolled extends ElementPyramid { ug.draw(new URectangle(width, height)); ug.apply(UTranslate.dy(v2)).draw(ULine.hline(width)); ug.apply(UTranslate.dy(height - v2)).draw(ULine.hline(width)); - ug.apply(new UTranslate(4, 4)).apply(HColorUtils.BLACK.bg()).draw(getTr0()); - ug.apply(new UTranslate(4, height - v2 + 4)).apply(HColorUtils.BLACK.bg()).draw(getTr180()); + ug.apply(new UTranslate(4, 4)).apply(getBlack().bg()).draw(getTr0()); + ug.apply(new UTranslate(4, height - v2 + 4)).apply(getBlack().bg()).draw(getTr180()); } private void drawH(UGraphic ug, double width, double height) { ug.draw(new URectangle(width, height)); ug.apply(UTranslate.dx(v2)).draw(ULine.vline(height)); ug.apply(UTranslate.dx(width - v2)).draw(ULine.vline(height)); - ug.apply(new UTranslate(4, 4)).apply(HColorUtils.BLACK.bg()).draw(getTr90()); - ug.apply(new UTranslate(width - v2 + 4, 4)).apply(HColorUtils.BLACK.bg()).draw(getTr270()); + ug.apply(new UTranslate(4, 4)).apply(getBlack().bg()).draw(getTr90()); + ug.apply(new UTranslate(width - v2 + 4, 4)).apply(getBlack().bg()).draw(getTr270()); } } diff --git a/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java b/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java index 915b10d38..53718b8f9 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementRadioCheckbox.java @@ -79,9 +79,10 @@ public class ElementRadioCheckbox extends AbstractElement { } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { - if (zIndex != 0) { + if (zIndex != 0) return; - } + + ug = ug.apply(getBlack()); block.drawU(ug.apply(UTranslate.dx(margin))); final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0); diff --git a/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java b/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java index 84ad2c896..7c6f0e927 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementTabBar.java @@ -71,9 +71,9 @@ public class ElementTabBar extends AbstractElement { } public Dimension2D getPreferredDimension(StringBounder stringBounder, double x, double y) { - if (vertical) { + if (vertical) return getPreferredDimensionVertical(stringBounder, x, y); - } + return getPreferredDimensionHorizontal(stringBounder, x, y); } @@ -90,14 +90,15 @@ public class ElementTabBar extends AbstractElement { } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { - if (zIndex != 0) { + if (zIndex != 0) return; - } - if (vertical) { + ug = ug.apply(getBlack()); + + if (vertical) drawUVertical(ug, 0, 0, zIndex, dimToUse); - } else { + else drawUHorizontal(ug, 0, 0, zIndex, dimToUse); - } + } private void drawUHorizontal(UGraphic ug, final double x, final double y, int zIndex, Dimension2D dimToUse) { diff --git a/src/net/sourceforge/plantuml/salt/element/ElementTree.java b/src/net/sourceforge/plantuml/salt/element/ElementTree.java index 69ab03892..29207ece9 100644 --- a/src/net/sourceforge/plantuml/salt/element/ElementTree.java +++ b/src/net/sourceforge/plantuml/salt/element/ElementTree.java @@ -47,7 +47,6 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; public class ElementTree extends AbstractElement { @@ -115,9 +114,10 @@ public class ElementTree extends AbstractElement { } public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) { - if (zIndex != 0) { + if (zIndex != 0) return; - } + + ug = ug.apply(getBlack()); final StringBounder stringBounder = ug.getStringBounder(); final double w1 = getWidth1(stringBounder); @@ -144,7 +144,7 @@ public class ElementTree extends AbstractElement { yvar += h; rows.add(yvar); } - ug = ug.apply(HColorSet.instance().getColorOrWhite(getThemeStyle(), "#888888")); + ug = ug.apply(getColor88()); skeleton.draw(ug, 0, 0); if (strategy != TableStrategy.DRAW_NONE) { final Grid2 grid = new Grid2(rows, cols, strategy); diff --git a/src/net/sourceforge/plantuml/salt/element/Grid.java b/src/net/sourceforge/plantuml/salt/element/Grid.java index b4649f442..bf3ba5d33 100644 --- a/src/net/sourceforge/plantuml/salt/element/Grid.java +++ b/src/net/sourceforge/plantuml/salt/element/Grid.java @@ -45,7 +45,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColorUtils; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class Grid { @@ -82,7 +82,7 @@ public class Grid { } - public void drawU(UGraphic ug, double x, double y) { + public void drawU(UGraphic ug, double x, double y, HColor white) { // Hlines for (Segment seg : horizontals) { final int row1 = seg.getRow(); @@ -102,8 +102,7 @@ public class Grid { if (dim.getWidth() > 0 && dim.getHeight() > 0) { final UGraphic ug2 = ug.apply(new UTranslate(x + 6, y - dim.getHeight() * 0)); - ug2.apply(HColorUtils.WHITE.bg()).apply(HColorUtils.WHITE) - .draw(new URectangle(dim)); + ug2.apply(white.bg()).apply(white).draw(new URectangle(dim)); title.drawU(ug2); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java b/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java index 5559f9f16..b8432782b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java +++ b/src/net/sourceforge/plantuml/sequencediagram/InGroupableList.java @@ -58,11 +58,10 @@ public class InGroupableList implements InGroupable { public List getInnerList() { final List result = new ArrayList<>(); - for (InGroupable i : inGroupables) { - if (i instanceof InGroupableList) { + for (InGroupable i : inGroupables) + if (i instanceof InGroupableList) result.add((InGroupableList) i); - } - } + return result; } @@ -101,23 +100,22 @@ public class InGroupableList implements InGroupable { private InGroupable getMinSlow(StringBounder stringBounder) { InGroupable result = null; for (InGroupable in : inGroupables) { - if (in instanceof GroupingGraphicalElementElse) { + if (in instanceof GroupingGraphicalElementElse) continue; - } - if (result == null || in.getMinX(stringBounder) < result.getMinX(stringBounder)) { + + if (result == null || in.getMinX(stringBounder) < result.getMinX(stringBounder)) result = in; - } + } return result; } private InGroupable getMaxSlow(StringBounder stringBounder) { InGroupable result = null; - for (InGroupable in : inGroupables) { - if (result == null || in.getMaxX(stringBounder) > result.getMaxX(stringBounder)) { + for (InGroupable in : inGroupables) + if (result == null || in.getMaxX(stringBounder) > result.getMaxX(stringBounder)) result = in; - } - } + return result; } @@ -125,19 +123,20 @@ public class InGroupableList implements InGroupable { private InGroupable cacheMax = null; private InGroupable getMin(StringBounder stringBounder) { - if (cacheMin == null) { + if (cacheMin == null) cacheMin = getMinSlow(stringBounder); - } + // Since // MODIF42 // the assert does not work... - // System.err.println("cacheMin1="+cacheMin+" cacheMin2="+getMinSlow(stringBounder)); - assert cacheMin == getMinSlow(stringBounder); + // System.err.println("cacheMin1="+cacheMin+" + // cacheMin2="+getMinSlow(stringBounder)); + // assert cacheMin == getMinSlow(stringBounder); return cacheMin; } private InGroupable getMax(StringBounder stringBounder) { - if (cacheMax == null) { + if (cacheMax == null) cacheMax = getMaxSlow(stringBounder); - } + assert cacheMax == getMaxSlow(stringBounder); return cacheMax; } @@ -148,45 +147,42 @@ public class InGroupableList implements InGroupable { public ParticipantBox getFirstParticipantBox() { ParticipantBox first = null; - for (InGroupable in : inGroupables) { + for (InGroupable in : inGroupables) if (in instanceof LivingParticipantBox) { final ParticipantBox participantBox = ((LivingParticipantBox) in).getParticipantBox(); - if (first == null || participantBox.getStartingX() < first.getStartingX()) { + if (first == null || participantBox.getStartingX() < first.getStartingX()) first = participantBox; - } + } - } + return first; } public ParticipantBox getLastParticipantBox() { ParticipantBox last = null; - for (InGroupable in : inGroupables) { + for (InGroupable in : inGroupables) if (in instanceof LivingParticipantBox) { final ParticipantBox participantBox = ((LivingParticipantBox) in).getParticipantBox(); - if (last == null || participantBox.getStartingX() > last.getStartingX()) { + if (last == null || participantBox.getStartingX() > last.getStartingX()) last = participantBox; - } } - } return last; } public double getMinX(StringBounder stringBounder) { final InGroupable min = getMin(stringBounder); - if (min == null) { + if (min == null) return MARGIN10 + MARGIN5 + (veryfirst == null ? 0 : veryfirst.getStartingX()); - // return MARGIN10 + MARGIN5; - } + double m = min.getMinX(stringBounder); - if (min instanceof MessageExoArrow - && (((MessageExoArrow) min).getType() == MessageExoType.FROM_LEFT || ((MessageExoArrow) min).getType() == MessageExoType.TO_LEFT)) { + if (min instanceof MessageExoArrow && (((MessageExoArrow) min).getType() == MessageExoType.FROM_LEFT + || ((MessageExoArrow) min).getType() == MessageExoType.TO_LEFT)) m += 3; - } else if (min instanceof InGroupableList) { + else if (min instanceof InGroupableList) m -= MARGIN10; - } else { + else m -= MARGIN5; - } + return m; } @@ -194,26 +190,26 @@ public class InGroupableList implements InGroupable { final double min = getMinX(stringBounder); final double max = getMaxXInternal(stringBounder); assert max - min >= 0; - if (max - min < minWidth) { + if (max - min < minWidth) return min + minWidth + hack2; - } + return max + hack2; } private final double getMaxXInternal(StringBounder stringBounder) { final InGroupable max = getMax(stringBounder); - if (max == null) { + if (max == null) return MARGIN10 + MARGIN5 + minWidth; - } + double m = max.getMaxX(stringBounder); - if (max instanceof MessageExoArrow - && (((MessageExoArrow) max).getType() == MessageExoType.FROM_RIGHT || ((MessageExoArrow) max).getType() == MessageExoType.TO_RIGHT)) { + if (max instanceof MessageExoArrow && (((MessageExoArrow) max).getType() == MessageExoType.FROM_RIGHT + || ((MessageExoArrow) max).getType() == MessageExoType.TO_RIGHT)) m -= 3; - } else if (max instanceof InGroupableList) { + else if (max instanceof InGroupableList) m += MARGIN10; - } else { + else m += MARGIN5; - } + return m; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java index b04e59dd2..fa18c2ca6 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java +++ b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.sequencediagram; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.cucadiagram.Display; @@ -47,6 +48,10 @@ import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.sequencediagram.teoz.CommonTile; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.color.HColor; @@ -79,7 +84,7 @@ public class LinkAnchor { return message; } - public void drawAnchor(UGraphic ug, CommonTile tile1, CommonTile tile2, ISkinParam param) { + public void drawAnchor(UGraphic ug, CommonTile tile1, CommonTile tile2, ISkinParam skinParam) { final double y1 = tile1.getY() + tile1.getContactPointRelative(); final double y2 = tile2.getY() + tile2.getContactPointRelative(); @@ -89,12 +94,24 @@ public class LinkAnchor { final double ymin = Math.min(y1, y2); final double ymax = Math.max(y1, y2); - final HColor color = new Rose().getHtmlColor(param, ColorParam.arrow); + final HColor color; + final FontConfiguration fontConfiguration; + if (UseStyle.useBetaStyle()) { + final StyleSignature signature = StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, + SName.arrow); + final Style style = signature.getMergedStyle(skinParam.getCurrentStyleBuilder()); + + color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + fontConfiguration = new FontConfiguration(skinParam, style); + } else { + color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); + fontConfiguration = new FontConfiguration(skinParam, FontParam.ARROW, null); + } + final Rainbow rainbow = Rainbow.fromColor(color, null); final Display display = Display.getWithNewlines(message); - final TextBlock title = display.create(new FontConfiguration(param, FontParam.ARROW, null), - HorizontalAlignment.CENTER, param); + final TextBlock title = display.create(fontConfiguration, HorizontalAlignment.CENTER, skinParam); final Snake snake = Snake.create(Arrows.asToUp(), rainbow, Arrows.asToDown()).withLabel(title, HorizontalAlignment.CENTER); diff --git a/src/net/sourceforge/plantuml/sequencediagram/Reference.java b/src/net/sourceforge/plantuml/sequencediagram/Reference.java index a034c46f5..028303652 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Reference.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Reference.java @@ -69,10 +69,8 @@ public class Reference extends AbstractEvent implements Event { } public Style[] getUsedStyles() { - return new Style[] { - style, - styleHeader == null ? styleHeader : styleHeader.eventuallyOverride(PName.BackGroundColor, - backColorElement) }; + return new Style[] { style, styleHeader == null ? styleHeader + : styleHeader.eventuallyOverride(PName.BackGroundColor, backColorElement) }; } public Reference(List participants, Url url, Display strings, HColor backColorGeneral, @@ -111,9 +109,8 @@ public class Reference extends AbstractEvent implements Event { final StringBuilder sb = new StringBuilder(); for (final Iterator it = participants.iterator(); it.hasNext();) { sb.append(it.next().getCode()); - if (it.hasNext()) { + if (it.hasNext()) sb.append("-"); - } } return sb.toString(); diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index c01713f24..b516cbe8f 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -55,6 +55,7 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -93,8 +94,8 @@ public class SequenceDiagram extends UmlDiagram { private final Rose skin2 = new Rose(); - public SequenceDiagram(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.SEQUENCE, skinParam); + public SequenceDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.SEQUENCE, skinParam); } @Deprecated diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java index a704132d3..aec90ed5b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java @@ -39,9 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteAcrossCommand; import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteCommand; import net.sourceforge.plantuml.command.note.sequence.FactorySequenceNoteOnArrowCommand; @@ -84,8 +85,8 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandUrl; public class SequenceDiagramFactory extends PSystemCommandFactory { @Override - public SequenceDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new SequenceDiagram(source, skinParam); + public SequenceDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new SequenceDiagram(style, source, skinParam); } @Override diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java index 7a08c16f3..ff5828244 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java @@ -42,10 +42,10 @@ import java.util.StringTokenizer; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java index 51465cb1f..b4a18ce8a 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java @@ -84,8 +84,8 @@ public class CommunicationTileSelfNoteRight extends AbstractTile { } private Component getComponent(StringBounder stringBounder) { - final Component comp = skin.createComponentNote(null, ComponentType.NOTE, noteOnMessage.getSkinParamBackcolored(skinParam), - noteOnMessage.getStrings()); + final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE, + noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings()); return comp; } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java index d99e3012f..2624ee80b 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseActiveLine.java @@ -37,8 +37,8 @@ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.skin.AbstractComponent; diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java index e048172af..a60715f53 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDivider.java @@ -63,6 +63,7 @@ public class ComponentRoseDivider extends AbstractTextualComponent { private final HColor background; private final boolean empty; private final boolean withShadow; + private final double shadow; private final UStroke stroke; private final double roundCorner; @@ -77,7 +78,9 @@ public class ComponentRoseDivider extends AbstractTextualComponent { getIHtmlColorSet()); this.stroke = style.getStroke(); this.roundCorner = style.value(PName.RoundCorner).asInt(); + this.shadow = style.value(PName.Shadowing).asDouble(); } else { + this.shadow = 0; this.background = background; this.borderColor = borderColor; this.stroke = stroke; @@ -108,15 +111,13 @@ public class ComponentRoseDivider extends AbstractTextualComponent { ug = ug.apply(borderColor); ug = ug.apply(stroke); final URectangle rect = new URectangle(textWidth + deltaX, textHeight).rounded(roundCorner); - if (withShadow) { + if (UseStyle.useBetaStyle()) + rect.setDeltaShadow(shadow); + else if (withShadow) rect.setDeltaShadow(4); - } + ug.apply(new UTranslate(xpos, ypos)).draw(rect); textBlock.drawU(ug.apply(new UTranslate(xpos + deltaX, ypos + getMarginY()))); - - // drawSep(ug.apply(new UTranslate(xpos + deltaX + textWidth + - // stroke.getThickness() + , dimensionToUse - // .getHeight() / 2)), 10); } } @@ -128,9 +129,11 @@ public class ComponentRoseDivider extends AbstractTextualComponent { private void drawRectLong(UGraphic ug, double width) { final URectangle rectLong = new URectangle(width, 3).rounded(roundCorner); - if (withShadow) { + if (UseStyle.useBetaStyle()) + rectLong.setDeltaShadow(shadow); + else if (withShadow) rectLong.setDeltaShadow(2); - } + ug = ug.apply(new UStroke()); ug.draw(rectLong); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java index 8247a1324..683eafa0d 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java @@ -102,18 +102,14 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { Objects.requireNonNull(this.background); } - // new FontConfiguration(smallFont, bigFont.getColor(), - // bigFont.getHyperlinkColor(), - // bigFont.useUnderlineForHyperlink()); - private double getSuppHeightForComment(StringBounder stringBounder) { - if (commentTextBlock == null) { + if (commentTextBlock == null) return 0; - } + final double height = commentTextBlock.calculateDimension(stringBounder).getHeight(); - if (height > 15) { + if (height > 15) return height - 15; - } + return 0; } @@ -138,9 +134,9 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { - if (background instanceof HColorBackground) { + if (background instanceof HColorBackground) return; - } + final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = symbolContext.applyStroke(ug).apply(symbolContext.getForeColor()); final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()) @@ -153,14 +149,13 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); final StringBounder stringBounder = ug.getStringBounder(); - final int textWidth = (int) getTextWidth(stringBounder); - final int textHeight = (int) getTextHeight(stringBounder); + final double textWidth = getTextWidth(stringBounder); + final double textHeight = getTextHeight(stringBounder); - if (UseStyle.useBetaStyle()) { + if (UseStyle.useBetaStyle()) symbolContextCorner.apply(ug).draw(getCorner(textWidth, textHeight)); - } else { + else symbolContextCorner.applyColors(ug).draw(getCorner(textWidth, textHeight)); - } ug = symbolContext.applyStroke(ug).apply(symbolContext.getForeColor()); final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()) @@ -172,8 +167,8 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY()))); if (commentTextBlock != null) { - final int x1 = getMarginX1() + textWidth; - final int y2 = getMarginY() + 1; + final double x1 = getMarginX1() + textWidth; + final double y2 = getMarginY() + 1; commentTextBlock.drawU(ug.apply(new UTranslate(x1 + commentMargin, y2))); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java index 7897e17de..323448ff9 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java @@ -37,8 +37,8 @@ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java index 2eba7c9da..4880bd451 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagram.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.UmlSource; @@ -62,8 +63,8 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ListSpriteDiagram extends UmlDiagram { - public ListSpriteDiagram(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.HELP, skinParam); + public ListSpriteDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.HELP, skinParam); } public DiagramDescription getDescription() { @@ -72,17 +73,14 @@ public class ListSpriteDiagram extends UmlDiagram { @Override public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { - return super.createImageBuilder(fileFormatOption) - .annotations(false); + return super.createImageBuilder(fileFormatOption).annotations(false); } @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return createImageBuilder(fileFormatOption) - .drawable(getTable()) - .write(os); + return createImageBuilder(fileFormatOption).drawable(getTable()).write(os); } private TextBlock getTable() { diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java index 6a84a7fc2..42c50c361 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java @@ -39,9 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.UmlSource; public class ListSpriteDiagramFactory extends PSystemCommandFactory { @@ -57,8 +58,8 @@ public class ListSpriteDiagramFactory extends PSystemCommandFactory { } @Override - public ListSpriteDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new ListSpriteDiagram(source, skinParam); + public ListSpriteDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new ListSpriteDiagram(style, source, skinParam); } } diff --git a/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java b/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java index b905f90ed..b30f8fae9 100644 --- a/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java +++ b/src/net/sourceforge/plantuml/sprite/SpriteMonochrome.java @@ -63,55 +63,52 @@ public class SpriteMonochrome implements Sprite { private final int gray[][]; public boolean isSameKind(SpriteMonochrome other) { - if (this.width != other.width) { + if (this.width != other.width) return false; - } - if (this.height != other.height) { + + if (this.height != other.height) return false; - } - if (this.grayLevel != other.grayLevel) { + + if (this.grayLevel != other.grayLevel) return false; - } + return true; } public boolean isSame(SpriteMonochrome other) { - if (isSameKind(other) == false) { + if (isSameKind(other) == false) return false; - } - for (int i = 0; i < width; i++) { - for (int j = 0; j < height; j++) { - if (this.gray[j][i] != other.gray[j][i]) { + + for (int i = 0; i < width; i++) + for (int j = 0; j < height; j++) + if (this.gray[j][i] != other.gray[j][i]) return false; - } - } - } + return true; } public SpriteMonochrome xor(SpriteMonochrome other) { - if (this.width != other.width) { + if (this.width != other.width) throw new IllegalStateException(); - } - if (this.height != other.height) { + + if (this.height != other.height) throw new IllegalStateException(); - } - if (this.grayLevel != other.grayLevel) { + + if (this.grayLevel != other.grayLevel) throw new IllegalStateException(); - } + final SpriteMonochrome result = new SpriteMonochrome(width, height, grayLevel); - for (int i = 0; i < width; i++) { - for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) + for (int j = 0; j < height; j++) result.gray[j][i] = this.gray[j][i] ^ other.gray[j][i]; - } - } + return result; } public SpriteMonochrome(int width, int height, int grayLevel) { - if (grayLevel != 2 && grayLevel != 4 && grayLevel != 8 && grayLevel != 16) { + if (grayLevel != 2 && grayLevel != 4 && grayLevel != 8 && grayLevel != 16) throw new IllegalArgumentException(); - } + this.width = width; this.height = height; this.grayLevel = grayLevel; @@ -120,58 +117,56 @@ public class SpriteMonochrome implements Sprite { public SpriteMonochrome xSymetric() { final SpriteMonochrome result = new SpriteMonochrome(width, height, grayLevel); - for (int i = 0; i < width; i++) { - for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) + for (int j = 0; j < height; j++) result.setGray(i, j, this.getGray(i, j)); - } - } - for (int j = 0; j < height; j++) { + + for (int j = 0; j < height; j++) for (int i = 0; i < width / 2; i++) { final int i2 = width - 1 - i; final int level = result.getGray(i, j) ^ result.getGray(i2, j); result.setGray(i2, j, level); } - } + return result; } public SpriteMonochrome ySymetric() { final SpriteMonochrome result = new SpriteMonochrome(width, height, grayLevel); - for (int i = 0; i < width; i++) { - for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) + for (int j = 0; j < height; j++) result.setGray(i, j, this.getGray(i, j)); - } - } - for (int i = 0; i < width; i++) { + + for (int i = 0; i < width; i++) for (int j = 0; j < height / 2; j++) { final int j2 = height - 1 - j; final int level = result.getGray(i, j) ^ result.getGray(i, j2); result.setGray(i, j2, level); } - } + return result; } public void setGray(int x, int y, int level) { - if (x < 0 || x >= width) { + if (x < 0 || x >= width) return; - } - if (y < 0 || y >= height) { + + if (y < 0 || y >= height) return; - } - if (level < 0 || level >= grayLevel) { + + if (level < 0 || level >= grayLevel) throw new IllegalArgumentException("level=" + level + " grayLevel=" + grayLevel); - } + gray[y][x] = level; } public int getGray(int x, int y) { - if (x >= width) { + if (x >= width) throw new IllegalArgumentException("x=" + x + " width=" + width); - } - if (y >= height) { + + if (y >= height) throw new IllegalArgumentException("y=" + y + " height=" + height); - } + return gray[y][x]; } @@ -185,15 +180,12 @@ public class SpriteMonochrome implements Sprite { public UImage toUImage(ColorMapper colorMapper, HColor backcolor, HColor color) { - if (backcolor == null) { - backcolor = HColorUtils.WHITE; - } - if (color == null) { - color = HColorUtils.BLACK; - } - // if (backcolor instanceof HtmlColorGradient) { - // return special(colorMapper, (HtmlColorGradient) backcolor, color); - // } + if (backcolor == null || HColorUtils.isTransparent(backcolor)) + backcolor = HColorUtils.WHITE.withDark(HColorUtils.BLACK); + + if (color == null || HColorUtils.isTransparent(color)) + color = HColorUtils.BLACK.withDark(HColorUtils.WHITE); + final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); final HColorGradient gradient = new HColorGradient(backcolor, color, '\0'); for (int col = 0; col < width; col++) { diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java index f86f2864c..ee200117d 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.WithSprite; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFactorySprite; @@ -64,6 +65,7 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; @@ -72,8 +74,8 @@ public class StdlibDiagram extends UmlDiagram { private static final int WIDTH = 1800; private String name; - public StdlibDiagram(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.HELP, skinParam); + public StdlibDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.HELP, skinParam); } public DiagramDescription getDescription() { @@ -82,17 +84,14 @@ public class StdlibDiagram extends UmlDiagram { @Override public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { - return super.createImageBuilder(fileFormatOption) - .annotations(false); + return super.createImageBuilder(fileFormatOption).annotations(false); } @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return createImageBuilder(fileFormatOption) - .drawable(getTable()) - .write(os); + return createImageBuilder(fileFormatOption).drawable(getTable()).write(os); } private TextBlock getTable() { @@ -144,7 +143,7 @@ public class StdlibDiagram extends UmlDiagram { final Sprite sprite = getSkinParam().getSprite(n); TextBlock blockName = Display.create(n).create(FontConfiguration.blackBlueTrue(UFont.sansSerif(14)), HorizontalAlignment.LEFT, getSkinParam()); - TextBlock tb = sprite.asTextBlock(HColorUtils.BLACK, 1.0); + TextBlock tb = sprite.asTextBlock(getBlack(), 1.0); tb = TextBlockUtils.mergeTB(tb, blockName, HorizontalAlignment.CENTER); tb.drawU(ug.apply(new UTranslate(x, y))); final Dimension2D dim = tb.calculateDimension(ug.getStringBounder()); @@ -161,4 +160,8 @@ public class StdlibDiagram extends UmlDiagram { } } } + + private HColor getBlack() { + return HColorUtils.BLACK.withDark(HColorUtils.WHITE); + } } diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java index fda564fc0..2f4d414a6 100644 --- a/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagramFactory.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.UmlSource; @@ -54,8 +55,8 @@ public class StdlibDiagramFactory extends PSystemCommandFactory { } @Override - public StdlibDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new StdlibDiagram(source, skinParam); + public StdlibDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new StdlibDiagram(style, source, skinParam); } } diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java index d88266c6e..c35248e8a 100644 --- a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java +++ b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java @@ -39,6 +39,7 @@ import java.util.Objects; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.cucadiagram.Code; @@ -59,8 +60,8 @@ public class StateDiagram extends AbstractEntityDiagram { private static final String CONCURRENT_PREFIX = "CONC"; - public StateDiagram(UmlSource source, ISkinSimple skinParam) { - super(source, UmlDiagramType.STATE, skinParam); + public StateDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + super(style, source, UmlDiagramType.STATE, skinParam); // setNamespaceSeparator(null); } diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java b/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java index bfd0e8312..a1803aa4f 100644 --- a/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java +++ b/src/net/sourceforge/plantuml/statediagram/StateDiagramFactory.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator; import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore; @@ -46,8 +47,8 @@ import net.sourceforge.plantuml.classdiagram.command.CommandUrl; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandRankDir; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.note.CommandFactoryNote; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; @@ -66,8 +67,8 @@ import net.sourceforge.plantuml.statediagram.command.CommandLinkStateReverse; public class StateDiagramFactory extends PSystemCommandFactory { @Override - public StateDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new StateDiagram(source, skinParam); + public StateDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new StateDiagram(style, source, skinParam); } @Override diff --git a/src/net/sourceforge/plantuml/style/DarkString.java b/src/net/sourceforge/plantuml/style/DarkString.java new file mode 100644 index 000000000..56c5b3d87 --- /dev/null +++ b/src/net/sourceforge/plantuml/style/DarkString.java @@ -0,0 +1,94 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.style; + +public class DarkString { + + private final String value1; + private final String value2; + private final int priority; + + public DarkString(String value1, String value2, int priority) { + this.value1 = value1; + this.value2 = value2; + this.priority = priority; + } + + public DarkString mergeWith(DarkString other) { + if (other == null) + return this; + + if ((this.value2 == null && other.value2 == null) || this.value1 == null && other.value1 == null) { + if (this.priority > other.priority) + return this; + return other; + } + if (this.value2 == null && other.value1 == null) + return new DarkString(this.value1, other.value2, this.priority); + if (other.value2 == null && this.value1 == null) + return new DarkString(other.value1, this.value2, other.priority); + + if (this.priority > other.priority) + return this; + return other; + +// System.err.println("this =" + this); +// System.err.println("other=" + other); +// throw new UnsupportedOperationException(); + } + + public DarkString addPriority(int delta) { + return new DarkString(value1, value2, delta + priority); + } + + @Override + public String toString() { + return value1 + "/" + value2 + " (" + priority + ")"; + } + + public final String getValue1() { + return value1; + } + + public final String getValue2() { + return value2; + } + + public final int getPriority() { + return priority; + } + +} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java index 14d7790fe..2d3b93e59 100644 --- a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java +++ b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java @@ -61,7 +61,7 @@ public class FromSkinparamToStyle { addConvert("participantClickableBackgroundColor", PName.BackGroundColor, SName.participant, SName.clickable); addConvert("participantClickableBorderColor", PName.LineColor, SName.participant, SName.clickable); addMagic(SName.participant); - + addMagic(SName.boundary); addMagic(SName.control); addMagic(SName.collections); @@ -71,7 +71,7 @@ public class FromSkinparamToStyle { addConFont("header", SName.header); addConFont("footer", SName.footer); - + addConvert("defaultFontSize", PName.FontSize, SName.element); addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype); @@ -108,14 +108,13 @@ public class FromSkinparamToStyle { addConvert("packageBorderColor", PName.LineColor, SName.group); addMagic(SName.package_); - addConvert("PartitionBorderColor", PName.LineColor, SName.partition); addConvert("PartitionBackgroundColor", PName.BackGroundColor, SName.partition); addConFont("Partition", SName.partition); addConvert("hyperlinkColor", PName.HyperLinkColor, SName.root); - addConvert("activityStartColor", PName.LineColor, SName.circle); + addConvert("activityStartColor", PName.BackGroundColor, SName.circle, SName.start); addConvert("activityEndColor", PName.LineColor, SName.circle, SName.end); addConvert("activityStopColor", PName.LineColor, SName.circle, SName.stop); addConvert("activityBarColor", PName.LineColor, SName.activityBar); @@ -134,6 +133,7 @@ public class FromSkinparamToStyle { addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root); addConvert("defaultFontName", PName.FontName, SName.root); + addConvert("defaultFontColor", PName.FontColor, SName.root); addConFont("SwimlaneTitle", SName.swimlane); addConvert("SwimlaneTitleBackgroundColor", PName.BackGroundColor, SName.swimlane); @@ -222,7 +222,7 @@ public class FromSkinparamToStyle { if (datas != null) { for (Data data : datas) { - addStyle(data.propertyName, new ValueImpl(value, counter), data.styleNames); + addStyle(data.propertyName, ValueImpl.regular(value, counter), data.styleNames); } } else if (key.equalsIgnoreCase("shadowing")) { addStyle(PName.Shadowing, getShadowingValue(value, counter), SName.root); @@ -233,21 +233,22 @@ public class FromSkinparamToStyle { private ValueImpl getShadowingValue(final String value, final AutomaticCounter counter) { if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no")) { - return new ValueImpl("0", counter); + return ValueImpl.regular("0", counter); } if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes")) { - return new ValueImpl("3", counter); + return ValueImpl.regular("3", counter); } - return new ValueImpl(value, counter); + return ValueImpl.regular(value, counter); } private void addStyle(PName propertyName, Value value, SName... styleNames) { final Map map = new EnumMap(PName.class); map.put(propertyName, value); StyleSignature sig = StyleSignature.of(styleNames); - if (stereo != null) { - sig = sig.add(stereo); - } + if (stereo != null) + for (String s : stereo.split("\\&")) + sig = sig.add(s); + styles.add(new Style(sig, map)); } diff --git a/src/net/sourceforge/plantuml/style/PName.java b/src/net/sourceforge/plantuml/style/PName.java index 7e681ecd0..2e011718c 100644 --- a/src/net/sourceforge/plantuml/style/PName.java +++ b/src/net/sourceforge/plantuml/style/PName.java @@ -39,18 +39,14 @@ public enum PName { Shadowing, // FontName, // FontColor, // - DARK_FontColor, // FontSize, // FontStyle, // BackGroundColor, // - DARK_BackGroundColor, // RoundCorner, // LineThickness, // DiagonalCorner, // HyperLinkColor, // - DARK_HyperLinkColor, // LineColor, // - DARK_LineColor, // LineStyle, // Padding, // Margin, // @@ -63,29 +59,11 @@ public enum PName { ImagePosition; public static PName getFromName(String name, StyleScheme scheme) { - for (PName prop : values()) { - if (prop.name().equalsIgnoreCase(name)) { - if (scheme == StyleScheme.DARK) - return dark(prop); + for (PName prop : values()) + if (prop.name().equalsIgnoreCase(name)) return prop; - } - } + return null; } - private static PName dark(PName name) { - switch (name) { - case FontColor: - return DARK_FontColor; - case BackGroundColor: - return DARK_BackGroundColor; - case HyperLinkColor: - return DARK_HyperLinkColor; - case LineColor: - return DARK_LineColor; - default: - return name; - } - } - } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java index dcf54d13c..c61d3690d 100644 --- a/src/net/sourceforge/plantuml/style/SName.java +++ b/src/net/sourceforge/plantuml/style/SName.java @@ -58,6 +58,9 @@ public enum SName { collection, // collections, // component, // + robust, // + concise, // + clock, // componentDiagram, // constraintArrow, // control, // @@ -69,6 +72,7 @@ public enum SName { element, // entity, // end, // + start, // stop, // file, // folder, // diff --git a/src/net/sourceforge/plantuml/style/Style.java b/src/net/sourceforge/plantuml/style/Style.java index 2561967a4..49fcb9c49 100644 --- a/src/net/sourceforge/plantuml/style/Style.java +++ b/src/net/sourceforge/plantuml/style/Style.java @@ -42,7 +42,7 @@ import java.util.StringTokenizer; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.LineBreakStrategy; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -74,7 +74,7 @@ public class Style { final EnumMap copy = new EnumMap(PName.class); for (Entry ent : this.map.entrySet()) - copy.put(ent.getKey(), new ValueDeltaPriority(ent.getValue(), delta)); + copy.put(ent.getKey(), ((ValueImpl) ent.getValue()).addPriority(delta)); return new Style(this.signature, copy); @@ -102,24 +102,6 @@ public class Style { if (result == null) return ValueNull.NULL; - if (name == PName.BackGroundColor) { - final Value resultDark = map.get(PName.DARK_BackGroundColor); - if (resultDark != null) - return new ValueForDark(result, resultDark); - } else if (name == PName.LineColor) { - final Value resultDark = map.get(PName.DARK_LineColor); - if (resultDark != null) - return new ValueForDark(result, resultDark); - } else if (name == PName.FontColor) { - final Value resultDark = map.get(PName.DARK_FontColor); - if (resultDark != null) - return new ValueForDark(result, resultDark); - } else if (name == PName.HyperLinkColor) { - final Value resultDark = map.get(PName.DARK_HyperLinkColor); - if (resultDark != null) - return new ValueForDark(result, resultDark); - } - return result; } @@ -134,9 +116,8 @@ public class Style { final EnumMap both = new EnumMap(this.map); for (Entry ent : other.map.entrySet()) { final Value previous = this.map.get(ent.getKey()); - if (previous == null || ent.getValue().getPriority() > previous.getPriority()) - both.put(ent.getKey(), ent.getValue()); - + final PName key = ent.getKey(); + both.put(key, ((ValueImpl) ent.getValue()).mergeWith(previous)); } return new Style(this.signature.mergeWith(other.getSignature()), both); } @@ -157,7 +138,7 @@ public class Style { public Style eventuallyOverride(PName param, String value) { final EnumMap result = new EnumMap(this.map); - result.put(param, new ValueImpl(value, Integer.MAX_VALUE)); + result.put(param, ValueImpl.regular(value, Integer.MAX_VALUE)); return new Style(this.signature, result); } diff --git a/src/net/sourceforge/plantuml/style/StyleLoader.java b/src/net/sourceforge/plantuml/style/StyleLoader.java index 37f4ee68f..6b643c245 100644 --- a/src/net/sourceforge/plantuml/style/StyleLoader.java +++ b/src/net/sourceforge/plantuml/style/StyleLoader.java @@ -166,7 +166,9 @@ public class StyleLoader { final PName key = PName.getFromName(mPropertyAndValue.group(1), scheme); final String value = mPropertyAndValue.group(2); if (key != null && maps.size() > 0) - maps.get(maps.size() - 1).put(key, new ValueImpl(value, counter)); + maps.get(maps.size() - 1).put(key, // + scheme == StyleScheme.REGULAR ? // + ValueImpl.regular(value, counter) : ValueImpl.dark(value, counter)); continue; } diff --git a/src/net/sourceforge/plantuml/style/Value.java b/src/net/sourceforge/plantuml/style/Value.java index a0af45626..3e8391e03 100644 --- a/src/net/sourceforge/plantuml/style/Value.java +++ b/src/net/sourceforge/plantuml/style/Value.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.style; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; diff --git a/src/net/sourceforge/plantuml/style/ValueAbstract.java b/src/net/sourceforge/plantuml/style/ValueAbstract.java index 831764149..b676bd3ee 100644 --- a/src/net/sourceforge/plantuml/style/ValueAbstract.java +++ b/src/net/sourceforge/plantuml/style/ValueAbstract.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.style; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; diff --git a/src/net/sourceforge/plantuml/style/ValueColor.java b/src/net/sourceforge/plantuml/style/ValueColor.java index b6152c524..610b7d297 100644 --- a/src/net/sourceforge/plantuml/style/ValueColor.java +++ b/src/net/sourceforge/plantuml/style/ValueColor.java @@ -35,7 +35,7 @@ */ package net.sourceforge.plantuml.style; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; diff --git a/src/net/sourceforge/plantuml/style/ValueForDark.java b/src/net/sourceforge/plantuml/style/ValueForDark.java deleted file mode 100644 index 309a5539a..000000000 --- a/src/net/sourceforge/plantuml/style/ValueForDark.java +++ /dev/null @@ -1,97 +0,0 @@ -/* ======================================================================== - * PlantUML : a free UML diagram generator - * ======================================================================== - * - * (C) Copyright 2009-2020, Arnaud Roques - * - * Project Info: http://plantuml.com - * - * If you like this project or if you find it useful, you can support us at: - * - * http://plantuml.com/patreon (only 1$ per month!) - * http://plantuml.com/paypal - * - * This file is part of PlantUML. - * - * PlantUML is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PlantUML distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. - * - * - * Original Author: Arnaud Roques - * - * - */ -package net.sourceforge.plantuml.style; - -import net.sourceforge.plantuml.ThemeStyle; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.ugraphic.color.HColor; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; -import net.sourceforge.plantuml.ugraphic.color.HColorSimple; - -public class ValueForDark implements Value { - - private final Value regular; - private final Value dark; - - public ValueForDark(Value regular, Value dark) { - this.regular = regular; - this.dark = dark; - } - - @Override - public String asString() { - throw new UnsupportedOperationException(); - } - - @Override - public HColor asColor(ThemeStyle themeStyle, HColorSet set) { - final HColor result = regular.asColor(themeStyle, set); - if (result instanceof HColorSimple) - return ((HColorSimple) result).withDark(dark.asColor(themeStyle, set)); - return result; - } - - @Override - public int asInt() { - throw new UnsupportedOperationException(); - } - - @Override - public double asDouble() { - throw new UnsupportedOperationException(); - } - - @Override - public boolean asBoolean() { - throw new UnsupportedOperationException(); - } - - @Override - public int asFontStyle() { - throw new UnsupportedOperationException(); - } - - @Override - public HorizontalAlignment asHorizontalAlignment() { - throw new UnsupportedOperationException(); - } - - @Override - public int getPriority() { - throw new UnsupportedOperationException(); - } - -} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/style/ValueImpl.java b/src/net/sourceforge/plantuml/style/ValueImpl.java index dab7db606..84b0ce536 100644 --- a/src/net/sourceforge/plantuml/style/ValueImpl.java +++ b/src/net/sourceforge/plantuml/style/ValueImpl.java @@ -38,72 +38,97 @@ package net.sourceforge.plantuml.style; import java.awt.Font; import java.util.Objects; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ValueImpl implements Value { - private final String value; - private final int priority; + private final DarkString value; - public ValueImpl(String value, AutomaticCounter counter) { - this.value = Objects.requireNonNull(value); - this.priority = counter.getNextInt(); + public static ValueImpl dark(String value, AutomaticCounter counter) { + return new ValueImpl(new DarkString(null, Objects.requireNonNull(value), counter.getNextInt())); } - public ValueImpl(String value, int priority) { + public static ValueImpl regular(String value, AutomaticCounter counter) { + return new ValueImpl(new DarkString(Objects.requireNonNull(value), null, counter.getNextInt())); + } + + public static ValueImpl regular(String value, int priority) { + return new ValueImpl(new DarkString(Objects.requireNonNull(value), null, priority)); + } + + public Value mergeWith(Value other) { + if (other == null) + return this; + if (other instanceof ValueImpl) + return new ValueImpl(value.mergeWith(((ValueImpl) other).value)); + if (other instanceof ValueColor) { + if (other.getPriority() > getPriority()) + return other; + return this; + } + throw new UnsupportedOperationException(); + } + + private ValueImpl(DarkString value) { this.value = value; - this.priority = priority; } public Value addPriority(int delta) { - return new ValueImpl(value, delta + priority); + return new ValueImpl(value.addPriority(delta)); } @Override public String toString() { - return value + " (" + priority + ")"; + return value.toString(); } public String asString() { - return value; + return value.getValue1(); } public HColor asColor(ThemeStyle themeStyle, HColorSet set) { - if ("none".equalsIgnoreCase(value)) { + final String value1 = value.getValue1(); + if ("none".equalsIgnoreCase(value1)) return null; - } - if ("transparent".equalsIgnoreCase(value)) { + + if ("transparent".equalsIgnoreCase(value1)) return HColorUtils.transparent(); + + if (value1 == null) + throw new IllegalArgumentException(value.toString()); + + final HColor result = set.getColorOrWhite(themeStyle, value1); + if (value.getValue2() != null) { + final HColor dark = set.getColorOrWhite(themeStyle, value.getValue2()); + return ((HColorSimple) result).withDark(dark); } - if (value == null) { - return null; - } - return set.getColorOrWhite(themeStyle, value); + return result; } public boolean asBoolean() { - return "true".equalsIgnoreCase(value); + return "true".equalsIgnoreCase(value.getValue1()); } public int asInt() { - return Integer.parseInt(value); + return Integer.parseInt(value.getValue1()); } public double asDouble() { - return Double.parseDouble(value); + return Double.parseDouble(value.getValue1()); } public int asFontStyle() { - if (value.equalsIgnoreCase("bold")) { + if (value.getValue1().equalsIgnoreCase("bold")) return Font.BOLD; - } - if (value.equalsIgnoreCase("italic")) { + + if (value.getValue1().equalsIgnoreCase("italic")) return Font.ITALIC; - } + return Font.PLAIN; } @@ -112,7 +137,7 @@ public class ValueImpl implements Value { } public int getPriority() { - return priority; + return value.getPriority(); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/style/ValueNull.java b/src/net/sourceforge/plantuml/style/ValueNull.java index 9c8b523f2..f2c2b27e4 100644 --- a/src/net/sourceforge/plantuml/style/ValueNull.java +++ b/src/net/sourceforge/plantuml/style/ValueNull.java @@ -37,7 +37,7 @@ package net.sourceforge.plantuml.style; import java.awt.Font; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index fe3a7df43..c2dcc4bf2 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -483,10 +483,14 @@ public class Cluster implements Moveable { .getMergedStyle(skinParam.getCurrentStyleBuilder()); HColor stateBack = getBackColor(umlDiagramType, styleGroup); - if (stateBack == null) + if (UseStyle.useBetaStyle() == false && stateBack == null) stateBack = getColorLegacy(skinParam2, ColorParam.stateBackground, group.getStereotype()); - final HColor background = getColorLegacy(skinParam2, ColorParam.background, null); + final HColor background; + if (UseStyle.useBetaStyle() == false) + background = getColorLegacy(skinParam2, ColorParam.background, null); + else + background = stateBack; // final Style style = getStyle(FontParam.STATE_ATTRIBUTE, skinParam2); @@ -936,7 +940,7 @@ public class Cluster implements Moveable { skinParam.getIHtmlColorSet()); if (backColor == null || backColor.equals(HColorUtils.transparent())) - backColor = new HColorBackground(skinParam.getBackgroundColor()); + backColor = HColorUtils.transparent(); return backColor; } diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java index 9f752eb18..1f298d0b9 100644 --- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java +++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java @@ -172,12 +172,13 @@ public final class GeneralImageBuilder { if ((leaf.getLeafType() == LeafType.PORT) || (leaf.getLeafType() == LeafType.PORTIN) || (leaf.getLeafType() == LeafType.PORTOUT)) { final Cluster parent = bibliotekon.getCluster(leaf.getParentContainer()); - return new EntityImagePort(leaf, skinParam, parent, bibliotekon); + return new EntityImagePort(leaf, skinParam, parent, bibliotekon, umlDiagramType.getStyleName()); } if (leaf.getLeafType() == LeafType.STATE) { if (leaf.getEntityPosition() != EntityPosition.NORMAL) { final Cluster stateParent = bibliotekon.getCluster(leaf.getParentContainer()); - return new EntityImageStateBorder(leaf, skinParam, stateParent, bibliotekon); + return new EntityImageStateBorder(leaf, skinParam, stateParent, bibliotekon, + umlDiagramType.getStyleName()); } if (isHideEmptyDescriptionForState && leaf.getBodier().getRawBody().size() == 0) { return new EntityImageStateEmptyDescription(leaf, skinParam); @@ -207,7 +208,7 @@ public final class GeneralImageBuilder { return new EntityImageBranch(leaf, skinParam); } if (leaf.getLeafType() == LeafType.LOLLIPOP_FULL || leaf.getLeafType() == LeafType.LOLLIPOP_HALF) { - return new EntityImageLollipopInterface(leaf, skinParam); + return new EntityImageLollipopInterface(leaf, skinParam, umlDiagramType.getStyleName()); } if (leaf.getLeafType() == LeafType.CIRCLE) { return new EntityImageDescription(leaf, skinParam, portionShower, links, umlDiagramType.getStyleName(), diff --git a/src/net/sourceforge/plantuml/svek/SvekLine.java b/src/net/sourceforge/plantuml/svek/SvekLine.java index 9b4af0268..55fa764c0 100644 --- a/src/net/sourceforge/plantuml/svek/SvekLine.java +++ b/src/net/sourceforge/plantuml/svek/SvekLine.java @@ -673,7 +673,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine { if (endCluster != null) { final double deltaFolderH = endCluster.checkFolderPosition(dotPath.getEndPoint(), ug.getStringBounder()); - todraw = new DotPath(dotPath); + todraw = dotPath.copy(); todraw.moveEndPoint(0, deltaFolderH); // moveEndY = deltaFolderH; } @@ -923,7 +923,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine { } public final DotPath getDotPath() { - final DotPath result = new DotPath(dotPath); + final DotPath result = dotPath.copy(); result.moveSvek(dx, dy); return result; } diff --git a/src/net/sourceforge/plantuml/svek/SvekResult.java b/src/net/sourceforge/plantuml/svek/SvekResult.java index 66e28f52e..8bb2099aa 100644 --- a/src/net/sourceforge/plantuml/svek/SvekResult.java +++ b/src/net/sourceforge/plantuml/svek/SvekResult.java @@ -76,11 +76,17 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage public void drawU(UGraphic ug) { - for (Cluster cluster : dotStringFactory.getBibliotekon().allCluster()) { + for (Cluster cluster : dotStringFactory.getBibliotekon().allCluster()) cluster.drawU(ug, new UStroke(1.5), dotData.getUmlDiagramType(), dotData.getSkinParam()); - } HColor color = rose.getHtmlColor(dotData.getSkinParam(), null, getArrowColorParam()); + if (UseStyle.useBetaStyle()) { + final Style style = getDefaultStyleDefinition(null) + .getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder()); + color = style.value(PName.LineColor).asColor(dotData.getSkinParam().getThemeStyle(), + dotData.getSkinParam().getIHtmlColorSet()); + } + color = HColorUtils.noGradient(color); UStroke stroke = null; @@ -90,10 +96,9 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage final UGraphic ug2 = node.isHidden() ? ug.apply(UHidden.HIDDEN) : ug; final IEntityImage image = node.getImage(); image.drawU(ug2.apply(new UTranslate(minX, minY))); - if (image instanceof Untranslated) { + if (image instanceof Untranslated) ((Untranslated) image).drawUntranslated(ug.apply(color), minX, minY); - } - // shape.getImage().drawNeighborhood(ug2, minX, minY); + } final Set ids = new HashSet<>(); @@ -116,26 +121,26 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage } private ColorParam getArrowColorParam() { - if (dotData.getUmlDiagramType() == UmlDiagramType.CLASS) { + if (dotData.getUmlDiagramType() == UmlDiagramType.CLASS) return ColorParam.arrow; - } else if (dotData.getUmlDiagramType() == UmlDiagramType.OBJECT) { + else if (dotData.getUmlDiagramType() == UmlDiagramType.OBJECT) return ColorParam.arrow; - } else if (dotData.getUmlDiagramType() == UmlDiagramType.DESCRIPTION) { + else if (dotData.getUmlDiagramType() == UmlDiagramType.DESCRIPTION) return ColorParam.arrow; - } else if (dotData.getUmlDiagramType() == UmlDiagramType.ACTIVITY) { + else if (dotData.getUmlDiagramType() == UmlDiagramType.ACTIVITY) return ColorParam.arrow; - } else if (dotData.getUmlDiagramType() == UmlDiagramType.STATE) { + else if (dotData.getUmlDiagramType() == UmlDiagramType.STATE) return ColorParam.arrow; - } + throw new IllegalStateException(); } private StyleSignature getDefaultStyleDefinition(Stereotype stereotype) { StyleSignature result = StyleSignature.of(SName.root, SName.element, dotData.getUmlDiagramType().getStyleName(), SName.arrow); - if (stereotype != null) { + if (stereotype != null) result = result.with(stereotype); - } + return result; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java index 835693740..fbdbfc15e 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleEnd.java @@ -63,7 +63,7 @@ public class EntityImageCircleEnd extends AbstractEntityImage { private final ColorParam param; public StyleSignature getDefaultStyleDefinitionCircle() { - return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.end); } public EntityImageCircleEnd(ILeaf entity, ISkinParam skinParam, ColorParam param) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java index a30214354..63362083c 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageCircleStart.java @@ -61,7 +61,7 @@ public class EntityImageCircleStart extends AbstractEntityImage { private final ColorParam colorParam; // = ColorParam.activityStart; public StyleSignature getDefaultStyleDefinitionCircle() { - return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.start); } public EntityImageCircleStart(ILeaf entity, ISkinParam skinParam, ColorParam colorParam) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java index 746a3ee66..bacbffa00 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterface.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Stereotype; @@ -50,6 +51,10 @@ 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.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UEllipse; @@ -57,18 +62,36 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageLollipopInterface extends AbstractEntityImage { private static final int SIZE = 10; - private final TextBlock desc; - final private Url url; - public EntityImageLollipopInterface(ILeaf entity, ISkinParam skinParam) { + private final TextBlock desc; + private final SName sname; + private final Url url; + + public StyleSignature getSignature() { + return StyleSignature.of(SName.root, SName.element, sname, SName.circle); + } + + private UStroke getUStroke() { + return new UStroke(1.5); + } + + public EntityImageLollipopInterface(ILeaf entity, ISkinParam skinParam, SName sname) { super(entity, skinParam); + this.sname = sname; final Stereotype stereotype = entity.getStereotype(); - this.desc = entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype), - HorizontalAlignment.CENTER, skinParam); + final FontConfiguration fc; + if (UseStyle.useBetaStyle()) + fc = new FontConfiguration(getSkinParam(), + getSignature().getMergedStyle(skinParam.getCurrentStyleBuilder())); + else + fc = new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype); + + this.desc = entity.getDisplay().create(fc, HorizontalAlignment.CENTER, skinParam); this.url = entity.getUrl99(); } @@ -78,37 +101,49 @@ public class EntityImageLollipopInterface extends AbstractEntityImage { } final public void drawU(UGraphic ug) { + + final HColor backgroundColor; + final HColor borderColor; + double shadow = 4; + + if (UseStyle.useBetaStyle()) { + final Style style = getSignature().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + backgroundColor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + shadow = style.value(PName.Shadowing).asDouble(); + } else { + backgroundColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground); + borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder); + } + final UEllipse circle; if (getEntity().getLeafType() == LeafType.LOLLIPOP_HALF) { - // circle = new UEllipse(SIZE, SIZE, 0, 180); circle = new UEllipse(SIZE, SIZE, angle - 90, 180); } else { circle = new UEllipse(SIZE, SIZE); - if (getSkinParam().shadowing(getEntity().getStereotype())) { - circle.setDeltaShadow(4); - } - } - ug = ug.apply( - SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground).bg()) - .apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder)); - if (url != null) { - ug.startUrl(url); + if (getSkinParam().shadowing(getEntity().getStereotype())) + circle.setDeltaShadow(shadow); } + ug = ug.apply(backgroundColor.bg()).apply(borderColor); + if (url != null) + ug.startUrl(url); + ug.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected"); - ug.apply(new UStroke(1.5)).draw(circle); + ug.apply(getUStroke()).draw(circle); ug.closeGroup(); final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder()); final double widthDesc = dimDesc.getWidth(); - // final double totalWidth = Math.max(widthDesc, SIZE); final double x = SIZE / 2 - widthDesc / 2; final double y = SIZE; desc.drawU(ug.apply(new UTranslate(x, y))); - if (url != null) { + if (url != null) ug.closeUrl(); - } + } public ShapeType getShapeType() { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageMap.java b/src/net/sourceforge/plantuml/svek/image/EntityImageMap.java index 905405bbe..786326444 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageMap.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageMap.java @@ -108,13 +108,12 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With .withMargin(entity.getDisplay().create(fcHeader, HorizontalAlignment.CENTER, skinParam), 2, 2); if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null - || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { + || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) this.stereo = null; - } else { + else this.stereo = Display.create(stereotype.getLabels(skinParam.guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.OBJECT_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam); - } if (UseStyle.useBetaStyle()) { final FontConfiguration fontConfiguration = getStyleHeader() @@ -141,9 +140,8 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With final Dimension2D dimTitle = getTitleDimension(stringBounder); final Dimension2D dimFields = entries.calculateDimension(stringBounder); double width = Math.max(dimFields.getWidth(), dimTitle.getWidth() + 2 * xMarginCircle); - if (width < getSkinParam().minClassWidth()) { + if (width < getSkinParam().minClassWidth()) width = getSkinParam().minClassWidth(); - } final double height = getMethodOrFieldHeight(dimFields) + dimTitle.getHeight(); return new Dimension2DDouble(width, height); @@ -167,36 +165,41 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner); - if (getSkinParam().shadowing(getEntity().getStereotype())) { - rect.setDeltaShadow(4); - } - final HColor borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder); - ug = ug.apply(borderColor); + final HColor borderColor; + final UStroke stroke; HColor backcolor = getEntity().getColors().getColor(ColorType.BACK); - if (backcolor == null) { - if (UseStyle.useBetaStyle()) - backcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), + + if (UseStyle.useBetaStyle()) { + final Style style = getStyle(); + borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + if (backcolor == null) + backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()); - else + rect.setDeltaShadow(style.value(PName.Shadowing).asDouble()); + stroke = style.getStroke(); + } else { + if (getSkinParam().shadowing(getEntity().getStereotype())) + rect.setDeltaShadow(4); + borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder); + if (backcolor == null) backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBackground); - + stroke = getStroke(); } - ug = ug.apply(backcolor.bg()); - if (url != null) { + ug = ug.apply(borderColor).apply(backcolor.bg()); + + if (url != null) ug.startUrl(url); - } - - final UStroke stroke = getStroke(); ug.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected"); ug.apply(stroke).draw(rect); final ULayoutGroup header = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder())); - if (stereo != null) { + if (stereo != null) header.add(stereo); - } + header.add(name); header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight()); @@ -204,29 +207,28 @@ public class EntityImageMap extends AbstractEntityImage implements Stencil, With ((TextBlockMap) entries).setTotalWidth(dimTotal.getWidth()); entries.drawU(ug2.apply(UTranslate.dy(dimTitle.getHeight()))); - if (url != null) { + if (url != null) ug.closeUrl(); - } ug.closeGroup(); } private UStroke getStroke() { UStroke stroke = lineConfig.getColors().getSpecificLineStroke(); - if (stroke == null) { + if (stroke == null) stroke = getSkinParam().getThickness(LineParam.objectBorder, getStereo()); - } - if (stroke == null) { + + if (stroke == null) stroke = new UStroke(1.5); - } + return stroke; } private double getMethodOrFieldHeight(final Dimension2D dim) { final double fieldsHeight = dim.getHeight(); - if (fieldsHeight == 0 && this.getEntity().getLeafType() != LeafType.MAP) { + if (fieldsHeight == 0 && this.getEntity().getLeafType() != LeafType.MAP) return marginEmptyFieldsOrMethod; - } + return fieldsHeight; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java index 3facfe009..5667f4e1e 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -111,12 +111,12 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { if (UseStyle.useBetaStyle()) { final Style style = getDefaultStyleDefinition(umlDiagramType.getStyleName()) .getMergedStyle(skinParam.getCurrentStyleBuilder()); - if (entity.getColors().getColor(ColorType.BACK) == null) { + if (entity.getColors().getColor(ColorType.BACK) == null) this.noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); - } else { + else this.noteBackgroundColor = entity.getColors().getColor(ColorType.BACK); - } + this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); this.shadowing = style.value(PName.Shadowing).asDouble(); @@ -124,43 +124,44 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { fontConfiguration = style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); horizontalAlignment = style.getHorizontalAlignment(); } else { + this.shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0; - if (entity.getColors().getColor(ColorType.BACK) == null) { + if (entity.getColors().getColor(ColorType.BACK) == null) this.noteBackgroundColor = rose.getHtmlColor(getSkinParam(), ColorParam.noteBackground); - } else { + else this.noteBackgroundColor = entity.getColors().getColor(ColorType.BACK); - } + this.borderColor = SkinParamUtils.getColor(getSkinParam(), null, ColorParam.noteBorder); fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.NOTE, null); horizontalAlignment = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false, null); } - if (strings.size() == 1 && strings.get(0).length() == 0) { + if (strings.size() == 1 && strings.get(0).length() == 0) textBlock = new TextBlockEmpty(); - } else { + else textBlock = BodyFactory.create3(strings, FontParam.NOTE, getSkinParam(), horizontalAlignment, fontConfiguration, getSkinParam().wrapWidth()); - } + } private static ISkinParam getISkinParam(ISkinParam skinParam, IEntity entity) { - if (entity.getColors() != null) { + if (entity.getColors() != null) return entity.getColors().mute(skinParam); - } + return skinParam; } static ISkinParam getSkin(ISkinParam skinParam, IEntity entity) { final Stereotype stereotype = entity.getStereotype(); HColor back = entity.getColors().getColor(ColorType.BACK); - if (back != null) { + if (back != null) return new SkinParamBackcolored(skinParam, back); - } + back = getColorStatic(skinParam, ColorParam.noteBackground, stereotype); - if (back != null) { + if (back != null) return new SkinParamBackcolored(skinParam, back); - } + return skinParam; } @@ -217,9 +218,9 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { ug.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected"); - if (url != null) { + if (url != null) ug.startUrl(url); - } + final UGraphic ug2 = UGraphicStencil.create(ug, this, new UStroke()); if (opaleLine == null || opaleLine.isOpale() == false) { drawNormal(ug2); @@ -249,9 +250,8 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { final UGraphic stroked = applyStroke(ug2); opale.drawU(Colors.applyStroke(stroked, getEntity().getColors())); } - if (url != null) { + if (url != null) ug.closeUrl(); - } ug.closeGroup(); } @@ -268,9 +268,14 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { final StringBounder stringBounder = ug.getStringBounder(); final UPath polygon = Opale.getPolygonNormal(getTextWidth(stringBounder), getTextHeight(stringBounder), getRoundCorner()); - if (withShadow) { - polygon.setDeltaShadow(4); - } + + double shadow = 0; + if (UseStyle.useBetaStyle()) + shadow = this.shadowing; + else if (withShadow) + shadow = 4; + polygon.setDeltaShadow(shadow); + ug = ug.apply(noteBackgroundColor.bg()).apply(borderColor); final UGraphic stroked = applyStroke(ug); stroked.draw(polygon); @@ -281,9 +286,9 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { private UGraphic applyStroke(UGraphic ug) { final UStroke stroke = skinParam.getThickness(LineParam.noteBorder, null); - if (stroke == null) { + if (stroke == null) return ug; - } + return ug.apply(stroke); } @@ -292,29 +297,29 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { final double d2 = getOrthoDistance(new Line2D.Double(0, height, width, height), pt); final double d3 = getOrthoDistance(new Line2D.Double(0, 0, 0, height), pt); final double d4 = getOrthoDistance(new Line2D.Double(0, 0, width, 0), pt); - if (d3 <= d1 && d3 <= d2 && d3 <= d4) { + if (d3 <= d1 && d3 <= d2 && d3 <= d4) return Direction.LEFT; - } - if (d1 <= d2 && d1 <= d3 && d1 <= d4) { + + if (d1 <= d2 && d1 <= d3 && d1 <= d4) return Direction.RIGHT; - } - if (d4 <= d1 && d4 <= d2 && d4 <= d3) { + + if (d4 <= d1 && d4 <= d2 && d4 <= d3) return Direction.UP; - } - if (d2 <= d1 && d2 <= d3 && d2 <= d4) { + + if (d2 <= d1 && d2 <= d3 && d2 <= d4) return Direction.DOWN; - } + return null; } private static double getOrthoDistance(Line2D.Double seg, Point2D pt) { - if (isHorizontal(seg)) { + if (isHorizontal(seg)) return Math.abs(seg.getP1().getY() - pt.getY()); - } - if (isVertical(seg)) { + + if (isVertical(seg)) return Math.abs(seg.getP1().getX() - pt.getX()); - } + throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java index fbdc896d6..065a54a18 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java @@ -107,22 +107,21 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W final TextBlock tmp = getUnderlinedName(entity).create(fcHeader, HorizontalAlignment.CENTER, skinParam); this.name = TextBlockUtils.withMargin(tmp, 2, 2); if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null - || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { + || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) this.stereo = null; - } else { + else this.stereo = Display.create(stereotype.getLabels(skinParam.guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.OBJECT_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam); - } final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity); - if (entity.getBodier().getFieldsToDisplay().size() == 0) { + if (entity.getBodier().getFieldsToDisplay().size() == 0) this.fields = new TextBlockLineBefore(new TextBlockEmpty(10, 16)); - } else { + else this.fields = entity.getBodier().getBody(FontParam.OBJECT_ATTRIBUTE, skinParam, false, showFields, entity.getStereotype(), getStyle(), null); - } + this.url = entity.getUrl99(); } @@ -138,9 +137,9 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W } private Display getUnderlinedName(ILeaf entity) { - if (getSkinParam().strictUmlStyle()) { + if (getSkinParam().strictUmlStyle()) return entity.getDisplay().underlinedName(); - } + return entity.getDisplay(); } @@ -150,9 +149,8 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W final Dimension2D dimTitle = getTitleDimension(stringBounder); final Dimension2D dimFields = fields.calculateDimension(stringBounder); double width = Math.max(dimFields.getWidth(), dimTitle.getWidth() + 2 * xMarginCircle); - if (width < getSkinParam().minClassWidth()) { + if (width < getSkinParam().minClassWidth()) width = getSkinParam().minClassWidth(); - } final double height = getMethodOrFieldHeight(dimFields) + dimTitle.getHeight(); return new Dimension2DDouble(width, height); @@ -166,64 +164,71 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); final Shadowable rect = new URectangle(widthTotal, heightTotal).rounded(roundCorner); - if (getSkinParam().shadowing(getEntity().getStereotype())) { - rect.setDeltaShadow(4); - } - final HColor borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder); - ug = ug.apply(borderColor); + final HColor borderColor; + final UStroke stroke; HColor backcolor = getEntity().getColors().getColor(ColorType.BACK); - if (backcolor == null) { - if (UseStyle.useBetaStyle()) - backcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), + + if (UseStyle.useBetaStyle()) { + final Style style = getStyle(); + borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + if (backcolor == null) + backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()); - else + rect.setDeltaShadow(style.value(PName.Shadowing).asDouble()); + stroke = style.getStroke(); + + } else { + if (getSkinParam().shadowing(getEntity().getStereotype())) + rect.setDeltaShadow(4); + borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBorder); + if (backcolor == null) backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.objectBackground); + stroke = getStroke(); } - ug = ug.apply(backcolor.bg()); - if (url != null) { + + ug = ug.apply(borderColor).apply(backcolor.bg()); + + if (url != null) ug.startUrl(url); - } - - final UStroke stroke = getStroke(); ug.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected"); ug.apply(stroke).draw(rect); final ULayoutGroup header = new ULayoutGroup(new PlacementStrategyY1Y2(ug.getStringBounder())); - if (stereo != null) { + if (stereo != null) header.add(stereo); - } + header.add(name); header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight()); final UGraphic ug2 = UGraphicStencil.create(ug, this, stroke); fields.drawU(ug2.apply(UTranslate.dy(dimTitle.getHeight()))); - if (url != null) { + if (url != null) ug.closeUrl(); - } ug.closeGroup(); } private UStroke getStroke() { UStroke stroke = lineConfig.getColors().getSpecificLineStroke(); - if (stroke == null) { + if (stroke == null) stroke = getSkinParam().getThickness(LineParam.objectBorder, getStereo()); - } - if (stroke == null) { + + if (stroke == null) stroke = new UStroke(1.5); - } + return stroke; } private double getMethodOrFieldHeight(final Dimension2D dim) { final double fieldsHeight = dim.getHeight(); - if (fieldsHeight == 0) { + if (fieldsHeight == 0) return marginEmptyFieldsOrMethod; - } + return fieldsHeight; } @@ -243,9 +248,9 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W } public ShapeType getShapeType() { - if (((ILeaf) getEntity()).getPortShortNames().size() > 0) { + if (((ILeaf) getEntity()).getPortShortNames().size() > 0) return ShapeType.RECTANGLE_HTML_FOR_PORTS; - } + return ShapeType.RECTANGLE; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImagePort.java b/src/net/sourceforge/plantuml/svek/image/EntityImagePort.java index 32f50b128..27cf22275 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImagePort.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImagePort.java @@ -44,10 +44,15 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.cucadiagram.EntityPosition; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Cluster; import net.sourceforge.plantuml.svek.ShapeType; @@ -60,8 +65,16 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImagePort extends AbstractEntityImageBorder { - public EntityImagePort(ILeaf leaf, ISkinParam skinParam, Cluster parent, final Bibliotekon bibliotekon) { + + private final SName sname; + + public EntityImagePort(ILeaf leaf, ISkinParam skinParam, Cluster parent, Bibliotekon bibliotekon, SName sname) { super(leaf, skinParam, parent, bibliotekon, FontParam.BOUNDARY); + this.sname = sname; + } + + private StyleSignature getSignature() { + return StyleSignature.of(SName.root, SName.element, sname, SName.boundary); } private boolean upPosition() { @@ -90,24 +103,39 @@ public class EntityImagePort extends AbstractEntityImageBorder { final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder()); final double x = 0 - (dimDesc.getWidth() - 2 * EntityPosition.RADIUS) / 2; - if (upPosition()) { + if (upPosition()) y -= 2 * EntityPosition.RADIUS + dimDesc.getHeight(); - } else { + else y += 2 * EntityPosition.RADIUS; - } + desc.drawU(ug.apply(new UTranslate(x, y))); - ug = ug.apply(new UStroke(1.5)) - .apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder).bg()); HColor backcolor = getEntity().getColors().getColor(ColorType.BACK); - if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); + final HColor borderColor; + + if (UseStyle.useBetaStyle()) { + final Style style = getSignature().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + if (backcolor == null) + backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + } else { + borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder); + if (backcolor == null) + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } + ug = ug.apply(backcolor); + ug = ug.apply(getUStroke()).apply(borderColor.bg()); drawSymbol(ug); } + private UStroke getUStroke() { + return new UStroke(1.5); + } + public ShapeType getShapeType() { return ShapeType.RECTANGLE; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java index da07ed304..0d3e24ea2 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageStateBorder.java @@ -42,9 +42,14 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.cucadiagram.EntityPosition; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Cluster; import net.sourceforge.plantuml.svek.SvekNode; @@ -55,15 +60,22 @@ import net.sourceforge.plantuml.ugraphic.color.HColor; public class EntityImageStateBorder extends AbstractEntityImageBorder { - public EntityImageStateBorder(ILeaf leaf, ISkinParam skinParam, Cluster stateParent, - final Bibliotekon bibliotekon) { + private final SName sname; + + public EntityImageStateBorder(ILeaf leaf, ISkinParam skinParam, Cluster stateParent, final Bibliotekon bibliotekon, + SName sname) { super(leaf, skinParam, stateParent, bibliotekon, FontParam.STATE); + this.sname = sname; + } + + private StyleSignature getSignature() { + return StyleSignature.of(SName.root, SName.element, sname); } private boolean upPosition() { - if (parent == null) { + if (parent == null) return false; - } + final Point2D clusterCenter = parent.getClusterPosition().getPointCenter(); final SvekNode node = bibliotekon.getNode(getEntity()); return node.getMinY() < clusterCenter.getY(); @@ -73,22 +85,37 @@ public class EntityImageStateBorder extends AbstractEntityImageBorder { double y = 0; final Dimension2D dimDesc = desc.calculateDimension(ug.getStringBounder()); final double x = 0 - (dimDesc.getWidth() - 2 * EntityPosition.RADIUS) / 2; - if (upPosition()) { + if (upPosition()) y -= 2 * EntityPosition.RADIUS + dimDesc.getHeight(); - } else { + else y += 2 * EntityPosition.RADIUS; - } + desc.drawU(ug.apply(new UTranslate(x, y))); - ug = ug.apply(new UStroke(1.5)) - .apply(SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder)); HColor backcolor = getEntity().getColors().getColor(ColorType.BACK); - if (backcolor == null) { - backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); + final HColor borderColor; + + if (UseStyle.useBetaStyle()) { + final Style style = getSignature().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + if (backcolor == null) + backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), + getSkinParam().getIHtmlColorSet()); + } else { + borderColor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBorder); + if (backcolor == null) + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.stateBackground); } + + ug = ug.apply(getUStroke()).apply(borderColor); ug = ug.apply(backcolor.bg()); entityPosition.drawSymbol(ug, rankdir); } + private UStroke getUStroke() { + return new UStroke(1.5); + } + } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java b/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java index a52695801..c7eea50e1 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageSynchroBar.java @@ -66,14 +66,14 @@ public class EntityImageSynchroBar extends AbstractEntityImage { // this.styleName = styleName; } - private StyleSignature getDefaultStyleDefinitionBar() { - return StyleSignature.of(SName.root, SName.element, SName.activityBar); + private StyleSignature getStyleSignature() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activityBar); } public Dimension2D calculateDimension(StringBounder stringBounder) { - if (getSkinParam().getRankdir() == Rankdir.LEFT_TO_RIGHT) { + if (getSkinParam().getRankdir() == Rankdir.LEFT_TO_RIGHT) return new Dimension2DDouble(8, 80); - } + return new Dimension2DDouble(80, 8); } @@ -81,16 +81,18 @@ public class EntityImageSynchroBar extends AbstractEntityImage { final Dimension2D dim = calculateDimension(ug.getStringBounder()); final Shadowable rect = new URectangle(dim.getWidth(), dim.getHeight()); double shadowing = 0; - if (getSkinParam().shadowing(getEntity().getStereotype())) { - shadowing = 4; - } + HColor color = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.activityBar); if (UseStyle.useBetaStyle()) { - final Style style = getDefaultStyleDefinitionBar().with(getEntity().getStereotype()) + final Style style = getStyleSignature().with(getEntity().getStereotype()) .getMergedStyle(getSkinParam().getCurrentStyleBuilder()); color = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()); shadowing = style.value(PName.Shadowing).asDouble(); + } else { + if (getSkinParam().shadowing(getEntity().getStereotype())) + shadowing = 4; + } rect.setDeltaShadow(shadowing); ug.apply(new HColorNone()).apply(color.bg()).draw(rect); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java index 2639c506a..788ba2cc8 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageTips.java @@ -81,6 +81,7 @@ public class EntityImageTips extends AbstractEntityImage { private final HColor borderColor; private final Bibliotekon bibliotekon; + private final Style style; private final double ySpacing = 10; @@ -90,27 +91,24 @@ public class EntityImageTips extends AbstractEntityImage { this.bibliotekon = bibliotekon; if (UseStyle.useBetaStyle()) { - final Style style = getDefaultStyleDefinition(type.getStyleName()) - .getMergedStyle(skinParam.getCurrentStyleBuilder()); + style = getDefaultStyleDefinition(type.getStyleName()).getMergedStyle(skinParam.getCurrentStyleBuilder()); - if (entity.getColors().getColor(ColorType.BACK) == null) { + if (entity.getColors().getColor(ColorType.BACK) == null) this.noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); - - } else { + else this.noteBackgroundColor = entity.getColors().getColor(ColorType.BACK); - } this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } else { + style = null; - if (entity.getColors().getColor(ColorType.BACK) == null) { + if (entity.getColors().getColor(ColorType.BACK) == null) this.noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - } else { + else this.noteBackgroundColor = entity.getColors().getColor(ColorType.BACK); - } this.borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); @@ -122,9 +120,9 @@ public class EntityImageTips extends AbstractEntityImage { } private Position getPosition() { - if (getEntity().getCodeGetName().endsWith(Position.RIGHT.name())) { + if (getEntity().getCodeGetName().endsWith(Position.RIGHT.name())) return Position.RIGHT; - } + return Position.LEFT; } @@ -166,21 +164,21 @@ public class EntityImageTips extends AbstractEntityImage { final Display display = ent.getValue(); final Rectangle2D memberPosition = nodeOther.getImage().getInnerPosition(ent.getKey(), stringBounder, InnerStrategy.STRICT); - if (memberPosition == null) { + if (memberPosition == null) return; - } + final Opale opale = getOpale(display); final Dimension2D dim = opale.calculateDimension(stringBounder); final Point2D pp1 = new Point2D.Double(0, dim.getHeight() / 2); double x = positionOther.getX() - positionMe.getX(); - if (direction == Direction.RIGHT && x < 0) { + if (direction == Direction.RIGHT && x < 0) direction = direction.getInv(); - } - if (direction == Direction.LEFT) { + + if (direction == Direction.LEFT) x += memberPosition.getMaxX(); - } else { + else x += 4; - } + final double y = positionOther.getY() - positionMe.getY() - height + memberPosition.getCenterY(); final Point2D pp2 = new Point2D.Double(x, y); opale.setOpale(direction, pp1, pp2); @@ -193,12 +191,19 @@ public class EntityImageTips extends AbstractEntityImage { } private Opale getOpale(final Display display) { - final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + final FontConfiguration fc; + final double shadowing; + if (UseStyle.useBetaStyle()) { + shadowing = style.value(PName.Shadowing).asDouble(); + fc = style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + } else { + shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0; + fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + } + final TextBlock textBlock = BodyFactory.create3(display, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, fc, LineBreakStrategy.NONE); - final double shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0; - final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, textBlock, true); - return opale; + return new Opale(shadowing, borderColor, noteBackgroundColor, textBlock, true); } } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java index a836d5411..cf34ae432 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java @@ -123,9 +123,9 @@ public class EntityImageUseCase extends AbstractEntityImage { return style.getStroke(); } UStroke stroke = getSkinParam().getThickness(LineParam.usecaseBorder, getStereo()); - if (stroke == null) { + if (stroke == null) stroke = new UStroke(1.5); - } + final Colors colors = getEntity().getColors(); stroke = colors.muteStroke(stroke); return stroke; @@ -137,14 +137,20 @@ public class EntityImageUseCase extends AbstractEntityImage { final public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - final TextBlockInEllipse ellipse = new TextBlockInEllipse(desc, stringBounder); - if (getSkinParam().shadowing2(getEntity().getStereotype(), SkinParameter.USECASE)) { - ellipse.setDeltaShadow(3); - } - if (url != null) { + double shadow = 0; + + if (UseStyle.useBetaStyle()) { + final Style style = getStyle(); + shadow = style.value(PName.Shadowing).asDouble(); + } else if (getSkinParam().shadowing2(getEntity().getStereotype(), SkinParameter.USECASE)) + shadow = 3; + + final TextBlockInEllipse ellipse = new TextBlockInEllipse(desc, stringBounder); + ellipse.setDeltaShadow(shadow); + + if (url != null) ug.startUrl(url); - } ug = ug.apply(getStroke()); final HColor linecolor = getLineColor(); @@ -157,13 +163,12 @@ public class EntityImageUseCase extends AbstractEntityImage { ellipse.drawU(ug2); ug2.closeGroup(); - if (getEntity().getLeafType() == LeafType.USECASE_BUSINESS) { + if (getEntity().getLeafType() == LeafType.USECASE_BUSINESS) specialBusiness(ug, ellipse.getUEllipse()); - } - if (url != null) { + if (url != null) ug.closeUrl(); - } + } private void specialBusiness(UGraphic ug, UEllipse frontier) { @@ -256,13 +261,13 @@ public class EntityImageUseCase extends AbstractEntityImage { } private double getNormalized(double y) { - if (y < yTheoricalPosition) { + if (y < yTheoricalPosition) throw new IllegalArgumentException(); - } + y = y - yTheoricalPosition; - if (y > ellipse.getHeight()) { + if (y > ellipse.getHeight()) throw new IllegalArgumentException(); - } + return y; } diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java index 247e8ff81..1291fa782 100644 --- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java +++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java @@ -669,7 +669,7 @@ public class SvgGraphics { final int maxXscaled = (int) (maxX * scale); final int maxYscaled = (int) (maxY * scale); String style = "width:" + maxXscaled + "px;height:" + maxYscaled + "px;"; - if (backcolor != null) + if (this.classesForDarkness.size() == 0 && backcolor != null) style += "background:" + backcolor + ";"; if (svgDimensionStyle) { @@ -736,8 +736,8 @@ public class SvgGraphics { final Element elt = (Element) document.createElement("path"); elt.setAttribute("d", sb.toString()); elt.setAttribute("style", getStyle()); - manageDarkStroke(elt); fillMe(elt); + manageDarkStroke(elt); final String id = path.getComment(); if (id != null) elt.setAttribute("id", id); @@ -770,6 +770,9 @@ public class SvgGraphics { return; if (fill.equals(fillDark) == false) { + if (elt.getAttribute("class") != null && elt.getAttribute("class").length() != 0) + throw new IllegalStateException(); + elt.setAttribute("class", getFillClassForDark()); return; } diff --git a/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java b/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java index bb3f21514..4c366499d 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java +++ b/src/net/sourceforge/plantuml/timingdiagram/ChangeState.java @@ -35,9 +35,13 @@ */ package net.sourceforge.plantuml.timingdiagram; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; @@ -79,22 +83,29 @@ public class ChangeState implements Comparable { return comment; } - public final HColor getBackColor() { + public final HColor getBackColor(ISkinParam skinParam, Style style) { if (colors == null || colors.getColor(ColorType.BACK) == null) { - return HColorUtils.COL_D7E0F2; + if (UseStyle.useBetaStyle() == false) + return HColorUtils.COL_D7E0F2; + + return style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } return colors.getColor(ColorType.BACK); } - private final HColor getLineColor() { + private final HColor getLineColor(ISkinParam skinParam, Style style) { if (colors == null || colors.getColor(ColorType.LINE) == null) { - return HColorUtils.COL_038048; + if (UseStyle.useBetaStyle() == false) + return HColorUtils.COL_038048; + + return style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } return colors.getColor(ColorType.LINE); } - public SymbolContext getContext() { - return new SymbolContext(getBackColor(), getLineColor()).withStroke(new UStroke(1.5)); + public SymbolContext getContext(ISkinParam skinParam, Style style) { + return new SymbolContext(getBackColor(skinParam, style), getLineColor(skinParam, style)) + .withStroke(new UStroke(1.5)); } public final boolean isBlank() { diff --git a/src/net/sourceforge/plantuml/timingdiagram/Highlight.java b/src/net/sourceforge/plantuml/timingdiagram/Highlight.java index 74a3661fa..6cc743191 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Highlight.java +++ b/src/net/sourceforge/plantuml/timingdiagram/Highlight.java @@ -36,12 +36,17 @@ package net.sourceforge.plantuml.timingdiagram; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -57,18 +62,32 @@ public class Highlight { private final TimeTick tickTo; private final Display caption; private final Colors colors; + private final ISkinParam skinParam; - public Highlight(TimeTick tickFrom, TimeTick tickTo, Display caption, Colors colors) { + public Highlight(ISkinParam skinParam, TimeTick tickFrom, TimeTick tickTo, Display caption, Colors colors) { this.tickFrom = tickFrom; this.tickTo = tickTo; this.caption = caption; this.colors = colors; + this.skinParam = skinParam; + } + + private StyleSignature getStyleSignature() { + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram, SName.highlight); + } + + private Style getStyle() { + return getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + } private HColor getBackColor() { final HColor result = colors.getColor(ColorType.BACK); if (result == null) { - return HColorUtils.COL_A9DCDF; + if (UseStyle.useBetaStyle() == false) + return HColorUtils.COL_A9DCDF; + return getStyle().value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); } return result; } @@ -76,11 +95,19 @@ public class Highlight { private HColor getLineColor() { final HColor result = colors.getColor(ColorType.LINE); if (result == null) { - return HColorUtils.BLACK; + if (UseStyle.useBetaStyle() == false) + return HColorUtils.BLACK; + return getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } return result; } + private UStroke getUStroke() { + if (UseStyle.useBetaStyle() == false) + return new UStroke(4, 4, 2); + return getStyle().getStroke(); + } + public final TimeTick getTickFrom() { return tickFrom; } @@ -107,7 +134,7 @@ public class Highlight { } public void drawHighlightsLines(UGraphic ug, TimingRuler ruler, double height) { - ug = ug.apply(new UStroke(4, 4, 2)); + ug = ug.apply(getUStroke()); ug = ug.apply(getLineColor()); final ULine line = ULine.vline(height); final double start = ruler.getPosInPixel(this.getTickFrom()); diff --git a/src/net/sourceforge/plantuml/timingdiagram/Player.java b/src/net/sourceforge/plantuml/timingdiagram/Player.java index 611a02fd2..542c045bb 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Player.java +++ b/src/net/sourceforge/plantuml/timingdiagram/Player.java @@ -36,14 +36,23 @@ package net.sourceforge.plantuml.timingdiagram; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public abstract class Player implements TimeProjected { @@ -64,8 +73,41 @@ public abstract class Player implements TimeProjected { return compact; } + protected abstract StyleSignature getStyleSignature(); + + protected abstract SymbolContext getContextLegacy(); +// private StyleSignature getStyleSignature() { +// return StyleSignature.of(SName.root, SName.element, SName.timingDiagram); +// } + + final protected Style getStyle() { + return getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + + } + final protected FontConfiguration getFontConfiguration() { - return new FontConfiguration(skinParam, FontParam.TIMING, null); + if (UseStyle.useBetaStyle() == false) + return new FontConfiguration(skinParam, FontParam.TIMING, null); + return new FontConfiguration(skinParam, StyleSignature.of(SName.root, SName.element, SName.timingDiagram) + .getMergedStyle(skinParam.getCurrentStyleBuilder())); + } + + final protected UStroke getStroke() { + final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + return style.getStroke(); + } + + final protected SymbolContext getContext() { + if (UseStyle.useBetaStyle() == false) + return getContextLegacy(); + + final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + final HColor lineColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); + final HColor backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); + + return new SymbolContext(backgroundColor, lineColor).withStroke(getStroke()); } final protected TextBlock getTitle() { diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java index 988c9cbec..20af2c5d3 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java @@ -52,6 +52,8 @@ import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -74,23 +76,23 @@ public class PlayerAnalog extends Player { } private double getMin() { - if (start != null) { + if (start != null) return start; - } + return 0; } private double getMax() { - if (end != null) { + if (end != null) return end; - } + double max = 0; - for (Double val : values.values()) { + for (Double val : values.values()) max = Math.max(max, val); - } - if (max == 0) { + + if (max == 0) return 10; - } + return max; } @@ -98,7 +100,8 @@ public class PlayerAnalog extends Player { return suggestedHeight; } - private SymbolContext getContext() { + @Override + protected SymbolContext getContextLegacy() { return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); } @@ -110,16 +113,16 @@ public class PlayerAnalog extends Player { private double getValueAt(TimeTick tick) { final Double result = values.get(tick); - if (result != null) { + if (result != null) return result; - } + Entry last = null; for (Entry ent : values.entrySet()) { if (ent.getKey().compareTo(tick) > 0) { final double v2 = ent.getValue(); - if (last == null) { + if (last == null) return v2; - } + final double t2 = ent.getKey().getTime().doubleValue(); final double v1 = last.getValue(); final double t1 = last.getKey().getTime().doubleValue(); @@ -141,14 +144,14 @@ public class PlayerAnalog extends Player { public void setState(TimeTick now, String comment, Colors color, String... valueString) { final double value = getState(valueString[0]); - if (now == null) { + if (now == null) this.initialState = value; - } else { + else this.values.put(now, value); - } - if (this.initialState == null) { + + if (this.initialState == null) this.initialState = value; - } + } private double getState(String value) { @@ -185,17 +188,16 @@ public class PlayerAnalog extends Player { } private double getMaxWidthForTicks(StringBounder stringBounder) { - if (ticksEvery == null) { + if (ticksEvery == null) return Math.max(getWidthLabel(stringBounder, getMin()), getWidthLabel(stringBounder, getMax())); - } + double result = 0; final int first = (int) Math.ceil(getMin()); final int last = (int) Math.floor(getMax()); - for (int i = first; i <= last; i++) { - if (i % ticksEvery == 0) { + for (int i = first; i <= last; i++) + if (i % ticksEvery == 0) result = Math.max(result, getWidthLabel(stringBounder, i)); - } - } + return result; } @@ -212,11 +214,10 @@ public class PlayerAnalog extends Player { } else { final int first = (int) Math.ceil(getMin()); final int last = (int) Math.floor(getMax()); - for (int i = first; i <= last; i++) { - if (i % ticksEvery == 0) { + for (int i = first; i <= last; i++) + if (i % ticksEvery == 0) drawScaleLabel(ug.apply(UTranslate.dy(specialVSpace)), i, fullAvailableWidth); - } - } + } } @@ -240,24 +241,22 @@ public class PlayerAnalog extends Player { } private void drawTickHlines(UGraphic ug) { - ug = TimingRuler.applyForVLines(ug); + ug = TimingRuler.applyForVLines(ug, getStyle(), skinParam); final int first = (int) Math.ceil(getMin()); final int last = (int) Math.floor(getMax()); final ULine hline = ULine.hline(ruler.getWidth()); - for (int i = first; i <= last; i++) { - if (i % ticksEvery == 0) { + for (int i = first; i <= last; i++) + if (i % ticksEvery == 0) ug.apply(UTranslate.dy(getYpos(i))).draw(hline); - } - } } public UDrawable getPart2() { return new UDrawable() { public void drawU(UGraphic ug) { - if (ticksEvery != null) { + if (ticksEvery != null) drawTickHlines(ug); - } + ug = getContext().apply(ug); double lastx = 0; double lastValue = initialState == null ? 0 : initialState; @@ -283,4 +282,9 @@ public class PlayerAnalog extends Player { this.ticksEvery = ticksEvery; } + @Override + protected StyleSignature getStyleSignature() { + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram); + } + } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java index 549592288..e26d877fb 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java @@ -52,6 +52,8 @@ import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -78,7 +80,13 @@ public class PlayerBinary extends Player { return getHeightForConstraints(stringBounder) + suggestedHeight; } - private SymbolContext getContext() { + @Override + protected StyleSignature getStyleSignature() { + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram, SName.clock); + } + + @Override + protected SymbolContext getContextLegacy() { return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java index abf428b4f..4ee94c829 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerClock.java @@ -37,16 +37,22 @@ package net.sourceforge.plantuml.timingdiagram; import java.awt.geom.Dimension2D; import java.math.BigDecimal; +import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; +import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; import net.sourceforge.plantuml.timingdiagram.graphic.PlayerFrame; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -87,10 +93,15 @@ public class PlayerClock extends Player { return 0; } - private SymbolContext getContext() { + @Override + protected SymbolContext getContextLegacy() { return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); } + protected StyleSignature getStyleSignature() { + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram, SName.clock); + } + public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { throw new UnsupportedOperationException(); } @@ -120,7 +131,7 @@ public class PlayerClock extends Player { return new AbstractTextBlock() { public void drawU(UGraphic ug) { - new PlayerFrame(getTitle()).drawFrameTitle(ug); + new PlayerFrame(getTitle(), skinParam).drawFrameTitle(ug); } public Dimension2D calculateDimension(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java index 352b3e6e7..cfbf3e612 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java @@ -43,13 +43,18 @@ import java.util.Set; import java.util.TreeSet; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.timingdiagram.graphic.Histogram; import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; import net.sourceforge.plantuml.timingdiagram.graphic.PDrawing; @@ -77,13 +82,32 @@ public final class PlayerRobustConcise extends Player { this.suggestedHeight = 0; } + @Override + protected StyleSignature getStyleSignature() { + if (type == TimingStyle.CONCISE) + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram, SName.concise); + if (type == TimingStyle.ROBUST) + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram, SName.robust); + throw new IllegalStateException(); + } + + @Override + protected SymbolContext getContextLegacy() { + throw new UnsupportedOperationException(); + } + private PDrawing buildPDrawing() { - if (type == TimingStyle.CONCISE) { - return new Ribbon(ruler, skinParam, notes, isCompact(), getTitle(), suggestedHeight); - } + final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + if (type == TimingStyle.CONCISE) + return new Ribbon(ruler, skinParam, notes, isCompact(), getTitle(), suggestedHeight, style); + if (type == TimingStyle.ROBUST) { - return new Histogram(ruler, skinParam, statesLabel.values(), isCompact(), getTitle(), suggestedHeight); + final Style style0 = StyleSignature.of(SName.root, SName.element, SName.timingDiagram) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + return new Histogram(ruler, skinParam, statesLabel.values(), isCompact(), getTitle(), suggestedHeight, + style, style0); } + throw new IllegalStateException(); } @@ -91,9 +115,9 @@ public final class PlayerRobustConcise extends Player { return new AbstractTextBlock() { public void drawU(UGraphic ug) { - if (isCompact() == false) { - new PlayerFrame(getTitle()).drawFrameTitle(ug); - } + if (isCompact() == false) + new PlayerFrame(getTitle(), skinParam).drawFrameTitle(ug); + ug = ug.apply(getTranslateForTimeDrawing(ug.getStringBounder())).apply(UTranslate.dy(specialVSpace)); getTimeDrawing().getPart1(fullAvailableWidth).drawU(ug); } @@ -122,28 +146,28 @@ public final class PlayerRobustConcise extends Player { } private double getTitleHeight(StringBounder stringBounder) { - if (isCompact()) { + if (isCompact()) return 6; - } + return getTitle().calculateDimension(stringBounder).getHeight() + 6; } private PDrawing getTimeDrawing() { - if (cached == null) { + if (cached == null) cached = computeTimeDrawing(); - } + return cached; } private PDrawing computeTimeDrawing() { final PDrawing result = buildPDrawing(); result.setInitialState(initialState, initialColors); - for (ChangeState change : changes) { + for (ChangeState change : changes) result.addChange(change); - } - for (TimeConstraint constraint : constraints) { + + for (TimeConstraint constraint : constraints) result.addConstraint(constraint); - } + return result; } @@ -152,9 +176,9 @@ public final class PlayerRobustConcise extends Player { } public final void setState(TimeTick now, String comment, Colors color, String... states) { - for (int i = 0; i < states.length; i++) { + for (int i = 0; i < states.length; i++) states[i] = decodeState(states[i]); - } + if (now == null) { this.initialState = states[0]; this.initialColors = color; @@ -166,17 +190,17 @@ public final class PlayerRobustConcise extends Player { private String decodeState(String code) { final String label = statesLabel.get(code); - if (label == null) { + if (label == null) return code; - } + return label; } public final IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { final IntricatedPoint point = getTimeDrawing().getTimeProjection(stringBounder, tick); - if (point == null) { + if (point == null) return null; - } + final UTranslate translation = getTranslateForTimeDrawing(stringBounder); return point.translated(translation); } @@ -186,7 +210,14 @@ public final class PlayerRobustConcise extends Player { } public final void addNote(TimeTick now, Display note, Position position) { - this.notes.add(new TimingNote(now, this, note, position, skinParam)); + Style style = null; + if (UseStyle.useBetaStyle()) { + final StyleSignature signature = StyleSignature.of(SName.root, SName.element, SName.timingDiagram, + SName.note); + style = signature.getMergedStyle(skinParam.getCurrentStyleBuilder()); + } + + this.notes.add(new TimingNote(now, this, note, position, skinParam, style)); } public final void defineState(String stateCode, String label) { diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java index 3cbdd1a93..c6d9bc9ae 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Objects; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; @@ -97,8 +98,11 @@ public class TimeConstraint { } private FontConfiguration getFontConfiguration() { - final UFont font = UFont.serif(14); - return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLUE, false); + if (UseStyle.useBetaStyle() == false) { + final UFont font = UFont.serif(14); + return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLUE, false); + } + return getStyle().getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } public void drawU(UGraphic ug, TimingRuler ruler) { @@ -119,9 +123,9 @@ public class TimeConstraint { } private HColor getArrowColor() { - if (styleBuilder == null) { + if (UseStyle.useBetaStyle() == false) return HColorUtils.MY_RED; - } + return getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } @@ -130,9 +134,9 @@ public class TimeConstraint { } private UStroke getUStroke() { - if (styleBuilder == null) { + if (UseStyle.useBetaStyle() == false) return new UStroke(1.5); - } + return getStyle().getStroke(); } @@ -165,14 +169,13 @@ public class TimeConstraint { } public static double getHeightForConstraints(StringBounder stringBounder, List constraints) { - if (constraints.size() == 0) { + if (constraints.size() == 0) return 0; - } + double result = 0; - for (TimeConstraint constraint : constraints) { + for (TimeConstraint constraint : constraints) result = Math.max(result, constraint.getConstraintHeight(stringBounder)); - } return result; } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java index 1bd098b17..9fd038152 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java @@ -49,6 +49,8 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -58,6 +60,10 @@ import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.timingdiagram.graphic.IntricatedPoint; import net.sourceforge.plantuml.timingdiagram.graphic.TimeArrow; @@ -89,8 +95,8 @@ public class TimingDiagram extends UmlDiagram implements Clocks { return new DiagramDescription("(Timing Diagram)"); } - public TimingDiagram(UmlSource source) { - super(source, UmlDiagramType.TIMING); + public TimingDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.TIMING); } @Override @@ -127,14 +133,27 @@ public class TimingDiagram extends UmlDiagram implements Clocks { }; } + private StyleSignature getStyleSignature() { + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram); + } + + private HColor black() { + if (UseStyle.useBetaStyle() == false) + return HColorUtils.BLACK; + + final Style style = getStyleSignature().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + return style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()); + + } + private void drawInternal(UGraphic ug) { ruler.ensureNotEmpty(); final StringBounder stringBounder = ug.getStringBounder(); final double part1MaxWidth = getPart1MaxWidth(stringBounder); final UTranslate widthPart1 = UTranslate.dx(part1MaxWidth); - if (compactByDefault == false) { + if (compactByDefault == false) drawBorder(ug); - } + ug = ug.apply(UTranslate.dx(marginX1)); drawHighlightsBack(ug.apply(widthPart1)); @@ -145,33 +164,33 @@ public class TimingDiagram extends UmlDiagram implements Clocks { final UGraphic ugPlayer = ug.apply(getUTranslateForPlayer(player, stringBounder)); final double caption = getHeightForCaptions(stringBounder); if (first) { - if (player.isCompact() == false) { + if (player.isCompact() == false) drawHorizontalSeparator(ugPlayer); - } + player.getPart1(part1MaxWidth, caption).drawU(ugPlayer); player.getPart2().drawU(ugPlayer.apply(widthPart1).apply(UTranslate.dy(caption))); } else { - if (player.isCompact() == false) { + if (player.isCompact() == false) drawHorizontalSeparator(ugPlayer.apply(UTranslate.dy(caption))); - } + player.getPart1(part1MaxWidth, 0).drawU(ugPlayer.apply(UTranslate.dy(caption))); player.getPart2().drawU(ugPlayer.apply(widthPart1).apply(UTranslate.dy(caption))); } first = false; } ug = ug.apply(widthPart1); - if (this.drawTimeAxis) { + if (this.drawTimeAxis) ruler.drawTimeAxis(ug.apply(getLastTranslate(stringBounder))); - } - for (TimeMessage timeMessage : messages) { + + for (TimeMessage timeMessage : messages) drawMessages(ug, timeMessage); - } + drawHighlightsLines(ug); } private void drawHorizontalSeparator(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - ug = ug.apply(HColorUtils.BLACK); + ug = ug.apply(black()); ug = ug.apply(getBorderStroke()); ug = ug.apply(UTranslate.dx(-marginX1)); ug.draw(ULine.hline(getWidthTotal(stringBounder))); @@ -180,7 +199,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks { private void drawBorder(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final ULine border = ULine.vline(getLastTranslate(stringBounder).getDy()); - ug = ug.apply(HColorUtils.BLACK).apply(getBorderStroke()); + ug = ug.apply(black()).apply(getBorderStroke()); ug.draw(border); ug.apply(UTranslate.dx(getWidthTotal(stringBounder))).draw(border); } @@ -195,9 +214,9 @@ public class TimingDiagram extends UmlDiagram implements Clocks { private void drawHighlightsBack(UGraphic ug) { final double height = getHeightInner(ug.getStringBounder()); - for (Highlight highlight : highlights) { + for (Highlight highlight : highlights) highlight.drawHighlightsBack(ug, ruler, height); - } + } private void drawHighlightsLines(UGraphic ug) { @@ -232,10 +251,9 @@ public class TimingDiagram extends UmlDiagram implements Clocks { private double getPart1MaxWidth(StringBounder stringBounder) { double width = 0; - for (Player player : players.values()) { + for (Player player : players.values()) width = Math.max(width, player.getPart1(0, 0).calculateDimension(stringBounder).getWidth()); - } return width; } @@ -252,9 +270,8 @@ public class TimingDiagram extends UmlDiagram implements Clocks { final IntricatedPoint pt1 = player1.getTimeProjection(stringBounder, message.getTick1()); final IntricatedPoint pt2 = player2.getTimeProjection(stringBounder, message.getTick2()); - if (pt1 == null || pt2 == null) { + if (pt1 == null || pt2 == null) return; - } final TimeArrow timeArrow = TimeArrow.create(pt1.translated(translate1), pt2.translated(translate2), message.getLabel(), getSkinParam(), message); @@ -265,17 +282,17 @@ public class TimingDiagram extends UmlDiagram implements Clocks { private UTranslate getUTranslateForPlayer(Player candidat, StringBounder stringBounder) { double y = 0; for (Player player : players.values()) { - if (candidat == player) { + if (candidat == player) return UTranslate.dy(y); - } + // if (y == 0) { // y += getHeightHighlights(stringBounder); // } y += player.getFullHeight(stringBounder); } - if (candidat == null) { + if (candidat == null) return UTranslate.dy(y); - } + throw new IllegalArgumentException(); } @@ -319,9 +336,9 @@ public class TimingDiagram extends UmlDiagram implements Clocks { public void addTime(TimeTick time, String code) { this.now = time; ruler.addTime(time); - if (code != null) { + if (code != null) this.codes.put(code, time); - } + } public TimeTick getCodeValue(String code) { @@ -342,9 +359,9 @@ public class TimingDiagram extends UmlDiagram implements Clocks { public TimeTick getClockValue(String clockName, int nb) { final PlayerClock clock = clocks.get(clockName); - if (clock == null) { + if (clock == null) return null; - } + return new TimeTick(new BigDecimal(nb * clock.getPeriod()), TimingFormat.DECIMAL); } @@ -366,7 +383,7 @@ public class TimingDiagram extends UmlDiagram implements Clocks { } public CommandExecutionResult highlight(TimeTick tickFrom, TimeTick tickTo, Display caption, Colors colors) { - this.highlights.add(new Highlight(tickFrom, tickTo, caption, colors)); + this.highlights.add(new Highlight(getSkinParam(), tickFrom, tickTo, caption, colors)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java index f0e0cc244..f09dd8876 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagramFactory.java @@ -39,10 +39,11 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandFootboxIgnored; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.timingdiagram.command.CommandAnalog; import net.sourceforge.plantuml.timingdiagram.command.CommandAtPlayer; @@ -68,8 +69,8 @@ import net.sourceforge.plantuml.timingdiagram.command.CommandTimeMessage; public class TimingDiagramFactory extends PSystemCommandFactory { @Override - public TimingDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new TimingDiagram(source); + public TimingDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new TimingDiagram(style, source); } @Override diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java b/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java index 4fba3e6c9..0225dcf3e 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingNote.java @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineBreakStrategy; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.Parser; @@ -48,6 +49,8 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -60,8 +63,11 @@ public class TimingNote { private final Display note; private final Position position; private final ISkinParam skinParam; + private final Style style; - public TimingNote(TimeTick when, Player player, Display note, Position position, ISkinParam skinParam) { + public TimingNote(TimeTick when, Player player, Display note, Position position, ISkinParam skinParam, + Style style) { + this.style = style; this.note = note; this.player = player; this.when = when; @@ -70,25 +76,36 @@ public class TimingNote { } public void drawU(UGraphic ug) { - if (position == Position.BOTTOM) { + if (position == Position.BOTTOM) ug = ug.apply(UTranslate.dy(getMarginY() / 2)); - } + createOpale().drawU(ug); } private Opale createOpale() { - final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); - final Rose rose = new Rose(); - final HColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); - final HColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); - - final Sheet sheet = Parser.build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) + final double shadowing; + final FontConfiguration fc; + final HColor noteBackgroundColor; + final HColor borderColor; + if (UseStyle.useBetaStyle()) { + fc = new FontConfiguration(skinParam, style); + shadowing = style.value(PName.Shadowing).asDouble(); + borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); + } else { + shadowing = skinParam.shadowing(null) ? 4 : 0; + fc = new FontConfiguration(skinParam, FontParam.NOTE, null); + final Rose rose = new Rose(); + noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); + borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); + } + final Sheet sheet = Parser + .build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL) .createSheet(note); final SheetBlock1 sheet1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); - final double shadowing; - shadowing = skinParam.shadowing(null) ? 4 : 0; final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, sheet1, false); return opale; } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java index 2d09477c0..ff9fc368f 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java @@ -44,18 +44,24 @@ import java.util.TreeSet; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import net.sourceforge.plantuml.ugraphic.color.HColorSimple; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class TimingRuler { @@ -69,19 +75,24 @@ public class TimingRuler { private TimingFormat format = TimingFormat.DECIMAL; - static UGraphic applyForVLines(UGraphic ug) { + static UGraphic applyForVLines(UGraphic ug, Style style, ISkinParam skinParam) { final UStroke stroke = new UStroke(3, 5, 0.5); - final HColor color = HColorSet.instance().getColorOrWhite(ThemeStyle.LIGHT, "#AAA"); + final HColor color; + if (UseStyle.useBetaStyle()) + color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + else + color = HColorSet.instance().getColorOrWhite(ThemeStyle.LIGHT_REGULAR, "#AAA"); + return ug.apply(stroke).apply(color); } public void ensureNotEmpty() { - if (times.size() == 0) { + if (times.size() == 0) this.times.add(new TimeTick(BigDecimal.ZERO, TimingFormat.DECIMAL)); - } - if (getMax().getTime().signum() > 0 && getMin().getTime().signum() < 0) { + + if (getMax().getTime().signum() > 0 && getMin().getTime().signum() < 0) this.times.add(new TimeTick(BigDecimal.ZERO, TimingFormat.DECIMAL)); - } + } public TimingRuler(ISkinParam skinParam) { @@ -96,9 +107,9 @@ public class TimingRuler { } private long tickUnitary() { - if (tickUnitary == 0) { + if (tickUnitary == 0) return highestCommonFactor(); - } + return tickUnitary; } @@ -114,9 +125,9 @@ public class TimingRuler { final long candidate = computeHighestCommonFactor(highestCommonFactorInternal, tick); final double size = (getMax().getTime().doubleValue() - getMin().getTime().doubleValue()) / candidate; - if (size > 200) { + if (size > 200) return highestCommonFactorInternal; - } + highestCommonFactorInternal = candidate; } } @@ -132,17 +143,17 @@ public class TimingRuler { }); for (TimeTick time : times) { final long value = Math.abs(time.getTime().longValue()); - if (value > 0) { + if (value > 0) result.add(value); - } + } return result; } private int getNbTick() { - if (times.size() == 0) { + if (times.size() == 0) return 1; - } + final long delta = getMax().getTime().longValue() - getMin().getTime().longValue(); return Math.min(1000, (int) (1 + delta / tickUnitary())); } @@ -169,13 +180,21 @@ public class TimingRuler { public void addTime(TimeTick time) { this.highestCommonFactorInternal = -1; times.add(time); - if (time.getFormat() != TimingFormat.DECIMAL) { + if (time.getFormat() != TimingFormat.DECIMAL) this.format = time.getFormat(); - } + } private FontConfiguration getFontConfiguration() { - return new FontConfiguration(skinParam, FontParam.TIMING, null); + if (UseStyle.useBetaStyle() == false) + return new FontConfiguration(skinParam, FontParam.TIMING, null); + + return new FontConfiguration(skinParam, getStyle()); + } + + private Style getStyle() { + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram, SName.timeline) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); } private TextBlock getTimeTextBlock(long time) { @@ -184,7 +203,7 @@ public class TimingRuler { } public void drawTimeAxis(UGraphic ug) { - ug = ug.apply(new UStroke(2.0)).apply(HColorUtils.BLACK); + ug = ug.apply(new UStroke(2.0)).apply(black()); final double tickHeight = 5; final ULine line = ULine.vline(tickHeight); final double firstTickPosition = getPosInPixelInternal(getFirstPositiveOrZeroValue().doubleValue()); @@ -202,12 +221,21 @@ public class TimingRuler { } } + private HColor black() { + if (UseStyle.useBetaStyle() == false) + return HColorUtils.BLACK; + + final Style style = StyleSignature.of(SName.root, SName.element, SName.timingDiagram) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + return style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + + } + private BigDecimal getFirstPositiveOrZeroValue() { - for (TimeTick time : times) { - if (time.getTime().signum() >= 0) { + for (TimeTick time : times) + if (time.getTime().signum() >= 0) return time.getTime(); - } - } + throw new IllegalStateException(); } @@ -225,19 +253,19 @@ public class TimingRuler { result.add(round); } } - if (result.first() < 0 && result.last() > 0) { + if (result.first() < 0 && result.last() > 0) result.add(0L); - } + return result; } public void drawVlines(UGraphic ug, double height) { - ug = applyForVLines(ug); + ug = applyForVLines(ug, getStyle(), skinParam); final ULine line = ULine.vline(height); final int nb = getNbTick(); - for (int i = 0; i <= nb; i++) { + for (int i = 0; i <= nb; i++) ug.apply(UTranslate.dx(tickIntervalInPixels * i)).draw(line); - } + } public double getHeight(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java index d0e3ae801..af38ba445 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/Histogram.java @@ -45,6 +45,7 @@ import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -54,6 +55,10 @@ import net.sourceforge.plantuml.graphic.SymbolContext; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.timingdiagram.ChangeState; import net.sourceforge.plantuml.timingdiagram.TimeConstraint; import net.sourceforge.plantuml.timingdiagram.TimeTick; @@ -63,6 +68,7 @@ import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Histogram implements PDrawing { @@ -78,9 +84,13 @@ public class Histogram implements PDrawing { private String initialState; private final TextBlock title; private final int suggestedHeight; + private final Style style; + private final Style style0; public Histogram(TimingRuler ruler, ISkinParam skinParam, Collection someStates, boolean compact, - TextBlock title, int suggestedHeight) { + TextBlock title, int suggestedHeight, Style style, Style style0) { + this.style = style; + this.style0 = style0; this.suggestedHeight = suggestedHeight; this.ruler = ruler; this.skinParam = skinParam; @@ -93,9 +103,9 @@ public class Histogram implements PDrawing { public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { final double x = ruler.getPosInPixel(tick); final List states = getStatesAt(tick); - if (states.size() == 0) { + if (states.size() == 0) return null; - } + final double heightForConstraints = getHeightForConstraints(stringBounder); if (states.size() == 1) { final double y = yOfState(states.get(0)) + heightForConstraints; @@ -109,18 +119,18 @@ public class Histogram implements PDrawing { } private List getStatesAt(TimeTick tick) { - if (changes.size() == 0) { + if (changes.size() == 0) return Collections.emptyList(); - } + for (int i = 0; i < changes.size(); i++) { final int tickWithCurrentChangeTimeComparisonResult = changes.get(i).getWhen().compareTo(tick); if (tickWithCurrentChangeTimeComparisonResult == 0) { - if (i == 0 && initialState == null) { + if (i == 0 && initialState == null) return Arrays.asList(changes.get(i).getState()); - } - if (i == 0 && initialState != null) { + + if (i == 0 && initialState != null) return Arrays.asList(initialState, changes.get(i).getState()); - } + return Arrays.asList(changes.get(i - 1).getState(), changes.get(i).getState()); } if (tickWithCurrentChangeTimeComparisonResult > 0) { @@ -141,25 +151,24 @@ public class Histogram implements PDrawing { public void addChange(ChangeState change) { changes.add(change); - if (change.isCompletelyHidden()) { + if (change.isCompletelyHidden()) return; - } + final String[] states = change.getStates(); - for (String state : states) { - if (allStates.contains(state) == false) { + for (String state : states) + if (allStates.contains(state) == false) allStates.add(state); - } - } + } private Point2D[] getPoints(int n) { final ChangeState change = changes.get(n); final double x = ruler.getPosInPixel(change.getWhen()); final String[] states = change.getStates(); - if (states.length == 2) { + if (states.length == 2) return new Point2D[] { new Point2D.Double(x, yOfState(states[0])), new Point2D.Double(x, yOfState(states[1])) }; - } + return new Point2D[] { new Point2D.Double(x, yOfState(states[0])) }; } @@ -170,22 +179,41 @@ public class Histogram implements PDrawing { private double getPointMinY(int n) { final String[] states = changes.get(n).getStates(); - if (states.length == 2) { + if (states.length == 2) return Math.min(yOfState(states[0]), yOfState(states[1])); - } + return yOfState(states[0]); } private double getPointMaxY(int n) { final String[] states = changes.get(n).getStates(); - if (states.length == 2) { + if (states.length == 2) return Math.max(yOfState(states[0]), yOfState(states[1])); - } + return yOfState(states[0]); } + private FontConfiguration getFontConfiguration() { + if (UseStyle.useBetaStyle() == false) + return new FontConfiguration(skinParam, FontParam.TIMING, null); + + return new FontConfiguration(skinParam, style); + } + + private UStroke getStroke() { + return style.getStroke(); + } + private SymbolContext getContext() { - return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(1.5)); + if (UseStyle.useBetaStyle() == false) + return new SymbolContext(HColorUtils.COL_D7E0F2, HColorUtils.COL_038048).withStroke(new UStroke(2)); + + final HColor lineColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); + final HColor backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); + + return new SymbolContext(backgroundColor, lineColor).withStroke(getStroke()); } public TextBlock getPart1(final double fullAvailableWidth) { @@ -215,27 +243,28 @@ public class Histogram implements PDrawing { final Dimension2D dim = label.calculateDimension(stringBounder); width = Math.max(width, dim.getWidth()); } - if (initialState != null) { + if (initialState != null) width += getInitialWidth(); - } - if (compact) { + + if (compact) width += title.calculateDimension(stringBounder).getWidth() + 15; - } + return new Dimension2DDouble(width, getFullHeight(stringBounder)); } private void drawPart1(UGraphic ug, double fullAvailableWidth) { final StringBounder stringBounder = ug.getStringBounder(); ug = ug.apply(UTranslate.dy(getHeightForConstraints(stringBounder))); + if (compact) { final double titleHeight = title.calculateDimension(stringBounder).getHeight(); final double dy = (getFullHeight(stringBounder) - titleHeight) / 2; title.drawU(ug.apply(UTranslate.dy(dy))); } double width = getStatesWidth(stringBounder); - if (initialState != null) { + if (initialState != null) width += getInitialWidth(); - } + if (fullAvailableWidth > width + 5) ug = ug.apply(UTranslate.dx(fullAvailableWidth - width - 5)); else @@ -258,9 +287,9 @@ public class Histogram implements PDrawing { } private void drawPart2(UGraphic ug) { - if (changes.size() == 0) { + if (changes.size() == 0) return; - } + ug = getContext().apply(ug); ug = ug.apply(UTranslate.dy(getHeightForConstraints(ug.getStringBounder()))); drawHlines(ug); @@ -270,26 +299,24 @@ public class Histogram implements PDrawing { } private void drawHlines(UGraphic ug) { - if (initialState != null) { - for (Point2D pt : getPoints(0)) { + if (initialState != null) + for (Point2D pt : getPoints(0)) drawHLine(ug, getInitialPoint(), getInitialWidth() + pt.getX()); - } - } + for (int i = 0; i < changes.size(); i++) { - if (changes.get(i).isCompletelyHidden()) { + if (changes.get(i).isCompletelyHidden()) continue; - } + final double x2 = i < changes.size() - 1 ? getPointx(i + 1) : ruler.getWidth(); final double len = x2 - getPointx(i); final Point2D[] points = getPoints(i); - if (points.length == 2) { - drawHBlock(ug.apply(changes.get(i).getBackColor().bg()), points[0], points[1], len); - } - if (i < changes.size() - 1) { - for (Point2D pt : points) { + if (points.length == 2) + drawHBlock(ug.apply(changes.get(i).getBackColor(skinParam, style).bg()), points[0], points[1], len); + + if (i < changes.size() - 1) + for (Point2D pt : points) drawHLine(ug, pt, len); - } - } + } if (changes.get(changes.size() - 1).isCompletelyHidden() == false) { @@ -306,9 +333,8 @@ public class Histogram implements PDrawing { final Point2D pt = new Point2D.Double(pt1.getX(), minY); ug = ug.apply(new UTranslate(pt)); ug.draw(new URectangle(len, maxY - minY)); - for (double x = 0; x < len; x += 5) { + for (double x = 0; x < len; x += 5) ug.apply(UTranslate.dx(x)).draw(ULine.vline(maxY - minY)); - } } @@ -323,9 +349,9 @@ public class Histogram implements PDrawing { ug.apply(new UTranslate(current)).draw(ULine.vline(before.getY() - current.getY())); } for (int i = 1; i < changes.size(); i++) { - if (changes.get(i - 1).isCompletelyHidden() || changes.get(i).isCompletelyHidden()) { + if (changes.get(i - 1).isCompletelyHidden() || changes.get(i).isCompletelyHidden()) continue; - } + final double minY = Math.min(getPointMinY(i), getPointMinY(i - 1)); final double maxY = Math.max(getPointMaxY(i), getPointMaxY(i - 1)); ug.apply(new UTranslate(getPointx(i), minY)).draw(ULine.vline(maxY - minY)); @@ -336,9 +362,9 @@ public class Histogram implements PDrawing { for (int i = 0; i < changes.size(); i++) { final Point2D ptLabel = getPoints(i)[0]; final String comment = changes.get(i).getComment(); - if (comment == null) { + if (comment == null) continue; - } + final TextBlock label = getTextBlock(comment); final Dimension2D dim = label.calculateDimension(ug.getStringBounder()); label.drawU(ug.apply(new UTranslate(ptLabel).compose(new UTranslate(2, -dim.getHeight())))); @@ -348,11 +374,10 @@ public class Histogram implements PDrawing { private void drawConstraints(UGraphic ug) { for (TimeConstraint constraint : constraints) { double y = yOfState(constraint.getTick1()); - for (ChangeState change : changes) { - if (constraint.containsStrict(change.getWhen())) { + for (ChangeState change : changes) + if (constraint.containsStrict(change.getWhen())) y = Math.min(y, yOfState(change.getWhen())); - } - } + constraint.drawU(ug.apply(UTranslate.dy(y)), ruler); } } @@ -387,14 +412,10 @@ public class Histogram implements PDrawing { } private double stepHeight() { - if (suggestedHeight == 0 || allStates.size() <= 1) { + if (suggestedHeight == 0 || allStates.size() <= 1) return 20; - } - return suggestedHeight / (allStates.size() - 1); - } - private FontConfiguration getFontConfiguration() { - return new FontConfiguration(skinParam, FontParam.TIMING, null); + return suggestedHeight / (allStates.size() - 1); } private TextBlock getTextBlock(String value) { @@ -404,9 +425,9 @@ public class Histogram implements PDrawing { public void setInitialState(String initialState, Colors initialColors) { this.initialState = initialState; - if (initialState != null && allStates.contains(initialState) == false) { + if (initialState != null && allStates.contains(initialState) == false) allStates.add(initialState); - } + } private double getInitialWidth() { diff --git a/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java index 51092f0c0..be6676f68 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/PlayerFrame.java @@ -36,26 +36,54 @@ package net.sourceforge.plantuml.timingdiagram.graphic; import java.awt.geom.Dimension2D; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.timingdiagram.TimingDiagram; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PlayerFrame { + private final ISkinParam skinParam; private final TextBlock title; - public PlayerFrame(TextBlock title) { + public PlayerFrame(TextBlock title, ISkinParam skinParam) { this.title = title; + this.skinParam = skinParam; + } + + private StyleSignature getStyleSignature() { + return StyleSignature.of(SName.root, SName.element, SName.timingDiagram); + } + + private HColor getLineColor() { + if (UseStyle.useBetaStyle() == false) + return HColorUtils.BLACK; + + final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + return style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + } + + private UStroke getUStroke() { + if (UseStyle.useBetaStyle() == false) + return new UStroke(2.0); + final Style style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + return style.getStroke(); } public void drawFrameTitle(UGraphic ug) { title.drawU(ug); final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - ug = ug.apply(HColorUtils.BLACK).apply(new UStroke(1.0)); + ug = ug.apply(getLineColor()).apply(getUStroke()); final double widthTmp = dimTitle.getWidth() + 1; final double height = title.calculateDimension(ug.getStringBounder()).getHeight() + 1; drawLine(ug, -TimingDiagram.marginX1, height, widthTmp, height, widthTmp + 10, 0); diff --git a/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java index 9035a6b7c..3b02e63ba 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/Ribbon.java @@ -42,6 +42,7 @@ import java.util.List; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; @@ -54,6 +55,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.timingdiagram.ChangeState; import net.sourceforge.plantuml.timingdiagram.TimeConstraint; import net.sourceforge.plantuml.timingdiagram.TimeTick; @@ -77,9 +79,11 @@ public class Ribbon implements PDrawing { private final boolean compact; private final TextBlock title; private final int suggestedHeight; + private final Style style; public Ribbon(TimingRuler ruler, ISkinParam skinParam, List notes, boolean compact, TextBlock title, - int suggestedHeight) { + int suggestedHeight, Style style) { + this.style = style; this.suggestedHeight = suggestedHeight == 0 ? 24 : suggestedHeight; this.compact = compact; this.ruler = ruler; @@ -92,11 +96,10 @@ public class Ribbon implements PDrawing { final double x = ruler.getPosInPixel(tick); final double y = getHeightForConstraints(stringBounder) + getHeightForNotes(stringBounder, Position.TOP) + getHeightForTopComment(stringBounder) + getRibbonHeight() / 2; - for (ChangeState change : changes) { - if (change.getWhen().compareTo(tick) == 0) { + for (ChangeState change : changes) + if (change.getWhen().compareTo(tick) == 0) return new IntricatedPoint(new Point2D.Double(x, y), new Point2D.Double(x, y)); - } - } + return new IntricatedPoint(new Point2D.Double(x, y - getRibbonHeight() / 2), new Point2D.Double(x, y + getRibbonHeight() / 2)); } @@ -110,7 +113,10 @@ public class Ribbon implements PDrawing { } private FontConfiguration getFontConfiguration() { - return new FontConfiguration(skinParam, FontParam.TIMING, null); + if (UseStyle.useBetaStyle() == false) + return new FontConfiguration(skinParam, FontParam.TIMING, null); + return new FontConfiguration(skinParam, style); + } private TextBlock createTextBlock(String value) { @@ -130,9 +136,9 @@ public class Ribbon implements PDrawing { public Dimension2D calculateDimension(StringBounder stringBounder) { double width = getInitialWidth(stringBounder); - if (compact) { + if (compact) width += title.calculateDimension(stringBounder).getWidth() + 10; - } + return new Dimension2DDouble(width, getRibbonHeight()); } }; @@ -147,29 +153,28 @@ public class Ribbon implements PDrawing { } private void drawNotes(UGraphic ug, final Position position) { - for (TimingNote note : notes) { + for (TimingNote note : notes) if (note.getPosition() == position) { final double x = ruler.getPosInPixel(note.getWhen()); note.drawU(ug.apply(UTranslate.dx(x))); } - } } private double getInitialWidth(final StringBounder stringBounder) { - if (initialState == null) { + if (initialState == null) return 0; - } + return createTextBlock(initialState).calculateDimension(stringBounder).getWidth() + 24; } private void drawHexa(UGraphic ug, double len, ChangeState change) { - final HexaShape shape = HexaShape.create(len, getRibbonHeight(), change.getContext()); + final HexaShape shape = HexaShape.create(len, getRibbonHeight(), change.getContext(skinParam, style)); shape.drawU(ug); } private void drawFlat(UGraphic ug, double len, ChangeState change) { final ULine line = ULine.hline(len); - change.getContext().apply(ug).apply(UTranslate.dy(getRibbonHeight() / 2)).draw(line); + change.getContext(skinParam, style).apply(ug).apply(UTranslate.dy(getRibbonHeight() / 2)).draw(line); } private double getRibbonHeight() { @@ -177,16 +182,16 @@ public class Ribbon implements PDrawing { } private void drawPentaB(UGraphic ug, double len, ChangeState change) { - final PentaBShape shape = PentaBShape.create(len, getRibbonHeight(), change.getContext()); + final PentaBShape shape = PentaBShape.create(len, getRibbonHeight(), change.getContext(skinParam, style)); shape.drawU(ug); } private void drawPentaA(UGraphic ug, double len, ChangeState change) { - SymbolContext context = change.getContext(); + SymbolContext context = change.getContext(skinParam, style); final HColor back = initialColors.getColor(ColorType.BACK); - if (back != null) { + if (back != null) context = context.withBackColor(back); - } + final PentaAShape shape = PentaAShape.create(len, getRibbonHeight(), context); shape.drawU(ug); } @@ -197,11 +202,10 @@ public class Ribbon implements PDrawing { private double getHeightForNotes(StringBounder stringBounder, Position position) { double height = 0; - for (TimingNote note : notes) { - if (note.getPosition() == position) { + for (TimingNote note : notes) + if (note.getPosition() == position) height = Math.max(height, note.getHeight(stringBounder)); - } - } + return height; } @@ -269,20 +273,18 @@ public class Ribbon implements PDrawing { final double a = getPosInPixel(changes.get(i)); final double b = getPosInPixel(changes.get(i + 1)); assert b > a; - if (changes.get(i).isFlat()) { + if (changes.get(i).isFlat()) drawFlat(ug.apply(UTranslate.dx(a)), b - a, changes.get(i)); - } else if (changes.get(i).isCompletelyHidden() == false) { + else if (changes.get(i).isCompletelyHidden() == false) drawHexa(ug.apply(UTranslate.dx(a)), b - a, changes.get(i)); - } } if (changes.size() >= 1) { final ChangeState last = changes.get(changes.size() - 1); final double a = getPosInPixel(last); - if (last.isFlat()) { + if (last.isFlat()) drawFlat(ug.apply(UTranslate.dx(a)), ruler.getWidth() - a, last); - } else if (last.isCompletelyHidden() == false) { + else if (last.isCompletelyHidden() == false) drawPentaB(ug.apply(UTranslate.dx(a)), ruler.getWidth() - a, last); - } } } @@ -311,24 +313,23 @@ public class Ribbon implements PDrawing { } private TextBlock getCommentTopBlock(final ChangeState change) { - if (change.getComment() == null) { + if (change.getComment() == null) return TextBlockUtils.empty(0, 0); - } + return createTextBlock(change.getComment()); } private double getHeightForTopComment(StringBounder stringBounder) { double result = 0; - for (ChangeState change : changes) { + for (ChangeState change : changes) result = Math.max(result, getCommentTopBlock(change).calculateDimension(stringBounder).getHeight()); - } + return result; } private void drawConstraints(final UGraphic ug) { - for (TimeConstraint constraint : constraints) { + for (TimeConstraint constraint : constraints) constraint.drawU(ug, ruler); - } } } diff --git a/src/net/sourceforge/plantuml/timingdiagram/graphic/TimeArrow.java b/src/net/sourceforge/plantuml/timingdiagram/graphic/TimeArrow.java index cad384dea..e0f5ab2cb 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/graphic/TimeArrow.java +++ b/src/net/sourceforge/plantuml/timingdiagram/graphic/TimeArrow.java @@ -49,6 +49,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; public class TimeArrow implements UDrawable { @@ -109,12 +110,13 @@ public class TimeArrow implements UDrawable { private FontConfiguration getFontConfiguration() { final UFont font = UFont.serif(14); - return new FontConfiguration(font, type.getSpecificColor(), type.getSpecificColor(), false); + final HColor color = type.getSpecificColor(); + return new FontConfiguration(font, color, color, false); } public void drawU(UGraphic ug) { final double angle = getAngle(); - // ug = ug.apply(type.getSpecificColor()).apply(type.getType().getStroke3(new UStroke())); + ug = ug.apply(type.getSpecificColor()).apply(type.getUStroke()); final ULine line = new ULine(end.getX() - start.getX(), end.getY() - start.getY()); ug.apply(new UTranslate(start)).draw(line); diff --git a/src/net/sourceforge/plantuml/ugraphic/URectangle.java b/src/net/sourceforge/plantuml/ugraphic/URectangle.java index 07e0bf8b2..24faa6079 100644 --- a/src/net/sourceforge/plantuml/ugraphic/URectangle.java +++ b/src/net/sourceforge/plantuml/ugraphic/URectangle.java @@ -75,12 +75,12 @@ public class URectangle extends AbstractShadowable implements UShapeSized, UShap } public Shadowable diagonalCorner(double diagonalCorner) { - if (ignoreForCompressionOnX || ignoreForCompressionOnY) { + if (ignoreForCompressionOnX || ignoreForCompressionOnY) throw new IllegalStateException(); - } - if (diagonalCorner == 0) { + + if (diagonalCorner == 0) return this; - } + final UPath result = new UPath(); result.moveTo(diagonalCorner, 0); result.lineTo(width - diagonalCorner, 0); @@ -112,12 +112,12 @@ public class URectangle extends AbstractShadowable implements UShapeSized, UShap private URectangle(double width, double height, double rx, double ry, String comment, boolean ignoreForCompressionOnX, boolean ignoreForCompressionOnY, String codeLine) { - if (height == 0) { + if (height == 0) throw new IllegalArgumentException("height=" + height); - } - if (width == 0) { + + if (width == 0) throw new IllegalArgumentException("width=" + width); - } + this.ignoreForCompressionOnX = ignoreForCompressionOnX; this.ignoreForCompressionOnY = ignoreForCompressionOnY; this.comment = comment; @@ -182,12 +182,12 @@ public class URectangle extends AbstractShadowable implements UShapeSized, UShap } public boolean isIgnoreForCompressionOn(CompressionMode mode) { - if (mode == CompressionMode.ON_X) { + if (mode == CompressionMode.ON_X) return ignoreForCompressionOnX; - } - if (mode == CompressionMode.ON_Y) { + + if (mode == CompressionMode.ON_Y) return ignoreForCompressionOnY; - } + throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/style/ValueDeltaPriority.java b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperForceDark.java similarity index 51% rename from src/net/sourceforge/plantuml/style/ValueDeltaPriority.java rename to src/net/sourceforge/plantuml/ugraphic/color/ColorMapperForceDark.java index b4d6a656e..e2bb77545 100644 --- a/src/net/sourceforge/plantuml/style/ValueDeltaPriority.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/ColorMapperForceDark.java @@ -30,65 +30,35 @@ * * * Original Author: Arnaud Roques - * + * * */ -package net.sourceforge.plantuml.style; +package net.sourceforge.plantuml.ugraphic.color; -import net.sourceforge.plantuml.ThemeStyle; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.ugraphic.color.HColor; -import net.sourceforge.plantuml.ugraphic.color.HColorSet; +import java.awt.Color; -public class ValueDeltaPriority implements Value { +public class ColorMapperForceDark extends AbstractColorMapper implements ColorMapper { - private final Value orig; - private final int deltaPriority; - - public ValueDeltaPriority(Value orig, int deltaPriority) { - this.orig = orig; - this.deltaPriority = deltaPriority; + public Color toColor(HColor color) { + if (color == null) { + return null; + } + if (color instanceof HColorBackground) { + throw new UnsupportedOperationException(); + } + if (color instanceof HColorGradient) { + return toColor(((HColorGradient) color).getColor1()); + } + if (color instanceof HColorMiddle) { + return ((HColorMiddle) color).getMappedColor(this); + } + if (color instanceof HColorAutomatic) { + throw new IllegalStateException(); + } + if (color instanceof HColorAutomaticLegacy) { + throw new IllegalStateException(); + } + final HColor tmp = ((HColorSimple) color).darkSchemeTheme(); + return ((HColorSimple) tmp).getColor999(); } - - @Override - public String asString() { - return orig.asString(); - } - - @Override - public HColor asColor(ThemeStyle themeStyle, HColorSet colorSet) { - return orig.asColor(themeStyle, colorSet); - } - - @Override - public int asInt() { - return orig.asInt(); - } // TODO Auto-generated method stub - - - @Override - public double asDouble() { - return orig.asDouble(); - } - - @Override - public boolean asBoolean() { - return orig.asBoolean(); - } - - @Override - public int asFontStyle() { - return orig.asFontStyle(); - } - - @Override - public HorizontalAlignment asHorizontalAlignment() { - return orig.asHorizontalAlignment(); - } - - @Override - public int getPriority() { - return orig.getPriority() + deltaPriority; - } - -} \ No newline at end of file +} diff --git a/src/net/sourceforge/plantuml/ugraphic/color/HColorAutomatic.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorAutomatic.java index d28ffa36a..41f91ccf2 100644 --- a/src/net/sourceforge/plantuml/ugraphic/color/HColorAutomatic.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorAutomatic.java @@ -34,18 +34,13 @@ */ package net.sourceforge.plantuml.ugraphic.color; -import net.sourceforge.plantuml.ThemeStyle; - public class HColorAutomatic extends HColorAbstract implements HColor { private final HColor colorForLight; private final HColor colorForDark; private final HColor colorForTransparent; - private final ThemeStyle themeStyle; - public HColorAutomatic(ThemeStyle themeStyle, HColor colorForLight, HColor colorForDark, - HColor colorForTransparent) { - this.themeStyle = themeStyle; + public HColorAutomatic(HColor colorForLight, HColor colorForDark, HColor colorForTransparent) { this.colorForLight = colorForLight; this.colorForDark = colorForDark; this.colorForTransparent = colorForTransparent; @@ -53,14 +48,15 @@ public class HColorAutomatic extends HColorAbstract implements HColor { public HColor getAppropriateColor(HColor back) { if (back == null || HColorUtils.isTransparent(back)) { - if (colorForTransparent != null) { + if (colorForTransparent != null) return colorForTransparent; - } - return themeStyle == ThemeStyle.LIGHT ? colorForLight : colorForDark; + + return ((HColorSimple) colorForLight).withDark(colorForDark); + } - if (back.isDark()) { + if (back.isDark()) return colorForDark; - } + return colorForLight; } diff --git a/src/net/sourceforge/plantuml/ugraphic/color/HColorBackground.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorBackground.java index 4d500d610..89223335e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/color/HColorBackground.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorBackground.java @@ -44,6 +44,11 @@ public class HColorBackground extends HColorAbstract implements HColor { this.back = Objects.requireNonNull(back); } + @Override + public String toString() { + return "BACK " + back; + } + public HColor getNull() { return null; } diff --git a/src/net/sourceforge/plantuml/ugraphic/color/HColorSet.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorSet.java index 011774025..9fb866aa8 100644 --- a/src/net/sourceforge/plantuml/ugraphic/color/HColorSet.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorSet.java @@ -45,7 +45,7 @@ import java.util.Set; import java.util.TreeSet; import net.sourceforge.plantuml.StringUtils; -import net.sourceforge.plantuml.ThemeStyle; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; @@ -265,12 +265,11 @@ public class HColorSet { return true; } - HColorAutomatic buildInternal(ThemeStyle themeStyle, HColor background) { + HColorAutomatic buildInternal(HColor background) { if (colors.length == 2) - return new HColorAutomatic(themeStyle, build(colors[0], background), build(colors[1], background), - null); + return new HColorAutomatic(build(colors[0], background), build(colors[1], background), null); - return new HColorAutomatic(themeStyle, build(colors[0], background), build(colors[1], background), + return new HColorAutomatic(build(colors[0], background), build(colors[1], background), build(colors[2], background)); } @@ -303,40 +302,40 @@ public class HColorSet { } public HColor getColorOrWhite(String s) { - return getColorOrWhite(ThemeStyle.LIGHT, s, null); + return getColorOrWhite(null, s, null); } - public HColor getColorOrWhite(ThemeStyle themeStyle, String s) { - return getColorOrWhite(themeStyle, s, null); + public HColor getColorOrWhite(ThemeStyle UNUSED, String s) { + return getColorOrWhite(null, s, null); } - public HColor getColorOrWhite(ThemeStyle themeStyle, String s, HColor background) { + public HColor getColorOrWhite(ThemeStyle UNUSED, String s, HColor background) { if (isColorValid(Objects.requireNonNull(s)) == false) return HColorUtils.WHITE; try { - return getColor(themeStyle, s, background); + return getColor(null, s, background); } catch (NoSuchColorException e) { assert false; return HColorUtils.WHITE; } } - public HColor getColor(ThemeStyle themeStyle, String s) throws NoSuchColorException { - return getColor(themeStyle, s, null); + public HColor getColor(ThemeStyle UNUSED, String s) throws NoSuchColorException { + return getColor(null, s, null); } public HColor getColorLEGACY(String s) throws NoSuchColorException { - return getColor(ThemeStyle.LIGHT, s, null); + return getColor(null, s, null); } - public HColor getColor(ThemeStyle themeStyle, String s, HColor background) throws NoSuchColorException { + public HColor getColor(ThemeStyle UNUSED, String s, HColor background) throws NoSuchColorException { if (isColorValid(Objects.requireNonNull(s)) == false) throw new NoSuchColorException(); final Automatic automatic = automaticFromString(s); if (automatic != null) - return automatic.buildInternal(themeStyle, background); + return automatic.buildInternal(background); final Gradient gradient = gradientFromString(s); if (gradient != null) diff --git a/src/net/sourceforge/plantuml/ugraphic/color/HColorSimple.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorSimple.java index ff9b72fa3..ee2fb486d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/color/HColorSimple.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorSimple.java @@ -55,7 +55,17 @@ public class HColorSimple extends HColorAbstract implements HColor { if (isTransparent()) return "transparent"; - return color.toString() + " alpha=" + color.getAlpha() + " monochrome=" + monochrome; + final boolean withDark = this != dark; + + final StringBuilder sb = new StringBuilder(); + if (withDark) + sb.append("WITHDARK "); + sb.append(color.toString()); + sb.append(" \u03B1="); + sb.append(color.getAlpha()); + if (monochrome) + sb.append("MONOCHROME"); + return sb.toString(); } @Override diff --git a/src/net/sourceforge/plantuml/ugraphic/color/HColorUtils.java b/src/net/sourceforge/plantuml/ugraphic/color/HColorUtils.java index 296094ad8..7eb929c67 100644 --- a/src/net/sourceforge/plantuml/ugraphic/color/HColorUtils.java +++ b/src/net/sourceforge/plantuml/ugraphic/color/HColorUtils.java @@ -42,8 +42,8 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; public class HColorUtils { - public static final HColor BLACK; - public static final HColor WHITE; + public static final HColorSimple BLACK; + public static final HColorSimple WHITE; public static final HColor RED_LIGHT; public static final HColor RED_DARK; public static final HColor RED; @@ -81,8 +81,8 @@ public class HColorUtils { final HColorSet set = HColorSet.instance(); - BLACK = set.getColorOrWhite("black"); - WHITE = set.getColorOrWhite("white"); + BLACK = (HColorSimple) set.getColorOrWhite("black"); + WHITE = (HColorSimple) set.getColorOrWhite("white"); RED_LIGHT = set.getColorOrWhite("#FEF6F3"); RED_DARK = set.getColorOrWhite("#CD0A0A"); RED = set.getColorOrWhite("#FF0000"); diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 11af78d37..e0409aa87 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 1; + final int beta = 2; return beta; } diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java index eec78117c..467013e48 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagram.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagram.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; @@ -68,8 +69,8 @@ public class WBSDiagram extends UmlDiagram { return new DiagramDescription("Work Breakdown Structure"); } - public WBSDiagram(UmlSource source) { - super(source, UmlDiagramType.WBS); + public WBSDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.WBS); } @Override diff --git a/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java b/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java index c3bc3d2c9..d474c0cae 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java +++ b/src/net/sourceforge/plantuml/wbs/WBSDiagramFactory.java @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; @@ -63,8 +64,8 @@ public class WBSDiagramFactory extends PSystemCommandFactory { } @Override - public WBSDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new WBSDiagram(source); + public WBSDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new WBSDiagram(style, source); } } diff --git a/src/net/sourceforge/plantuml/wire/Block.java b/src/net/sourceforge/plantuml/wire/Block.java index 39bea7435..fbeaa7438 100644 --- a/src/net/sourceforge/plantuml/wire/Block.java +++ b/src/net/sourceforge/plantuml/wire/Block.java @@ -57,6 +57,7 @@ import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; +import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class Block extends AbstractTextBlock { @@ -117,14 +118,14 @@ public class Block extends AbstractTextBlock { } public Dimension2D calculateDimension(StringBounder stringBounder) { - if (fixedDim == null) { + if (fixedDim == null) return minMax.getDimension(); - } + return fixedDim; } public void drawU(UGraphic ug) { - ug = ug.apply(HColorUtils.BLACK); + ug = ug.apply(getBlack()); if (children.size() == 0) { final TextBlock label = display.create(new FontConfiguration(skinParam, FontParam.COMPONENT, null), HorizontalAlignment.CENTER, skinParam); @@ -143,6 +144,10 @@ public class Block extends AbstractTextBlock { } + private HColor getBlack() { + return HColorUtils.BLACK.withDark(HColorUtils.WHITE); + } + private void drawPins(Position pos, UGraphic ug) { double px = -2; double py = 10; diff --git a/src/net/sourceforge/plantuml/wire/CommandComponent.java b/src/net/sourceforge/plantuml/wire/CommandComponent.java index f9c32f66c..a18c802f6 100644 --- a/src/net/sourceforge/plantuml/wire/CommandComponent.java +++ b/src/net/sourceforge/plantuml/wire/CommandComponent.java @@ -91,9 +91,8 @@ public class CommandComponent extends SingleLineCommand2 { final String stringColor = arg.get("COLOR", 0); HColor color = null; - if (stringColor != null) { + if (stringColor != null) color = HColorSet.instance().getColor(diagram.getSkinParam().getThemeStyle(), stringColor); - } return diagram.addComponent(indent, name, width, height, color); } diff --git a/src/net/sourceforge/plantuml/wire/CommandSpot.java b/src/net/sourceforge/plantuml/wire/CommandSpot.java index 41580f581..0f999ae27 100644 --- a/src/net/sourceforge/plantuml/wire/CommandSpot.java +++ b/src/net/sourceforge/plantuml/wire/CommandSpot.java @@ -84,9 +84,8 @@ public class CommandSpot extends SingleLineCommand2 { final String stringColor = arg.get("COLOR", 0); HColor color = null; - if (stringColor != null) { + if (stringColor != null) color = HColorSet.instance().getColor(diagram.getSkinParam().getThemeStyle(), stringColor); - } final String x = arg.get("X", 0); final String y = arg.get("Y", 0); diff --git a/src/net/sourceforge/plantuml/wire/CommandWLink.java b/src/net/sourceforge/plantuml/wire/CommandWLink.java index 933a1f96d..702c8d1d8 100644 --- a/src/net/sourceforge/plantuml/wire/CommandWLink.java +++ b/src/net/sourceforge/plantuml/wire/CommandWLink.java @@ -97,9 +97,8 @@ public class CommandWLink extends SingleLineCommand2 { final String stringColor = arg.get("COLOR", 0); HColor color = null; - if (stringColor != null) { + if (stringColor != null) color = HColorSet.instance().getColor(diagram.getSkinParam().getThemeStyle(), stringColor); - } final Display label; if (arg.get("MESSAGE", 0) == null) { @@ -109,9 +108,9 @@ public class CommandWLink extends SingleLineCommand2 { label = Display.getWithNewlines(message); } - if (orientation == WOrientation.VERTICAL) { + if (orientation == WOrientation.VERTICAL) return diagram.vlink(name1, x1, y1, name2, type, direction, color, label); - } + return diagram.hlink(name1, x1, y1, name2, type, direction, color, label); } diff --git a/src/net/sourceforge/plantuml/wire/WArrowDirection.java b/src/net/sourceforge/plantuml/wire/WArrowDirection.java index dc3d0990e..2c79f3aed 100644 --- a/src/net/sourceforge/plantuml/wire/WArrowDirection.java +++ b/src/net/sourceforge/plantuml/wire/WArrowDirection.java @@ -39,15 +39,15 @@ public enum WArrowDirection { NORMAL, REVERSE, BOTH, NONE; public static WArrowDirection from(String type) { - if (type.contains("<") && type.contains(">")) { + if (type.contains("<") && type.contains(">")) return BOTH; - } - if (type.contains(">")) { + + if (type.contains(">")) return NORMAL; - } - if (type.contains("<")) { + + if (type.contains("<")) return REVERSE; - } + return NONE; } diff --git a/src/net/sourceforge/plantuml/wire/WBlock.java b/src/net/sourceforge/plantuml/wire/WBlock.java index dfef3828d..9fd03fc07 100644 --- a/src/net/sourceforge/plantuml/wire/WBlock.java +++ b/src/net/sourceforge/plantuml/wire/WBlock.java @@ -78,9 +78,9 @@ public class WBlock { private final List prints = new ArrayList<>(); public UTranslate getAbsolutePosition(String supx, String supy) { - if (parent == null) { + if (parent == null) return position; - } + final UTranslate p = parent.getAbsolutePosition("0", "0"); final double x = position.getDx() + p.getDx() + parseWidth(supx); @@ -133,23 +133,22 @@ public class WBlock { } private WBlock getChildByName(String name) { - for (WBlock child : children) { - if (name.equals(child.getName())) { + for (WBlock child : children) + if (name.equals(child.getName())) return child; - } - } + return null; } public WBlock getBlock(String name) { final int x = name.indexOf('.'); - if (x == -1) { + if (x == -1) return getChildByName(name); - } + final WBlock first = getChildByName(name.substring(0, x)); - if (first == null) { + if (first == null) return null; - } + return first.getBlock(name.substring(x + 1)); } @@ -227,24 +226,28 @@ public class WBlock { } private WBlock getLastChild() { - if (children.size() == 0) { + if (children.size() == 0) return null; - } + return children.get(children.size() - 1); } public void drawMe(UGraphic ug) { drawBox(ug); final UFont font = UFont.sansSerif(12); - final FontConfiguration fc = new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLACK, false); + final FontConfiguration fc = new FontConfiguration(font, getBlack(), getBlack(), false); final Display display = Display.create(name.replace('_', ' ')); final TextBlock text = display.create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty()); text.drawU(ug.apply(UTranslate.dx(5))); } + private HColor getBlack() { + return HColorUtils.BLACK.withDark(HColorUtils.WHITE); + } + private void drawBox(UGraphic ug) { - ug = ug.apply(HColorUtils.BLACK); + ug = ug.apply(getBlack()); if (name.length() > 0) { final URectangle rect = new URectangle(getMaxDimension()); UGraphic ugRect = ug; diff --git a/src/net/sourceforge/plantuml/wire/WLinkHorizontal.java b/src/net/sourceforge/plantuml/wire/WLinkHorizontal.java index 77b5de15b..2c0fb87cc 100644 --- a/src/net/sourceforge/plantuml/wire/WLinkHorizontal.java +++ b/src/net/sourceforge/plantuml/wire/WLinkHorizontal.java @@ -69,7 +69,15 @@ public class WLinkHorizontal { this.direction = direction; this.type = type; this.label = label; - this.color = color == null ? HColorUtils.BLACK : color; + this.color = color == null ? getBlack() : color; + } + + private HColor getBlack() { + return HColorUtils.BLACK.withDark(HColorUtils.WHITE); + } + + private HColor getWhite() { + return HColorUtils.WHITE.withDark(HColorUtils.BLACK); } private TextBlock getTextBlock() { @@ -93,7 +101,7 @@ public class WLinkHorizontal { ugText = ugText.apply(UTranslate.dy(-dimText.getHeight() / 2)); } else if (type == WLinkType.BUS) { - ug = ug.apply(HColorUtils.WHITE.bg()); + ug = ug.apply(getWhite().bg()); drawBusArrow(ug); ugText = ugText.apply(UTranslate.dy((20 - dimText.getHeight()) / 2 - 5)); } @@ -110,9 +118,9 @@ public class WLinkHorizontal { ugText = ugText.apply(UTranslate.dx((len - dimText.getWidth()) / 2)); break; } - if (type == WLinkType.NORMAL) { - ugText.apply(HColorUtils.WHITE).apply(HColorUtils.WHITE.bg()).draw(new URectangle(dimText)); - } + if (type == WLinkType.NORMAL) + ugText.apply(getWhite()).apply(getWhite().bg()).draw(new URectangle(dimText)); + textBlock.drawU(ugText); } diff --git a/src/net/sourceforge/plantuml/wire/WLinkType.java b/src/net/sourceforge/plantuml/wire/WLinkType.java index 3a08379eb..83d8d81d9 100644 --- a/src/net/sourceforge/plantuml/wire/WLinkType.java +++ b/src/net/sourceforge/plantuml/wire/WLinkType.java @@ -40,12 +40,12 @@ public enum WLinkType { NORMAL, BUS; static public WLinkType from(String arg) { - if (arg.contains("-")) { + if (arg.contains("-")) return WLinkType.NORMAL; - } - if (arg.contains("=")) { + + if (arg.contains("=")) return WLinkType.BUS; - } + throw new IllegalArgumentException(); } diff --git a/src/net/sourceforge/plantuml/wire/WLinkVertical.java b/src/net/sourceforge/plantuml/wire/WLinkVertical.java index 945d796ee..3f4a8d085 100644 --- a/src/net/sourceforge/plantuml/wire/WLinkVertical.java +++ b/src/net/sourceforge/plantuml/wire/WLinkVertical.java @@ -66,7 +66,15 @@ public class WLinkVertical { this.direction = direction; this.type = type; this.label = label; - this.color = color == null ? HColorUtils.BLACK : color; + this.color = color == null ? getBlack() : color; + } + + private HColor getBlack() { + return HColorUtils.BLACK.withDark(HColorUtils.WHITE); + } + + private HColor getWhite() { + return HColorUtils.WHITE.withDark(HColorUtils.BLACK); } private TextBlock getTextBlock() { @@ -81,7 +89,7 @@ public class WLinkVertical { ug = ug.apply(color.bg()); drawNormalArrow(ug); } else if (type == WLinkType.BUS) { - ug = ug.apply(HColorUtils.WHITE.bg()); + ug = ug.apply(getWhite().bg()); drawBusArrow(ug); } } @@ -136,7 +144,8 @@ public class WLinkVertical { path.lineTo(5, 0); path.closePath(); ug.apply(start.compose(UTranslate.dy(1))).draw(path); - } } + } + } private void drawNormalArrow(UGraphic ug) { final double dy = destination - start.getDy() - 2; diff --git a/src/net/sourceforge/plantuml/wire/WOrientation.java b/src/net/sourceforge/plantuml/wire/WOrientation.java index 56f97d0f6..9e4e15388 100644 --- a/src/net/sourceforge/plantuml/wire/WOrientation.java +++ b/src/net/sourceforge/plantuml/wire/WOrientation.java @@ -40,9 +40,9 @@ public enum WOrientation { HORIZONTAL, VERTICAL; public static WOrientation from(String style) { - if (style.contains("==") || style.contains("--")) { + if (style.contains("==") || style.contains("--")) return WOrientation.VERTICAL; - } + return HORIZONTAL; } } diff --git a/src/net/sourceforge/plantuml/wire/WPrint.java b/src/net/sourceforge/plantuml/wire/WPrint.java index 4f53de05f..b4b8f3eeb 100644 --- a/src/net/sourceforge/plantuml/wire/WPrint.java +++ b/src/net/sourceforge/plantuml/wire/WPrint.java @@ -59,7 +59,11 @@ public class WPrint { this.position = position; this.skinParam = skinParam; this.label = label; - this.color = color == null ? HColorUtils.BLACK : color; + this.color = color == null ? getBlack() : color; + } + + private HColor getBlack() { + return HColorUtils.BLACK.withDark(HColorUtils.WHITE); } private TextBlock getTextBlock() { diff --git a/src/net/sourceforge/plantuml/wire/WireDiagram.java b/src/net/sourceforge/plantuml/wire/WireDiagram.java index fbcf925df..3c4b75aa9 100644 --- a/src/net/sourceforge/plantuml/wire/WireDiagram.java +++ b/src/net/sourceforge/plantuml/wire/WireDiagram.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.ImageData; @@ -70,17 +71,15 @@ public class WireDiagram extends UmlDiagram { return new DiagramDescription("Wire Diagram"); } - public WireDiagram(UmlSource source) { - super(source, UmlDiagramType.WIRE); + public WireDiagram(ThemeStyle style, UmlSource source) { + super(style, source, UmlDiagramType.WIRE); } @Override protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) throws IOException { - return createImageBuilder(fileFormatOption) - .drawable(getTextBlock()) - .write(os); + return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os); } private TextBlockBackcolored getTextBlock() { @@ -112,15 +111,14 @@ public class WireDiagram extends UmlDiagram { private void drawMe(UGraphic ug) { root.drawMe(ug); - for (Spot spot : spots) { + for (Spot spot : spots) spot.drawMe(ug); - } - for (WLinkHorizontal link : hlinks) { + + for (WLinkHorizontal link : hlinks) link.drawMe(ug); - } - for (WLinkVertical link : vlinks) { + + for (WLinkVertical link : vlinks) link.drawMe(ug); - } } @@ -136,9 +134,9 @@ public class WireDiagram extends UmlDiagram { public CommandExecutionResult spot(String name, HColor color, String x, String y) { final WBlock block = this.root.getBlock(name); - if (block == null) { + if (block == null) return CommandExecutionResult.error("No such element " + name); - } + final Spot spot = new Spot(block, color, x, y); this.spots.add(spot); return CommandExecutionResult.ok(); @@ -169,13 +167,12 @@ public class WireDiagram extends UmlDiagram { public CommandExecutionResult vlink(String name1, String x1, String y1, String name2, WLinkType type, WArrowDirection direction, HColor color, Display label) { final WBlock block1 = this.root.getBlock(name1); - if (block1 == null) { + if (block1 == null) return CommandExecutionResult.error("No such element " + name1); - } + final WBlock block2 = this.root.getBlock(name2); - if (block2 == null) { + if (block2 == null) return CommandExecutionResult.error("No such element " + name2); - } final UTranslate start = block1.getNextOutVertical(x1, y1, type); final double destination = block2.getAbsolutePosition("0", "0").getDy(); @@ -188,13 +185,12 @@ public class WireDiagram extends UmlDiagram { public CommandExecutionResult hlink(String name1, String x1, String y1, String name2, WLinkType type, WArrowDirection direction, HColor color, Display label) { final WBlock block1 = this.root.getBlock(name1); - if (block1 == null) { + if (block1 == null) return CommandExecutionResult.error("No such element " + name1); - } + final WBlock block2 = this.root.getBlock(name2); - if (block2 == null) { + if (block2 == null) return CommandExecutionResult.error("No such element " + name2); - } final UTranslate start = block1.getNextOutHorizontal(x1, y1, type); final double destination = block2.getAbsolutePosition("0", "0").getDx(); diff --git a/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java b/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java index 51f95df12..3915723ea 100644 --- a/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java +++ b/src/net/sourceforge/plantuml/wire/WireDiagramFactory.java @@ -39,9 +39,10 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.Command; -import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.CommonCommands; +import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.UmlSource; @@ -68,8 +69,8 @@ public class WireDiagramFactory extends PSystemCommandFactory { } @Override - public WireDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { - return new WireDiagram(source); + public WireDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { + return new WireDiagram(style, source); } } diff --git a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java index 01c56dd6e..159a60a83 100644 --- a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java @@ -41,6 +41,7 @@ import java.util.List; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.UmlDiagramType; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.DiagramType; @@ -60,7 +61,7 @@ public class YamlDiagramFactory extends PSystemAbstractFactory { } @Override - public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { + public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) { final List highlighted = new ArrayList<>(); JsonValue yaml = null; StyleExtractor styleExtractor = null; @@ -71,9 +72,9 @@ public class YamlDiagramFactory extends PSystemAbstractFactory { it.next(); while (true) { final String line = it.next(); - if (it.hasNext() == false) { + if (it.hasNext() == false) break; - } + if (line.startsWith("#highlight ")) { highlighted.add(line.substring("#highlight ".length()).trim()); continue; @@ -84,7 +85,7 @@ public class YamlDiagramFactory extends PSystemAbstractFactory { } catch (Exception e) { e.printStackTrace(); } - final JsonDiagram result = new JsonDiagram(source, UmlDiagramType.YAML, yaml, highlighted); + final JsonDiagram result = new JsonDiagram(style, source, UmlDiagramType.YAML, yaml, highlighted); if (styleExtractor != null) { styleExtractor.applyStyles(result.getSkinParam()); final String title = styleExtractor.getTitle(); diff --git a/src/smetana/core/CString.java b/src/smetana/core/CString.java index 613428f69..99fa78297 100644 --- a/src/smetana/core/CString.java +++ b/src/smetana/core/CString.java @@ -60,7 +60,7 @@ public class CString extends UnsupportedC implements __ptr__ { } public CString(String string) { - this(new ArrayList<>(), 0); + this(null, 0); for (int i = 0; i < string.length(); i++) { data2.add(string.charAt(i)); } @@ -85,18 +85,20 @@ public class CString extends UnsupportedC implements __ptr__ { public static CString gmalloc(int nbytes) { return new CString(nbytes); - } - + } public CString(int size) { - this(new ArrayList<>(), 0); + this(null, 0); for (int i = 0; i < size; i++) { data2.add('\0'); } } private CString(List data2, int currentStart) { - this.data2 = data2; + if (data2 == null) + this.data2 = new ArrayList<>(); + else + this.data2 = data2; this.currentStart = currentStart; this.uid = UID; UID += 2; @@ -140,8 +142,6 @@ public class CString extends UnsupportedC implements __ptr__ { return this.currentStart - this2.currentStart; } - - @Override public String toString() { final StringBuilder sb = new StringBuilder(); diff --git a/test/net/sourceforge/plantuml/SkinParamTest.java b/test/net/sourceforge/plantuml/SkinParamTest.java index 3892d20a7..6b79b14cb 100644 --- a/test/net/sourceforge/plantuml/SkinParamTest.java +++ b/test/net/sourceforge/plantuml/SkinParamTest.java @@ -9,6 +9,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.EnumSource; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; @@ -36,7 +37,7 @@ class SkinParamTest { @EnumSource(UmlDiagramType.class) public void testDefaultValues(UmlDiagramType umlDiagramType) { - final SkinParam skinParam = SkinParam.create(umlDiagramType); + final SkinParam skinParam = SkinParam.create(umlDiagramType, ThemeStyle.LIGHT_REGULAR); final Stereotype fooStereotype = Stereotype.build("<>"); assertThat(skinParam.actorStyle()).isEqualTo(ActorStyle.STICKMAN); @@ -501,7 +502,7 @@ class SkinParamTest { private SkinParam createSkinParam(String... keyValuePairs) { // Using SEQUENCE here is an arbitrary decision that should not affect test outcome - final SkinParam skinParam = SkinParam.create(UmlDiagramType.SEQUENCE); + final SkinParam skinParam = SkinParam.create(UmlDiagramType.SEQUENCE, ThemeStyle.LIGHT_REGULAR); for (int i = 0; i < keyValuePairs.length; i += 2) { skinParam.setParam(StringUtils.goLowerCase(keyValuePairs[i]), keyValuePairs[i + 1]); } diff --git a/test/net/sourceforge/plantuml/ugraphic/ImageBuilderTest.java b/test/net/sourceforge/plantuml/ugraphic/ImageBuilderTest.java index 4d462ba23..4c52094fb 100644 --- a/test/net/sourceforge/plantuml/ugraphic/ImageBuilderTest.java +++ b/test/net/sourceforge/plantuml/ugraphic/ImageBuilderTest.java @@ -3,6 +3,7 @@ package net.sourceforge.plantuml.ugraphic; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.PlainDiagram; import net.sourceforge.plantuml.StringLocated; +import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.creole.legacy.PSystemCreole; import net.sourceforge.plantuml.wbs.WBSDiagram; @@ -48,7 +49,7 @@ class ImageBuilderTest { nullValues = {"NULL"} ) public void test_preserveAspectRatio_styledDiagram(String inSkinParam, String inFileFormatOption, String expected) throws Exception { - final WBSDiagram diagram = new WBSDiagram(new UmlSource(new ArrayList(), false)); + final WBSDiagram diagram = new WBSDiagram(ThemeStyle.LIGHT_REGULAR, new UmlSource(new ArrayList(), false)); FileFormatOption fileFormatOption = new FileFormatOption(DEBUG); if (inSkinParam != null) diagram.setParam("preserveAspectRatio", inSkinParam); diff --git a/test/nonreg/simple/A0000_TestResult.java b/test/nonreg/simple/A0000_TestResult.java index 2858cd73f..b271a2ecc 100644 --- a/test/nonreg/simple/A0000_TestResult.java +++ b/test/nonreg/simple/A0000_TestResult.java @@ -5,7 +5,7 @@ public class A0000_TestResult { /* """ DPI: 96 -dimension: [ 193.5185 ; 125.0000 ] +dimension: [ 185.5185 ; 113.0000 ] scaleFactor: 1.0000 seed: 5605069588648637213 svgLinkTarget: _top @@ -13,18 +13,18 @@ hoverPathColorRGB: null preserveAspectRatio: none LINE: - pt1: [ 50.0000 ; 38.0000 ] - pt2: [ 50.0000 ; 85.0000 ] + pt1: [ 48.0000 ; 34.0000 ] + pt2: [ 48.0000 ; 81.0000 ] stroke: 5.0-5.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 156.8135 ; 38.0000 ] - pt2: [ 156.8135 ; 85.0000 ] + pt1: [ 154.8135 ; 34.0000 ] + pt2: [ 154.8135 ; 81.0000 ] stroke: 5.0-5.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 RECTANGLE: pt1: [ 5.0000 ; 5.0000 ] @@ -32,9 +32,9 @@ RECTANGLE: xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Alice @@ -45,18 +45,18 @@ TEXT: extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 5.0000 ; 84.0000 ] - pt2: [ 92.9573 ; 112.0000 ] + pt1: [ 5.0000 ; 80.0000 ] + pt2: [ 92.9573 ; 108.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Alice - position: [ 12.0000 ; 101.8889 ] + position: [ 12.0000 ; 97.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 @@ -68,9 +68,9 @@ RECTANGLE: xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Bob @@ -81,18 +81,18 @@ TEXT: extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 130.8135 ; 84.0000 ] - pt2: [ 180.5185 ; 112.0000 ] + pt1: [ 130.8135 ; 80.0000 ] + pt2: [ 180.5185 ; 108.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Bob - position: [ 137.8135 ; 101.8889 ] + position: [ 137.8135 ; 97.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 @@ -100,25 +100,25 @@ TEXT: POLYGON: points: - - [ 145.6660 ; 63.0000 ] - - [ 155.6660 ; 67.0000 ] - - [ 145.6660 ; 71.0000 ] - - [ 149.6660 ; 67.0000 ] + - [ 143.6660 ; 59.0000 ] + - [ 153.6660 ; 63.0000 ] + - [ 143.6660 ; 67.0000 ] + - [ 147.6660 ; 63.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 LINE: - pt1: [ 50.9786 ; 67.0000 ] - pt2: [ 151.6660 ; 67.0000 ] + pt1: [ 48.9786 ; 63.0000 ] + pt2: [ 149.6660 ; 63.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 TEXT: text: Hello - position: [ 57.9786 ; 62.1111 ] + position: [ 55.9786 ; 58.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 diff --git a/test/nonreg/simple/A0001_TestResult.java b/test/nonreg/simple/A0001_TestResult.java index 1366e9116..816525284 100644 --- a/test/nonreg/simple/A0001_TestResult.java +++ b/test/nonreg/simple/A0001_TestResult.java @@ -5,7 +5,7 @@ public class A0001_TestResult { /* """ DPI: 96 -dimension: [ 304.7331 ; 297.0000 ] +dimension: [ 296.7331 ; 285.0000 ] scaleFactor: 1.0000 seed: -1212656935193060805 svgLinkTarget: _top @@ -13,28 +13,28 @@ hoverPathColorRGB: null preserveAspectRatio: none RECTANGLE: - pt1: [ 26.8525 ; 75.0000 ] - pt2: [ 36.8525 ; 113.0000 ] + pt1: [ 24.8525 ; 71.0000 ] + pt2: [ 34.8525 ; 109.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 - shadow: 1 - color: ffa80036 + shadow: 0 + color: ff181818 backcolor: ffffffff LINE: - pt1: [ 31.0000 ; 38.0000 ] - pt2: [ 31.0000 ; 257.0000 ] + pt1: [ 29.0000 ; 34.0000 ] + pt2: [ 29.0000 ; 253.0000 ] stroke: 5.0-5.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 248.7758 ; 38.0000 ] - pt2: [ 248.7758 ; 257.0000 ] + pt1: [ 246.7758 ; 34.0000 ] + pt2: [ 246.7758 ; 253.0000 ] stroke: 5.0-5.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 RECTANGLE: pt1: [ 5.0000 ; 5.0000 ] @@ -42,9 +42,9 @@ RECTANGLE: xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Bob @@ -55,18 +55,18 @@ TEXT: extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 5.0000 ; 256.0000 ] - pt2: [ 54.7050 ; 284.0000 ] + pt1: [ 5.0000 ; 252.0000 ] + pt2: [ 54.7050 ; 280.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Bob - position: [ 12.0000 ; 273.8889 ] + position: [ 12.0000 ; 269.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 @@ -78,9 +78,9 @@ RECTANGLE: xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Alice @@ -91,162 +91,162 @@ TEXT: extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 203.7758 ; 256.0000 ] - pt2: [ 291.7331 ; 284.0000 ] + pt1: [ 203.7758 ; 252.0000 ] + pt2: [ 291.7331 ; 280.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Alice - position: [ 210.7758 ; 273.8889 ] + position: [ 210.7758 ; 269.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 26.8525 ; 75.0000 ] - pt2: [ 36.8525 ; 113.0000 ] + pt1: [ 24.8525 ; 71.0000 ] + pt2: [ 34.8525 ; 109.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 - shadow: 1 - color: ffa80036 + shadow: 0 + color: ff181818 backcolor: ffffffff LINE: - pt1: [ 31.8525 ; 62.0000 ] - pt2: [ 78.8525 ; 62.0000 ] + pt1: [ 29.8525 ; 58.0000 ] + pt2: [ 76.8525 ; 58.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 78.8525 ; 62.0000 ] - pt2: [ 78.8525 ; 75.0000 ] + pt1: [ 76.8525 ; 58.0000 ] + pt2: [ 76.8525 ; 71.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 37.8525 ; 75.0000 ] - pt2: [ 78.8525 ; 75.0000 ] + pt1: [ 35.8525 ; 71.0000 ] + pt2: [ 76.8525 ; 71.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 POLYGON: points: - - [ 47.8525 ; 71.0000 ] - - [ 37.8525 ; 75.0000 ] - - [ 47.8525 ; 79.0000 ] - - [ 43.8525 ; 75.0000 ] + - [ 45.8525 ; 67.0000 ] + - [ 35.8525 ; 71.0000 ] + - [ 45.8525 ; 75.0000 ] + - [ 41.8525 ; 71.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 TEXT: text: hello1 - position: [ 43.8525 ; 57.1111 ] + position: [ 41.8525 ; 53.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 extendedColor: NULL_COLOR LINE: - pt1: [ 36.8525 ; 107.0000 ] - pt2: [ 78.8525 ; 107.0000 ] + pt1: [ 34.8525 ; 103.0000 ] + pt2: [ 76.8525 ; 103.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 78.8525 ; 107.0000 ] - pt2: [ 78.8525 ; 120.0000 ] + pt1: [ 76.8525 ; 103.0000 ] + pt2: [ 76.8525 ; 116.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 37.8525 ; 120.0000 ] - pt2: [ 78.8525 ; 120.0000 ] + pt1: [ 35.8525 ; 116.0000 ] + pt2: [ 76.8525 ; 116.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 POLYGON: points: - - [ 47.8525 ; 116.0000 ] - - [ 37.8525 ; 120.0000 ] - - [ 47.8525 ; 124.0000 ] - - [ 43.8525 ; 120.0000 ] + - [ 45.8525 ; 112.0000 ] + - [ 35.8525 ; 116.0000 ] + - [ 45.8525 ; 120.0000 ] + - [ 41.8525 ; 116.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 TEXT: text: hello2 - position: [ 43.8525 ; 102.1111 ] + position: [ 41.8525 ; 98.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 extendedColor: NULL_COLOR LINE: - pt1: [ 22.8525 ; 111.0000 ] - pt2: [ 40.8525 ; 129.0000 ] + pt1: [ 20.8525 ; 107.0000 ] + pt2: [ 38.8525 ; 125.0000 ] stroke: 0.0-0.0-2.0 shadow: 0 color: ffa80036 LINE: - pt1: [ 22.8525 ; 129.0000 ] - pt2: [ 40.8525 ; 111.0000 ] + pt1: [ 20.8525 ; 125.0000 ] + pt2: [ 38.8525 ; 107.0000 ] stroke: 0.0-0.0-2.0 shadow: 0 color: ffa80036 LINE: - pt1: [ 31.8525 ; 173.0000 ] - pt2: [ 73.8525 ; 173.0000 ] + pt1: [ 29.8525 ; 169.0000 ] + pt2: [ 71.8525 ; 169.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 73.8525 ; 173.0000 ] - pt2: [ 73.8525 ; 186.0000 ] + pt1: [ 71.8525 ; 169.0000 ] + pt2: [ 71.8525 ; 182.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 32.8525 ; 186.0000 ] - pt2: [ 73.8525 ; 186.0000 ] + pt1: [ 30.8525 ; 182.0000 ] + pt2: [ 71.8525 ; 182.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 POLYGON: points: - - [ 42.8525 ; 182.0000 ] - - [ 32.8525 ; 186.0000 ] - - [ 42.8525 ; 190.0000 ] - - [ 38.8525 ; 186.0000 ] + - [ 40.8525 ; 178.0000 ] + - [ 30.8525 ; 182.0000 ] + - [ 40.8525 ; 186.0000 ] + - [ 36.8525 ; 182.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 TEXT: text: this is an - position: [ 38.8525 ; 142.1111 ] + position: [ 36.8525 ; 138.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 @@ -254,7 +254,7 @@ TEXT: TEXT: text: example of long - position: [ 38.8525 ; 155.1111 ] + position: [ 36.8525 ; 151.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 @@ -262,7 +262,7 @@ TEXT: TEXT: text: message - position: [ 38.8525 ; 168.1111 ] + position: [ 36.8525 ; 164.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 @@ -270,25 +270,25 @@ TEXT: POLYGON: points: - - [ 237.7544 ; 235.0000 ] - - [ 247.7544 ; 239.0000 ] - - [ 237.7544 ; 243.0000 ] - - [ 241.7544 ; 239.0000 ] + - [ 235.7544 ; 231.0000 ] + - [ 245.7544 ; 235.0000 ] + - [ 235.7544 ; 239.0000 ] + - [ 239.7544 ; 235.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 LINE: - pt1: [ 31.8525 ; 239.0000 ] - pt2: [ 243.7544 ; 239.0000 ] + pt1: [ 29.8525 ; 235.0000 ] + pt2: [ 241.7544 ; 235.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 TEXT: text: And this - position: [ 38.8525 ; 208.1111 ] + position: [ 36.8525 ; 204.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 @@ -296,7 +296,7 @@ TEXT: TEXT: text: is an other on - position: [ 38.8525 ; 221.1111 ] + position: [ 36.8525 ; 217.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 @@ -304,7 +304,7 @@ TEXT: TEXT: text: very long too - position: [ 38.8525 ; 234.1111 ] + position: [ 36.8525 ; 230.1111 ] orientation: 0 font: SansSerif.plain/13 [] color: ff000000 diff --git a/test/nonreg/simple/A0002_TestResult.java b/test/nonreg/simple/A0002_TestResult.java index 264386f27..468b52d97 100644 --- a/test/nonreg/simple/A0002_TestResult.java +++ b/test/nonreg/simple/A0002_TestResult.java @@ -5,7 +5,7 @@ public class A0002_TestResult { /* """ DPI: 96 -dimension: [ 763.0498 ; 895.5000 ] +dimension: [ 763.0498 ; 890.5000 ] scaleFactor: 1.0000 seed: -9181376250803721714 svgLinkTarget: _top @@ -18,9 +18,9 @@ ELLIPSE: start: 0.0 extend: 0.0 stroke: 0.0-0.0-1.0 - shadow: 3 - color: NULL_COLOR - backcolor: ff000000 + shadow: 0 + color: ff222222 + backcolor: ff222222 EMPTY: pt1: [ 20.0000 ; 220.0000 ] @@ -40,9 +40,9 @@ PATH: - type: SEG_LINETO pt1: [ 0.0000 ; 0.0000 ] stroke: 0.0-0.0-1.0 - shadow: 3 - color: ffa80036 - backcolor: fffbfb77 + shadow: 0 + color: ff181818 + backcolor: ffebebeb PATH: - type: SEG_MOVETO @@ -55,8 +55,8 @@ PATH: pt1: [ 93.4243 ; 0.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: fffbfb77 + color: ff181818 + backcolor: ffebebeb TEXT: text: This @@ -100,9 +100,9 @@ PATH: - type: SEG_LINETO pt1: [ 0.0000 ; 0.0000 ] stroke: 0.0-0.0-1.0 - shadow: 3 - color: ffa80036 - backcolor: fffbfb77 + shadow: 0 + color: ff181818 + backcolor: ffebebeb PATH: - type: SEG_MOVETO @@ -115,8 +115,8 @@ PATH: pt1: [ 193.3768 ; 0.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: fffbfb77 + color: ff181818 + backcolor: ffebebeb TEXT: text: A Long @@ -307,14 +307,14 @@ LINE: pt2: [ 431.7562 ; 358.5000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 228.3794 ; 360.5000 ] pt2: [ 431.7562 ; 360.5000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 ELLIPSE: pt1: [ 237.3794 ; 366.5000 ] @@ -388,9 +388,9 @@ RECTANGLE: xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 3 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: foo1 @@ -449,9 +449,9 @@ PATH: sweepFlag: false dest: [ 0.0000 ; 0.0000 ] stroke: 0.0-0.0-1.0 - shadow: 3 - color: ffa80036 - backcolor: fffbfb77 + shadow: 0 + color: ff181818 + backcolor: ffebebeb PATH: - type: SEG_MOVETO @@ -464,8 +464,8 @@ PATH: pt1: [ 175.8127 ; 0.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: fffbfb77 + color: ff181818 + backcolor: ffebebeb TEXT: text: KO for @@ -672,14 +672,14 @@ LINE: pt2: [ 733.5219 ; 762.5000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 547.7092 ; 764.5000 ] pt2: [ 733.5219 ; 764.5000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 ELLIPSE: pt1: [ 556.7092 ; 770.5000 ] @@ -745,9 +745,9 @@ RECTANGLE: xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 3 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: foo2 @@ -763,9 +763,9 @@ ELLIPSE: start: 0.0 extend: 0.0 stroke: 0.0-0.0-1.0 - shadow: 3 - color: ff000000 - backcolor: ffffffff + shadow: 0 + color: ff222222 + backcolor: 0 ELLIPSE: pt1: [ 484.2327 ; 862.5000 ] @@ -774,8 +774,8 @@ ELLIPSE: extend: 0.0 stroke: 0.0-0.0-1.0 shadow: 0 - color: middle(ff000000 & ff000000 ) - backcolor: ff000000 + color: middle(ff222222 & ff222222 ) + backcolor: ff222222 EMPTY: pt1: [ 441.7562 ; 12.5000 ] @@ -804,7 +804,7 @@ LINE: pt2: [ 180.9019 ; 238.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 POLYGON: points: @@ -814,15 +814,15 @@ POLYGON: - [ 180.9019 ; 232.5000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 LINE: pt1: [ 490.2327 ; 661.5000 ] pt2: [ 490.2327 ; 857.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 POLYGON: points: @@ -832,29 +832,29 @@ POLYGON: - [ 490.2327 ; 851.5000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 LINE: pt1: [ 180.9019 ; 270.5000 ] pt2: [ 180.9019 ; 448.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 180.9019 ; 448.5000 ] pt2: [ 490.2327 ; 448.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 490.2327 ; 448.5000 ] pt2: [ 490.2327 ; 629.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 POLYGON: points: @@ -864,8 +864,8 @@ POLYGON: - [ 490.2327 ; 623.5000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 TEXT: text: Actor 1 diff --git a/test/nonreg/simple/A0003_TestResult.java b/test/nonreg/simple/A0003_TestResult.java index 381325cc8..de29537de 100644 --- a/test/nonreg/simple/A0003_TestResult.java +++ b/test/nonreg/simple/A0003_TestResult.java @@ -20,7 +20,7 @@ RECTANGLE: stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: ffe0e8e8 + backcolor: ffe0e0e0 RECTANGLE: pt1: [ 36.0000 ; 29.0000 ] @@ -30,7 +30,7 @@ RECTANGLE: stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: ffe0e8e8 + backcolor: ffe0e0e0 RECTANGLE: pt1: [ 44.0000 ; 29.0000 ] @@ -50,7 +50,7 @@ RECTANGLE: stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: ffe0e8e8 + backcolor: ffe0e0e0 RECTANGLE: pt1: [ 120.0000 ; 29.0000 ] @@ -60,7 +60,7 @@ RECTANGLE: stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: ffe0e8e8 + backcolor: ffe0e0e0 RECTANGLE: pt1: [ 148.0000 ; 29.0000 ] @@ -70,7 +70,7 @@ RECTANGLE: stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: ffe0e8e8 + backcolor: ffe0e0e0 TEXT: text: 43 @@ -232,14 +232,14 @@ LINE: pt2: [ 131.0000 ; 51.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 131.0000 ; 51.5000 ] pt2: [ 139.0000 ; 51.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 POLYGON: points: @@ -249,8 +249,8 @@ POLYGON: - [ 139.0000 ; 51.5000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 RECTANGLE: pt1: [ 2.0000 ; 31.0000 ] @@ -488,28 +488,28 @@ RECTANGLE: stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: fffefece + backcolor: fff8f8f8 LINE: pt1: [ 142.0000 ; 46.0000 ] pt2: [ 147.0000 ; 46.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 142.0000 ; 57.0000 ] pt2: [ 147.0000 ; 57.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 142.0000 ; 46.0000 ] pt2: [ 142.0000 ; 57.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 RECTANGLE: pt1: [ 156.0000 ; 46.0000 ] @@ -519,42 +519,42 @@ RECTANGLE: stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: fffefece + backcolor: fff8f8f8 LINE: pt1: [ 157.0000 ; 46.0000 ] pt2: [ 166.0000 ; 46.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 157.0000 ; 57.0000 ] pt2: [ 166.0000 ; 57.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 166.0000 ; 46.0000 ] pt2: [ 166.0000 ; 57.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 151.0000 ; 46.0000 ] pt2: [ 153.0000 ; 46.0000 ] stroke: 2.0-3.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: pt1: [ 151.0000 ; 57.0000 ] pt2: [ 153.0000 ; 57.0000 ] stroke: 2.0-3.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 TEXT: text: Prototype design diff --git a/test/nonreg/simple/A0004_TestResult.java b/test/nonreg/simple/A0004_TestResult.java index 6de9b4c58..b198c39c5 100644 --- a/test/nonreg/simple/A0004_TestResult.java +++ b/test/nonreg/simple/A0004_TestResult.java @@ -5,7 +5,7 @@ public class A0004_TestResult { /* """ DPI: 96 -dimension: [ 559.6156 ; 681.0000 ] +dimension: [ 551.6156 ; 669.0000 ] scaleFactor: 1.0000 seed: 6985134683589840646 svgLinkTarget: _top @@ -13,28 +13,28 @@ hoverPathColorRGB: null preserveAspectRatio: none ELLIPSE: - pt1: [ 139.0000 ; 7.0000 ] - pt2: [ 159.0000 ; 27.0000 ] + pt1: [ 139.0000 ; 1.0000 ] + pt2: [ 159.0000 ; 21.0000 ] start: 0.0 extend: 0.0 stroke: 0.0-0.0-1.0 - shadow: 3 + shadow: 0 color: NULL_COLOR - backcolor: ff000000 + backcolor: ff222222 RECTANGLE: - pt1: [ 39.5000 ; 68.0000 ] - pt2: [ 258.0017 ; 100.0000 ] + pt1: [ 39.5000 ; 62.0000 ] + pt2: [ 258.0017 ; 94.0000 ] xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: VerifyReservation - position: [ 49.5000 ; 87.3333 ] + position: [ 49.5000 ; 81.3333 ] orientation: 0 font: SansSerif.plain/12 [] color: ff000000 @@ -42,153 +42,153 @@ TEXT: POLYGON: points: - - [ 149.0000 ; 137.0000 ] - - [ 161.0000 ; 149.0000 ] - - [ 149.0000 ; 161.0000 ] - - [ 137.0000 ; 149.0000 ] - - [ 149.0000 ; 137.0000 ] + - [ 149.0000 ; 131.0000 ] + - [ 161.0000 ; 143.0000 ] + - [ 149.0000 ; 155.0000 ] + - [ 137.0000 ; 143.0000 ] + - [ 149.0000 ; 131.0000 ] stroke: 0.0-0.0-1.5 - shadow: 5 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 RECTANGLE: - pt1: [ 7.0000 ; 179.0000 ] - pt2: [ 173.2574 ; 211.0000 ] + pt1: [ 7.0000 ; 173.0000 ] + pt2: [ 173.2574 ; 205.0000 ] xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: sendToAirport - position: [ 17.0000 ; 198.3333 ] + position: [ 17.0000 ; 192.3333 ] orientation: 0 font: SansSerif.plain/12 [] color: ff000000 extendedColor: NULL_COLOR ELLIPSE: - pt1: [ 128.0000 ; 650.0000 ] - pt2: [ 148.0000 ; 670.0000 ] + pt1: [ 128.0000 ; 644.0000 ] + pt2: [ 148.0000 ; 664.0000 ] start: 0.0 extend: 0.0 stroke: 0.0-0.0-1.0 - shadow: 3 - color: ff000000 + shadow: 0 + color: ff222222 backcolor: NULL_COLOR ELLIPSE: - pt1: [ 132.5000 ; 654.5000 ] - pt2: [ 144.5000 ; 666.5000 ] + pt1: [ 132.5000 ; 648.5000 ] + pt2: [ 144.5000 ; 660.5000 ] start: 0.0 extend: 0.0 stroke: 0.0-0.0-1.0 shadow: 0 color: NULL_COLOR - backcolor: ff000000 + backcolor: ff222222 RECTANGLE: - pt1: [ 145.5000 ; 229.0000 ] - pt2: [ 354.3239 ; 261.0000 ] + pt1: [ 145.5000 ; 223.0000 ] + pt2: [ 354.3239 ; 255.0000 ] xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: getPreference - position: [ 155.5000 ; 248.3333 ] + position: [ 155.5000 ; 242.3333 ] orientation: 0 font: SansSerif.plain/12 [] color: ff000000 extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 235.0000 ; 298.0000 ] - pt2: [ 315.0000 ; 306.0000 ] + pt1: [ 235.0000 ; 292.0000 ] + pt2: [ 315.0000 ; 300.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 - shadow: 4 + shadow: 0 color: NULL_COLOR - backcolor: ff000000 + backcolor: ff555555 POLYGON: points: - - [ 275.0000 ; 359.0000 ] - - [ 287.0000 ; 371.0000 ] - - [ 275.0000 ; 383.0000 ] - - [ 263.0000 ; 371.0000 ] - - [ 275.0000 ; 359.0000 ] + - [ 275.0000 ; 353.0000 ] + - [ 287.0000 ; 365.0000 ] + - [ 275.0000 ; 377.0000 ] + - [ 263.0000 ; 365.0000 ] + - [ 275.0000 ; 353.0000 ] stroke: 0.0-0.0-1.5 - shadow: 5 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 RECTANGLE: - pt1: [ 264.0000 ; 520.0000 ] - pt2: [ 344.0000 ; 528.0000 ] + pt1: [ 264.0000 ; 514.0000 ] + pt2: [ 344.0000 ; 522.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 - shadow: 4 + shadow: 0 color: NULL_COLOR - backcolor: ff000000 + backcolor: ff555555 RECTANGLE: - pt1: [ 262.0000 ; 451.0000 ] - pt2: [ 423.7702 ; 483.0000 ] + pt1: [ 262.0000 ; 445.0000 ] + pt2: [ 423.7702 ; 477.0000 ] xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: ReceiveBaggage - position: [ 272.0000 ; 470.3333 ] + position: [ 272.0000 ; 464.3333 ] orientation: 0 font: SansSerif.plain/12 [] color: ff000000 extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 351.0000 ; 401.0000 ] - pt2: [ 546.6156 ; 433.0000 ] + pt1: [ 351.0000 ; 395.0000 ] + pt2: [ 546.6156 ; 427.0000 ] xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: PrintBoadingboard - position: [ 361.0000 ; 420.3333 ] + position: [ 361.0000 ; 414.3333 ] orientation: 0 font: SansSerif.plain/12 [] color: ff000000 extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 115.5000 ; 581.0000 ] - pt2: [ 440.6392 ; 613.0000 ] + pt1: [ 115.5000 ; 575.0000 ] + pt2: [ 440.6392 ; 607.0000 ] xCorner: 25 yCorner: 25 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: GiveTravelDocumentation - position: [ 125.5000 ; 600.3333 ] + position: [ 125.5000 ; 594.3333 ] orientation: 0 font: SansSerif.plain/12 [] color: ff000000 @@ -196,59 +196,59 @@ TEXT: PATH: - type: SEG_MOVETO - pt1: [ 142.0000 ; 25.2631 ] + pt1: [ 142.0000 ; 19.2631 ] - type: SEG_CUBICTO - pt1: [ 142.0000 ; 35.4562 ] - pt2: [ 142.0000 ; 50.5520 ] - pt3: [ 142.0000 ; 61.8097 ] + pt1: [ 142.0000 ; 29.4562 ] + pt2: [ 142.0000 ; 44.5520 ] + pt3: [ 142.0000 ; 55.8097 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 149.0000 ; 67.8097 ] - - [ 153.0000 ; 58.8097 ] - - [ 149.0000 ; 62.8097 ] - - [ 145.0000 ; 58.8097 ] - - [ 149.0000 ; 67.8097 ] + - [ 149.0000 ; 61.8097 ] + - [ 153.0000 ; 52.8097 ] + - [ 149.0000 ; 56.8097 ] + - [ 145.0000 ; 52.8097 ] + - [ 149.0000 ; 61.8097 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 PATH: - type: SEG_MOVETO - pt1: [ 142.0000 ; 94.2505 ] + pt1: [ 142.0000 ; 88.2505 ] - type: SEG_CUBICTO - pt1: [ 142.0000 ; 105.4667 ] - pt2: [ 142.0000 ; 120.4679 ] - pt3: [ 142.0000 ; 130.6413 ] + pt1: [ 142.0000 ; 99.4667 ] + pt2: [ 142.0000 ; 114.4679 ] + pt3: [ 142.0000 ; 124.6413 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 149.0000 ; 136.6413 ] - - [ 153.0000 ; 127.6413 ] - - [ 149.0000 ; 131.6413 ] - - [ 145.0000 ; 127.6413 ] - - [ 149.0000 ; 136.6413 ] + - [ 149.0000 ; 130.6413 ] + - [ 153.0000 ; 121.6413 ] + - [ 149.0000 ; 125.6413 ] + - [ 145.0000 ; 121.6413 ] + - [ 149.0000 ; 130.6413 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 EMPTY: - pt1: [ 137.0000 ; 123.6413 ] - pt2: [ 149.4231 ; 136.6413 ] + pt1: [ 137.0000 ; 117.6413 ] + pt2: [ 149.4231 ; 130.6413 ] TEXT: text: - position: [ 138.0000 ; 133.1969 ] + position: [ 138.0000 ; 127.1969 ] orientation: 0 font: SansSerif.plain/11 [] color: ff000000 @@ -256,35 +256,35 @@ TEXT: PATH: - type: SEG_MOVETO - pt1: [ 129.7752 ; 153.1168 ] + pt1: [ 129.7752 ; 147.1168 ] - type: SEG_CUBICTO - pt1: [ 122.2145 ; 158.7553 ] - pt2: [ 112.3164 ; 166.1369 ] - pt3: [ 103.5732 ; 172.6573 ] + pt1: [ 122.2145 ; 152.7553 ] + pt2: [ 112.3164 ; 160.1369 ] + pt3: [ 103.5732 ; 166.6573 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 110.5732 ; 178.6573 ] - - [ 120.1792 ; 176.4834 ] - - [ 114.5813 ; 175.6681 ] - - [ 115.3966 ; 170.0703 ] - - [ 110.5732 ; 178.6573 ] + - [ 110.5732 ; 172.6573 ] + - [ 120.1792 ; 170.4834 ] + - [ 114.5813 ; 169.6681 ] + - [ 115.3966 ; 164.0703 ] + - [ 110.5732 ; 172.6573 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 EMPTY: - pt1: [ 33.1176 ; 155.5563 ] - pt2: [ 124.3348 ; 168.5563 ] + pt1: [ 33.1176 ; 149.5563 ] + pt2: [ 124.3348 ; 162.5563 ] TEXT: text: incorrect - position: [ 34.1176 ; 165.1119 ] + position: [ 34.1176 ; 159.1119 ] orientation: 0 font: SansSerif.plain/11 [] color: ff000000 @@ -292,71 +292,71 @@ TEXT: PATH: - type: SEG_MOVETO - pt1: [ 80.9376 ; 205.2651 ] + pt1: [ 80.9376 ; 199.2651 ] - type: SEG_CUBICTO - pt1: [ 78.8728 ; 221.8910 ] - pt2: [ 76.0000 ; 249.2842 ] - pt3: [ 76.0000 ; 273.0000 ] + pt1: [ 78.8728 ; 215.8910 ] + pt2: [ 76.0000 ; 243.2842 ] + pt3: [ 76.0000 ; 267.0000 ] - type: SEG_CUBICTO - pt1: [ 76.0000 ; 273.0000 ] - pt2: [ 76.0000 ; 273.0000 ] - pt3: [ 76.0000 ; 592.0000 ] + pt1: [ 76.0000 ; 267.0000 ] + pt2: [ 76.0000 ; 267.0000 ] + pt3: [ 76.0000 ; 586.0000 ] - type: SEG_CUBICTO - pt1: [ 76.0000 ; 619.0056 ] - pt2: [ 105.0341 ; 640.0259 ] - pt3: [ 120.9122 ; 649.5023 ] + pt1: [ 76.0000 ; 613.0056 ] + pt2: [ 105.0341 ; 634.0259 ] + pt3: [ 120.9122 ; 643.5023 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 127.9122 ; 655.5023 ] - - [ 122.2339 ; 647.4551 ] - - [ 123.6187 ; 652.9399 ] - - [ 118.1340 ; 654.3247 ] - - [ 127.9122 ; 655.5023 ] + - [ 127.9122 ; 649.5023 ] + - [ 122.2339 ; 641.4551 ] + - [ 123.6187 ; 646.9399 ] + - [ 118.1340 ; 648.3247 ] + - [ 127.9122 ; 649.5023 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 PATH: - type: SEG_MOVETO - pt1: [ 154.0211 ; 154.3508 ] + pt1: [ 154.0211 ; 148.3508 ] - type: SEG_CUBICTO - pt1: [ 160.3243 ; 159.8317 ] - pt2: [ 168.1405 ; 166.7127 ] - pt3: [ 175.0000 ; 173.0000 ] + pt1: [ 160.3243 ; 153.8317 ] + pt2: [ 168.1405 ; 160.7127 ] + pt3: [ 175.0000 ; 167.0000 ] - type: SEG_CUBICTO - pt1: [ 193.2996 ; 189.7733 ] - pt2: [ 213.8411 ; 209.5434 ] - pt3: [ 227.5109 ; 222.8383 ] + pt1: [ 193.2996 ; 183.7733 ] + pt2: [ 213.8411 ; 203.5434 ] + pt3: [ 227.5109 ; 216.8383 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 234.5109 ; 228.8383 ] - - [ 230.8479 ; 219.6959 ] - - [ 230.9266 ; 225.3522 ] - - [ 225.2702 ; 225.4309 ] - - [ 234.5109 ; 228.8383 ] + - [ 234.5109 ; 222.8383 ] + - [ 230.8479 ; 213.6959 ] + - [ 230.9266 ; 219.3522 ] + - [ 225.2702 ; 219.4309 ] + - [ 234.5109 ; 222.8383 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 EMPTY: - pt1: [ 216.0000 ; 188.5000 ] - pt2: [ 293.9440 ; 201.5000 ] + pt1: [ 216.0000 ; 182.5000 ] + pt2: [ 293.9440 ; 195.5000 ] TEXT: text: correct - position: [ 217.0000 ; 198.0556 ] + position: [ 217.0000 ; 192.0556 ] orientation: 0 font: SansSerif.plain/11 [] color: ff000000 @@ -364,59 +364,59 @@ TEXT: PATH: - type: SEG_MOVETO - pt1: [ 249.0518 ; 255.2505 ] + pt1: [ 249.0518 ; 249.2505 ] - type: SEG_CUBICTO - pt1: [ 253.5027 ; 266.4667 ] - pt2: [ 259.4555 ; 281.4679 ] - pt3: [ 263.4926 ; 291.6413 ] + pt1: [ 253.5027 ; 260.4667 ] + pt2: [ 259.4555 ; 275.4679 ] + pt3: [ 263.4926 ; 285.6413 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 270.4926 ; 297.6413 ] - - [ 270.8909 ; 287.8005 ] - - [ 268.6484 ; 292.9939 ] - - [ 263.4550 ; 290.7513 ] - - [ 270.4926 ; 297.6413 ] + - [ 270.4926 ; 291.6413 ] + - [ 270.8909 ; 281.8005 ] + - [ 268.6484 ; 286.9939 ] + - [ 263.4550 ; 284.7513 ] + - [ 270.4926 ; 291.6413 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 PATH: - type: SEG_MOVETO - pt1: [ 268.0000 ; 316.0974 ] + pt1: [ 268.0000 ; 310.0974 ] - type: SEG_CUBICTO - pt1: [ 268.0000 ; 326.6457 ] - pt2: [ 268.0000 ; 342.4205 ] - pt3: [ 268.0000 ; 352.9523 ] + pt1: [ 268.0000 ; 320.6457 ] + pt2: [ 268.0000 ; 336.4205 ] + pt3: [ 268.0000 ; 346.9523 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 275.0000 ; 358.9523 ] - - [ 279.0000 ; 349.9523 ] - - [ 275.0000 ; 353.9523 ] - - [ 271.0000 ; 349.9523 ] - - [ 275.0000 ; 358.9523 ] + - [ 275.0000 ; 352.9523 ] + - [ 279.0000 ; 343.9523 ] + - [ 275.0000 ; 347.9523 ] + - [ 271.0000 ; 343.9523 ] + - [ 275.0000 ; 352.9523 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 EMPTY: - pt1: [ 263.0000 ; 345.9523 ] - pt2: [ 275.4231 ; 358.9523 ] + pt1: [ 263.0000 ; 339.9523 ] + pt2: [ 275.4231 ; 352.9523 ] TEXT: text: - position: [ 264.0000 ; 355.5079 ] + position: [ 264.0000 ; 349.5079 ] orientation: 0 font: SansSerif.plain/11 [] color: ff000000 @@ -424,39 +424,39 @@ TEXT: PATH: - type: SEG_MOVETO - pt1: [ 255.8218 ; 369.4963 ] + pt1: [ 255.8218 ; 363.4963 ] - type: SEG_CUBICTO - pt1: [ 215.5382 ; 381.6592 ] - pt2: [ 91.3580 ; 424.2712 ] - pt3: [ 131.0000 ; 477.0000 ] + pt1: [ 215.5382 ; 375.6592 ] + pt2: [ 91.3580 ; 418.2712 ] + pt3: [ 131.0000 ; 471.0000 ] - type: SEG_CUBICTO - pt1: [ 146.0983 ; 497.0826 ] - pt2: [ 212.5044 ; 511.4342 ] - pt3: [ 256.6136 ; 518.9570 ] + pt1: [ 146.0983 ; 491.0826 ] + pt2: [ 212.5044 ; 505.4342 ] + pt3: [ 256.6136 ; 512.9570 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 263.6136 ; 524.9570 ] - - [ 255.4141 ; 519.5008 ] - - [ 258.6847 ; 524.1164 ] - - [ 254.0692 ; 527.3870 ] - - [ 263.6136 ; 524.9570 ] + - [ 263.6136 ; 518.9570 ] + - [ 255.4141 ; 513.5008 ] + - [ 258.6847 ; 518.1164 ] + - [ 254.0692 ; 521.3870 ] + - [ 263.6136 ; 518.9570 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 EMPTY: - pt1: [ 138.0000 ; 460.5000 ] - pt2: [ 253.5031 ; 473.5000 ] + pt1: [ 138.0000 ; 454.5000 ] + pt2: [ 253.5031 ; 467.5000 ] TEXT: text: nobagage - position: [ 139.0000 ; 470.0556 ] + position: [ 139.0000 ; 464.0556 ] orientation: 0 font: SansSerif.plain/11 [] color: ff000000 @@ -464,39 +464,39 @@ TEXT: PATH: - type: SEG_MOVETO - pt1: [ 265.1414 ; 377.3557 ] + pt1: [ 265.1414 ; 371.3557 ] - type: SEG_CUBICTO - pt1: [ 262.5349 ; 390.4258 ] - pt2: [ 260.3945 ; 412.0128 ] - pt3: [ 270.0000 ; 427.0000 ] + pt1: [ 262.5349 ; 384.4258 ] + pt2: [ 260.3945 ; 406.0128 ] + pt3: [ 270.0000 ; 421.0000 ] - type: SEG_CUBICTO - pt1: [ 274.7698 ; 434.4421 ] - pt2: [ 281.7630 ; 440.2698 ] - pt3: [ 289.4347 ; 444.8128 ] + pt1: [ 274.7698 ; 428.4421 ] + pt2: [ 281.7630 ; 434.2698 ] + pt3: [ 289.4347 ; 438.8128 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 296.4347 ; 450.8128 ] - - [ 290.7288 ; 442.7852 ] - - [ 292.1324 ; 448.2651 ] - - [ 286.6525 ; 449.6688 ] - - [ 296.4347 ; 450.8128 ] + - [ 296.4347 ; 444.8128 ] + - [ 290.7288 ; 436.7852 ] + - [ 292.1324 ; 442.2651 ] + - [ 286.6525 ; 443.6688 ] + - [ 296.4347 ; 444.8128 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 EMPTY: - pt1: [ 277.0000 ; 410.5000 ] - pt2: [ 342.5080 ; 423.5000 ] + pt1: [ 277.0000 ; 404.5000 ] + pt2: [ 342.5080 ; 417.5000 ] TEXT: text: bagage - position: [ 278.0000 ; 420.0556 ] + position: [ 278.0000 ; 414.0556 ] orientation: 0 font: SansSerif.plain/11 [] color: ff000000 @@ -504,127 +504,127 @@ TEXT: PATH: - type: SEG_MOVETO - pt1: [ 326.5592 ; 477.2505 ] + pt1: [ 326.5592 ; 471.2505 ] - type: SEG_CUBICTO - pt1: [ 319.6159 ; 488.4667 ] - pt2: [ 310.3294 ; 503.4679 ] - pt3: [ 304.0316 ; 513.6413 ] + pt1: [ 319.6159 ; 482.4667 ] + pt2: [ 310.3294 ; 497.4679 ] + pt3: [ 304.0316 ; 507.6413 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 311.0316 ; 519.6413 ] - - [ 319.1698 ; 514.0944 ] - - [ 313.6633 ; 515.3900 ] - - [ 312.3677 ; 509.8835 ] - - [ 311.0316 ; 519.6413 ] + - [ 311.0316 ; 513.6413 ] + - [ 319.1698 ; 508.0944 ] + - [ 313.6633 ; 509.3900 ] + - [ 312.3677 ; 503.8835 ] + - [ 311.0316 ; 513.6413 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 PATH: - type: SEG_MOVETO - pt1: [ 286.2922 ; 316.0384 ] + pt1: [ 286.2922 ; 310.0384 ] - type: SEG_CUBICTO - pt1: [ 317.6162 ; 334.9408 ] - pt2: [ 381.5657 ; 373.5310 ] - pt3: [ 416.9883 ; 394.9067 ] + pt1: [ 317.6162 ; 328.9408 ] + pt2: [ 381.5657 ; 367.5310 ] + pt3: [ 416.9883 ; 388.9067 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 423.9883 ; 400.9067 ] - - [ 418.3493 ; 392.8320 ] - - [ 419.7074 ; 398.3234 ] - - [ 414.2160 ; 399.6815 ] - - [ 423.9883 ; 400.9067 ] + - [ 423.9883 ; 394.9067 ] + - [ 418.3493 ; 386.8320 ] + - [ 419.7074 ; 392.3234 ] + - [ 414.2160 ; 393.6815 ] + - [ 423.9883 ; 394.9067 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 PATH: - type: SEG_MOVETO - pt1: [ 442.1322 ; 427.2570 ] + pt1: [ 442.1322 ; 421.2570 ] - type: SEG_CUBICTO - pt1: [ 441.4486 ; 441.7451 ] - pt2: [ 438.2173 ; 463.2922 ] - pt3: [ 426.0000 ; 477.0000 ] + pt1: [ 441.4486 ; 435.7451 ] + pt2: [ 438.2173 ; 457.2922 ] + pt3: [ 426.0000 ; 471.0000 ] - type: SEG_CUBICTO - pt1: [ 403.3436 ; 502.4206 ] - pt2: [ 365.9396 ; 514.4137 ] - pt3: [ 337.2264 ; 520.0513 ] + pt1: [ 403.3436 ; 496.4206 ] + pt2: [ 365.9396 ; 508.4137 ] + pt3: [ 337.2264 ; 514.0513 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 344.2264 ; 526.0513 ] - - [ 353.8284 ; 528.2424 ] - - [ 349.1327 ; 525.0880 ] - - [ 352.2871 ; 520.3923 ] - - [ 344.2264 ; 526.0513 ] + - [ 344.2264 ; 520.0513 ] + - [ 353.8284 ; 522.2424 ] + - [ 349.1327 ; 519.0880 ] + - [ 352.2871 ; 514.3923 ] + - [ 344.2264 ; 520.0513 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 PATH: - type: SEG_MOVETO - pt1: [ 292.3517 ; 538.2631 ] + pt1: [ 292.3517 ; 532.2631 ] - type: SEG_CUBICTO - pt1: [ 288.1451 ; 548.4562 ] - pt2: [ 281.9151 ; 563.5520 ] - pt3: [ 277.2690 ; 574.8097 ] + pt1: [ 288.1451 ; 542.4562 ] + pt2: [ 281.9151 ; 557.5520 ] + pt3: [ 277.2690 ; 568.8097 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 284.2690 ; 580.8097 ] - - [ 291.3999 ; 574.0163 ] - - [ 286.1765 ; 576.1878 ] - - [ 284.0049 ; 570.9644 ] - - [ 284.2690 ; 580.8097 ] + - [ 284.2690 ; 574.8097 ] + - [ 291.3999 ; 568.0163 ] + - [ 286.1765 ; 570.1878 ] + - [ 284.0049 ; 564.9644 ] + - [ 284.2690 ; 574.8097 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 PATH: - type: SEG_MOVETO - pt1: [ 237.4665 ; 607.0901 ] + pt1: [ 237.4665 ; 601.0901 ] - type: SEG_CUBICTO - pt1: [ 206.0796 ; 621.2142 ] - pt2: [ 161.1219 ; 641.4451 ] - pt3: [ 141.1865 ; 650.4161 ] + pt1: [ 206.0796 ; 615.2142 ] + pt2: [ 161.1219 ; 635.4451 ] + pt3: [ 141.1865 ; 644.4161 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 148.1865 ; 656.4161 ] - - [ 158.0353 ; 656.3705 ] - - [ 152.7461 ; 654.3642 ] - - [ 154.7524 ; 649.0751 ] - - [ 148.1865 ; 656.4161 ] + - [ 148.1865 ; 650.4161 ] + - [ 158.0353 ; 650.3705 ] + - [ 152.7461 ; 648.3642 ] + - [ 154.7524 ; 643.0751 ] + - [ 148.1865 ; 650.4161 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 """ */ \ No newline at end of file diff --git a/test/nonreg/simple/A0005_TestResult.java b/test/nonreg/simple/A0005_TestResult.java index a1b4ddc66..bdc744ef8 100644 --- a/test/nonreg/simple/A0005_TestResult.java +++ b/test/nonreg/simple/A0005_TestResult.java @@ -5,7 +5,7 @@ public class A0005_TestResult { /* """ DPI: 96 -dimension: [ 128.0935 ; 282.0000 ] +dimension: [ 128.0935 ; 275.0000 ] scaleFactor: 1.0000 seed: 293863236578191100 svgLinkTarget: _top @@ -23,7 +23,7 @@ RECTANGLE: yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ffff0000 TEXT: @@ -45,7 +45,7 @@ RECTANGLE: yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ffffff00 TEXT: @@ -58,173 +58,173 @@ TEXT: COMMENT: class Bob RECTANGLE: - pt1: [ 25.6999 ; 143.0000 ] - pt2: [ 102.4463 ; 205.0000 ] + pt1: [ 29.1999 ; 136.0000 ] + pt2: [ 105.9463 ; 198.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 EMPTY: - pt1: [ 29.7685 ; 143.0000 ] - pt2: [ 55.7685 ; 175.0000 ] + pt1: [ 33.2685 ; 136.0000 ] + pt2: [ 59.2685 ; 168.0000 ] ELLIPSE: - pt1: [ 33.7685 ; 148.0000 ] - pt2: [ 55.7685 ; 170.0000 ] + pt1: [ 37.2685 ; 141.0000 ] + pt2: [ 59.2685 ; 163.0000 ] start: 0.0 extend: 0.0 stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: ffadd1b2 CENTERED_CHAR: char: C - position: [ 44.7685 ; 159.0000 ] + position: [ 48.2685 ; 152.0000 ] font: Monospaced.bold/17 color: ff000000 EMPTY: - pt1: [ 56.6726 ; 152.0000 ] - pt2: [ 98.3776 ; 166.0000 ] + pt1: [ 60.1726 ; 145.0000 ] + pt2: [ 101.8776 ; 159.0000 ] TEXT: text: Bob - position: [ 59.6726 ; 162.8889 ] + position: [ 63.1726 ; 155.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR LINE: - pt1: [ 26.6999 ; 175.0000 ] - pt2: [ 101.4463 ; 175.0000 ] + pt1: [ 30.1999 ; 168.0000 ] + pt2: [ 104.9463 ; 168.0000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 EMPTY: - pt1: [ 25.6999 ; 175.0000 ] - pt2: [ 102.4463 ; 197.0000 ] + pt1: [ 29.1999 ; 168.0000 ] + pt2: [ 105.9463 ; 190.0000 ] TEXT: text: hello - position: [ 31.6999 ; 189.8889 ] + position: [ 35.1999 ; 182.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR LINE: - pt1: [ 26.6999 ; 197.0000 ] - pt2: [ 101.4463 ; 197.0000 ] + pt1: [ 30.1999 ; 190.0000 ] + pt2: [ 104.9463 ; 190.0000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 EMPTY: - pt1: [ 25.6999 ; 197.0000 ] - pt2: [ 37.6999 ; 205.0000 ] + pt1: [ 29.1999 ; 190.0000 ] + pt2: [ 41.1999 ; 198.0000 ] COMMENT: class Sally RECTANGLE: - pt1: [ 18.1999 ; 59.0000 ] - pt2: [ 109.8937 ; 107.0000 ] + pt1: [ 21.6999 ; 52.0000 ] + pt2: [ 113.3937 ; 100.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 EMPTY: - pt1: [ 18.1999 ; 59.0000 ] - pt2: [ 44.1999 ; 91.0000 ] + pt1: [ 21.6999 ; 52.0000 ] + pt2: [ 47.6999 ; 84.0000 ] ELLIPSE: - pt1: [ 22.1999 ; 64.0000 ] - pt2: [ 44.1999 ; 86.0000 ] + pt1: [ 25.6999 ; 57.0000 ] + pt2: [ 47.6999 ; 79.0000 ] start: 0.0 extend: 0.0 stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: ffadd1b2 CENTERED_CHAR: char: C - position: [ 33.1999 ; 75.0000 ] + position: [ 36.6999 ; 68.0000 ] font: Monospaced.bold/17 color: ff000000 EMPTY: - pt1: [ 44.1999 ; 68.0000 ] - pt2: [ 109.8937 ; 82.0000 ] + pt1: [ 47.6999 ; 61.0000 ] + pt2: [ 113.3937 ; 75.0000 ] TEXT: text: Sally - position: [ 47.1999 ; 78.8889 ] + position: [ 50.6999 ; 71.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR LINE: - pt1: [ 19.1999 ; 91.0000 ] - pt2: [ 108.8937 ; 91.0000 ] + pt1: [ 22.6999 ; 84.0000 ] + pt2: [ 112.3937 ; 84.0000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 EMPTY: - pt1: [ 18.1999 ; 91.0000 ] - pt2: [ 30.1999 ; 99.0000 ] + pt1: [ 21.6999 ; 84.0000 ] + pt2: [ 33.6999 ; 92.0000 ] LINE: - pt1: [ 19.1999 ; 99.0000 ] - pt2: [ 108.8937 ; 99.0000 ] + pt1: [ 22.6999 ; 92.0000 ] + pt2: [ 112.3937 ; 92.0000 ] stroke: 0.0-0.0-1.5 shadow: 0 - color: ffa80036 + color: ff181818 EMPTY: - pt1: [ 18.1999 ; 99.0000 ] - pt2: [ 30.1999 ; 107.0000 ] + pt1: [ 21.6999 ; 92.0000 ] + pt2: [ 33.6999 ; 100.0000 ] PATH: - type: SEG_MOVETO - pt1: [ 46.0000 ; 55.3837 ] + pt1: [ 46.0000 ; 48.3837 ] - type: SEG_CUBICTO - pt1: [ 46.0000 ; 66.1992 ] - pt2: [ 46.0000 ; 79.1811 ] - pt3: [ 46.0000 ; 90.7328 ] + pt1: [ 46.0000 ; 59.1992 ] + pt2: [ 46.0000 ; 72.1811 ] + pt3: [ 46.0000 ; 83.7328 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 backcolor: NULL_COLOR POLYGON: points: - - [ 64.1999 ; 142.7328 ] - - [ 68.1999 ; 133.7328 ] - - [ 64.1999 ; 137.7328 ] - - [ 60.1999 ; 133.7328 ] - - [ 64.1999 ; 142.7328 ] + - [ 67.6999 ; 135.7328 ] + - [ 71.6999 ; 126.7328 ] + - [ 67.6999 ; 130.7328 ] + - [ 63.6999 ; 126.7328 ] + - [ 67.6999 ; 135.7328 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 EMPTY: - pt1: [ 0.0000 ; 200.0000 ] - pt2: [ 122.0935 ; 243.0000 ] + pt1: [ 0.0000 ; 193.0000 ] + pt2: [ 122.0935 ; 236.0000 ] RECTANGLE: - pt1: [ 8.0000 ; 208.0000 ] - pt2: [ 113.0935 ; 234.0000 ] + pt1: [ 8.0000 ; 201.0000 ] + pt2: [ 113.0935 ; 227.0000 ] xCorner: 15 yCorner: 15 stroke: 0.0-0.0-1.0 @@ -234,51 +234,51 @@ RECTANGLE: TEXT: text: legend - position: [ 14.0000 ; 224.8889 ] + position: [ 14.0000 ; 217.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR EMPTY: - pt1: [ 2.6679 ; 243.0000 ] - pt2: [ 119.4256 ; 260.0000 ] + pt1: [ 2.6679 ; 236.0000 ] + pt2: [ 119.4256 ; 253.0000 ] RECTANGLE: - pt1: [ 3.6679 ; 244.0000 ] - pt2: [ 117.4256 ; 258.0000 ] + pt1: [ 3.6679 ; 237.0000 ] + pt2: [ 117.4256 ; 251.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ff800080 TEXT: text: caption - position: [ 3.6679 ; 254.8889 ] + position: [ 3.6679 ; 247.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR EMPTY: - pt1: [ 16.9796 ; 260.0000 ] - pt2: [ 105.1139 ; 276.0000 ] + pt1: [ 16.9796 ; 253.0000 ] + pt2: [ 105.1139 ; 269.0000 ] RECTANGLE: - pt1: [ 16.9796 ; 260.0000 ] - pt2: [ 104.1139 ; 275.0000 ] + pt1: [ 16.9796 ; 253.0000 ] + pt2: [ 104.1139 ; 268.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ff0000ff TEXT: text: footer - position: [ 16.9796 ; 271.6667 ] + position: [ 16.9796 ; 264.6667 ] orientation: 0 font: SansSerif.plain/15 [] color: ffff0000 diff --git a/test/nonreg/simple/A0006_TestResult.java b/test/nonreg/simple/A0006_TestResult.java index 57e0f3286..3e20904b5 100644 --- a/test/nonreg/simple/A0006_TestResult.java +++ b/test/nonreg/simple/A0006_TestResult.java @@ -5,7 +5,7 @@ public class A0006_TestResult { /* """ DPI: 96 -dimension: [ 157.3989 ; 233.0000 ] +dimension: [ 149.3989 ; 225.0000 ] scaleFactor: 1.0000 seed: -2375783792654745998 svgLinkTarget: _top @@ -13,62 +13,62 @@ hoverPathColorRGB: null preserveAspectRatio: none EMPTY: - pt1: [ 35.3586 ; 16.0000 ] - pt2: [ 116.0403 ; 51.0000 ] + pt1: [ 31.3586 ; 16.0000 ] + pt2: [ 112.0403 ; 51.0000 ] RECTANGLE: - pt1: [ 40.3586 ; 21.0000 ] - pt2: [ 110.0403 ; 45.0000 ] + pt1: [ 36.3586 ; 21.0000 ] + pt2: [ 106.0403 ; 45.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ffffff00 TEXT: text: title - position: [ 45.3586 ; 36.8889 ] + position: [ 41.3586 ; 36.8889 ] orientation: 0 font: SansSerif.bold/14 [BOLD] color: ff000000 extendedColor: NULL_COLOR EMPTY: - pt1: [ 17.3206 ; 194.0000 ] - pt2: [ 134.0783 ; 211.0000 ] + pt1: [ 13.3206 ; 186.0000 ] + pt2: [ 130.0783 ; 203.0000 ] RECTANGLE: - pt1: [ 18.3206 ; 195.0000 ] - pt2: [ 132.0783 ; 209.0000 ] + pt1: [ 14.3206 ; 187.0000 ] + pt2: [ 128.0783 ; 201.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ff800080 TEXT: text: caption - position: [ 18.3206 ; 205.8889 ] + position: [ 14.3206 ; 197.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR LINE: - pt1: [ 43.0000 ; 84.0000 ] - pt2: [ 43.0000 ; 118.0000 ] + pt1: [ 41.0000 ; 80.0000 ] + pt2: [ 41.0000 ; 114.0000 ] stroke: 5.0-5.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 LINE: - pt1: [ 118.6938 ; 84.0000 ] - pt2: [ 118.6938 ; 118.0000 ] + pt1: [ 112.6938 ; 80.0000 ] + pt2: [ 112.6938 ; 114.0000 ] stroke: 5.0-5.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 RECTANGLE: pt1: [ 5.0000 ; 51.0000 ] @@ -76,9 +76,9 @@ RECTANGLE: xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Sally @@ -89,54 +89,54 @@ TEXT: extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 5.0000 ; 117.0000 ] - pt2: [ 78.6938 ; 145.0000 ] + pt1: [ 5.0000 ; 113.0000 ] + pt2: [ 78.6938 ; 141.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Sally - position: [ 12.0000 ; 134.8889 ] + position: [ 12.0000 ; 130.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 92.6938 ; 51.0000 ] - pt2: [ 142.3989 ; 79.0000 ] + pt1: [ 88.6938 ; 51.0000 ] + pt2: [ 138.3989 ; 79.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Bob - position: [ 99.6938 ; 68.8889 ] + position: [ 95.6938 ; 68.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 extendedColor: NULL_COLOR RECTANGLE: - pt1: [ 92.6938 ; 117.0000 ] - pt2: [ 142.3989 ; 145.0000 ] + pt1: [ 88.6938 ; 113.0000 ] + pt2: [ 138.3989 ; 141.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.5 - shadow: 4 - color: ffa80036 - backcolor: fffefece + shadow: 0 + color: ff181818 + backcolor: fff8f8f8 TEXT: text: Bob - position: [ 99.6938 ; 134.8889 ] + position: [ 95.6938 ; 130.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000 @@ -144,73 +144,73 @@ TEXT: POLYGON: points: - - [ 107.5463 ; 96.0000 ] - - [ 117.5463 ; 100.0000 ] - - [ 107.5463 ; 104.0000 ] - - [ 111.5463 ; 100.0000 ] + - [ 101.5463 ; 92.0000 ] + - [ 111.5463 ; 96.0000 ] + - [ 101.5463 ; 100.0000 ] + - [ 105.5463 ; 96.0000 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ffa80036 - backcolor: ffa80036 + color: ff181818 + backcolor: ff181818 LINE: - pt1: [ 43.8469 ; 100.0000 ] - pt2: [ 113.5463 ; 100.0000 ] + pt1: [ 41.8469 ; 96.0000 ] + pt2: [ 107.5463 ; 96.0000 ] stroke: 2.0-2.0-1.0 shadow: 0 - color: ffa80036 + color: ff181818 EMPTY: - pt1: [ 73.0665 ; 5.0000 ] - pt2: [ 151.3989 ; 16.0000 ] + pt1: [ 65.0665 ; 5.0000 ] + pt2: [ 143.3989 ; 16.0000 ] RECTANGLE: - pt1: [ 73.0665 ; 5.0000 ] - pt2: [ 150.3989 ; 15.0000 ] + pt1: [ 65.0665 ; 5.0000 ] + pt2: [ 142.3989 ; 15.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ffff0000 TEXT: text: header - position: [ 73.0665 ; 12.7778 ] + position: [ 65.0665 ; 12.7778 ] orientation: 0 font: SansSerif.plain/10 [] color: ff888888 extendedColor: NULL_COLOR EMPTY: - pt1: [ 31.6323 ; 211.0000 ] - pt2: [ 119.7666 ; 227.0000 ] + pt1: [ 27.6323 ; 203.0000 ] + pt2: [ 115.7666 ; 219.0000 ] RECTANGLE: - pt1: [ 31.6323 ; 211.0000 ] - pt2: [ 118.7666 ; 226.0000 ] + pt1: [ 27.6323 ; 203.0000 ] + pt2: [ 114.7666 ; 218.0000 ] xCorner: 0 yCorner: 0 stroke: 0.0-0.0-1.0 shadow: 0 - color: NULL_COLOR + color: 0 backcolor: ff0000ff TEXT: text: footer - position: [ 31.6323 ; 222.6667 ] + position: [ 27.6323 ; 214.6667 ] orientation: 0 font: SansSerif.plain/15 [] color: ffff0000 extendedColor: NULL_COLOR EMPTY: - pt1: [ 14.6527 ; 151.0000 ] - pt2: [ 136.7462 ; 194.0000 ] + pt1: [ 10.6527 ; 143.0000 ] + pt2: [ 132.7462 ; 186.0000 ] RECTANGLE: - pt1: [ 22.6527 ; 159.0000 ] - pt2: [ 127.7462 ; 185.0000 ] + pt1: [ 18.6527 ; 151.0000 ] + pt2: [ 123.7462 ; 177.0000 ] xCorner: 15 yCorner: 15 stroke: 0.0-0.0-1.0 @@ -220,7 +220,7 @@ RECTANGLE: TEXT: text: legend - position: [ 28.6527 ; 175.8889 ] + position: [ 24.6527 ; 167.8889 ] orientation: 0 font: SansSerif.plain/14 [] color: ff000000